/* Generated by Cython 3.2.3 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayobject.h",
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include/numpy/arrayscalars.h",
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarrayobject.h",
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarraytypes.h",
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include/numpy/ufuncobject.h",
            "H2MM_C/C_H2MM.h"
        ],
        "include_dirs": [
            "H2MM_C",
            "/tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/_core/include",
            "H2MM_C/"
        ],
        "name": "H2MM_C",
        "sources": [
            "H2MM_C/H2MM_C.pyx",
            "H2MM_C/h2mm_functions.c",
            "H2MM_C/model_array.c",
            "H2MM_C/burst_threads.c",
            "H2MM_C/fwd_back.c",
            "H2MM_C/rho_calc.c",
            "H2MM_C/viterbi.c",
            "H2MM_C/model_limits_funcs.c",
            "H2MM_C/utils.c",
            "H2MM_C/state_path.c",
            "H2MM_C/pathloglik.c"
        ]
    },
    "module_name": "H2MM_C"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API)
  #if !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
  #endif
#elif defined(CYTHON_LIMITED_API)
  #ifdef _MSC_VER
  #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  #else
  #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  #endif
#endif

#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 < 0x03080000
    #error Cython requires Python 3.8+.
#else
#define __PYX_ABI_VERSION "3_2_3"
#define CYTHON_HEX_VERSION 0x030203F0
#define CYTHON_FUTURE_DIVISION 1
/* CModulePreamble */
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(_WIN32) && !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 PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 1
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(PYPY_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 1
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #if PY_VERSION_HEX < 0x03090000
    #undef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #undef CYTHON_USE_MODULE_STATE
  #define CYTHON_USE_MODULE_STATE 0
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  #endif
  #undef CYTHON_USE_AM_SEND
  #define CYTHON_USE_AM_SEND 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
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  #endif
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 0
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#elif defined(CYTHON_LIMITED_API)
  #ifdef Py_LIMITED_API
    #undef __PYX_LIMITED_VERSION_HEX
    #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  #endif
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 1
  #define CYTHON_COMPILING_IN_GRAAL 0
  #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #endif
  #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_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_ASSUME_SAFE_SIZE
  #define CYTHON_ASSUME_SAFE_SIZE 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_GIL
  #define CYTHON_FAST_GIL 0
  #undef CYTHON_METH_FASTCALL
  #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #undef CYTHON_USE_SYS_MONITORING
  #define CYTHON_USE_SYS_MONITORING 0
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 0
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
  #ifndef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 1
  #endif
  #undef CYTHON_IMMORTAL_CONSTANTS
  #define CYTHON_IMMORTAL_CONSTANTS 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 0
  #ifdef Py_GIL_DISABLED
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  #else
    #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  #endif
  #if PY_VERSION_HEX < 0x030A0000
    #undef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #elif !defined(CYTHON_USE_TYPE_SLOTS)
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #ifndef CYTHON_USE_TYPE_SPECS
    #define CYTHON_USE_TYPE_SPECS 0
  #endif
  #ifndef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #ifndef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
    #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
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
    #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_ASSUME_SAFE_SIZE
    #define CYTHON_ASSUME_SAFE_SIZE 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_FAST_GIL
    #define CYTHON_FAST_GIL 0
  #elif !defined(CYTHON_FAST_GIL)
    #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  #endif
  #ifndef CYTHON_METH_FASTCALL
    #define CYTHON_METH_FASTCALL 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP487_INIT_SUBCLASS
    #define CYTHON_PEP487_INIT_SUBCLASS 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_MODULE_STATE
    #define CYTHON_USE_MODULE_STATE 0
  #endif
  #ifndef CYTHON_USE_SYS_MONITORING
    #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #ifndef CYTHON_USE_AM_SEND
    #define CYTHON_USE_AM_SEND 1
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    #undef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS 0
  #elif !defined(CYTHON_USE_DICT_VERSIONS)
    #define CYTHON_USE_DICT_VERSIONS  (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 1
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
  #ifndef CYTHON_USE_FREELISTS
    #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
  #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
    #undef CYTHON_IMMORTAL_CONSTANTS
    #define CYTHON_IMMORTAL_CONSTANTS 0  // definitely won't work
  #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
    #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  #endif
#endif
#ifndef CYTHON_COMPRESS_STRINGS
  #define CYTHON_COMPRESS_STRINGS 1
#endif
#ifndef CYTHON_FAST_PYCCALL
#define CYTHON_FAST_PYCCALL  CYTHON_FAST_PYCALL
#endif
#ifndef CYTHON_VECTORCALL
#if CYTHON_COMPILING_IN_LIMITED_API
#define CYTHON_VECTORCALL  (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
#else
#define CYTHON_VECTORCALL  (CYTHON_FAST_PYCCALL)
#endif
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #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(__cplusplus)
    /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(maybe_unused)
        #define CYTHON_UNUSED [[maybe_unused]]
      #endif
    #endif
  #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_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
  #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_USE_CPP_STD_MOVE
  #if defined(__cplusplus) && (\
    __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
    #define CYTHON_USE_CPP_STD_MOVE 1
  #else
    #define CYTHON_USE_CPP_STD_MOVE 0
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#include <stdint.h>
typedef uintptr_t  __pyx_uintptr_t;
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #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 Py_UNREACHABLE
  #define Py_UNREACHABLE()  assert(0); abort()
#endif
#ifdef __cplusplus
  template <typename T>
  struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
#else
  #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
#endif
#if CYTHON_COMPILING_IN_PYPY == 1
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* CInitCode */
#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

/* PythonCompatibility */
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_DefaultClassType PyType_Type
#if CYTHON_COMPILING_IN_LIMITED_API
    #ifndef CO_OPTIMIZED
    static int CO_OPTIMIZED;
    #endif
    #ifndef CO_NEWLOCALS
    static int CO_NEWLOCALS;
    #endif
    #ifndef CO_VARARGS
    static int CO_VARARGS;
    #endif
    #ifndef CO_VARKEYWORDS
    static int CO_VARKEYWORDS;
    #endif
    #ifndef CO_ASYNC_GENERATOR
    static int CO_ASYNC_GENERATOR;
    #endif
    #ifndef CO_GENERATOR
    static int CO_GENERATOR;
    #endif
    #ifndef CO_COROUTINE
    static int CO_COROUTINE;
    #endif
#else
    #ifndef CO_COROUTINE
      #define CO_COROUTINE 0x80
    #endif
    #ifndef CO_ASYNC_GENERATOR
      #define CO_ASYNC_GENERATOR 0x200
    #endif
#endif
static int __Pyx_init_co_variables(void);
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
#else
  #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  #define __Pyx_Py_Is(x, y)  Py_Is(x, y)
#else
  #define __Pyx_Py_Is(x, y) ((x) == (y))
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
#else
  #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
#else
  #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
#endif
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
#else
  #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
#endif
#define __Pyx_NoneAsNull(obj)  (__Pyx_Py_IsNone(obj) ? NULL : (obj))
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
#else
  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
#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 Py_TPFLAGS_SEQUENCE
  #define Py_TPFLAGS_SEQUENCE 0
#endif
#ifndef Py_TPFLAGS_MAPPING
  #define Py_TPFLAGS_MAPPING 0
#endif
#ifndef Py_TPFLAGS_IMMUTABLETYPE
  #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
#endif
#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#ifndef 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
  #if PY_VERSION_HEX >= 0x030d00A4
  #  define __Pyx_PyCFunctionFast PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  #else
  #  define __Pyx_PyCFunctionFast _PyCFunctionFast
  #  define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  #endif
#endif
#if CYTHON_METH_FASTCALL
  #define __Pyx_METH_FASTCALL METH_FASTCALL
  #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
#else
  #define __Pyx_METH_FASTCALL METH_VARARGS
  #define __Pyx_PyCFunction_FastCall PyCFunction
  #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
#endif
#if CYTHON_VECTORCALL
  #define __pyx_vectorcallfunc vectorcallfunc
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  PY_VECTORCALL_ARGUMENTS_OFFSET
  #define __Pyx_PyVectorcall_NARGS(n)  PyVectorcall_NARGS((size_t)(n))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_VERSION_HEX >= 0x030900B1
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_CheckExact(func)
#else
#define __Pyx_PyCFunction_CheckExact(func)  PyCFunction_Check(func)
#endif
#define __Pyx_CyOrPyCFunction_Check(func)  PyCFunction_Check(func)
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  (((PyCFunctionObject*)(func))->m_ml->ml_meth)
#elif !CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func)  PyCFunction_GET_FUNCTION(func)
#endif
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CyOrPyCFunction_GET_FLAGS(func)  (((PyCFunctionObject*)(func))->m_ml->ml_flags)
static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
    return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
}
#endif
static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
#if CYTHON_COMPILING_IN_LIMITED_API
    return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
#else
    return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
#endif
}
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCFunction(func, cfunc)
#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  ((void)m, PyType_FromSpecWithBases(s, b))
  typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
#else
  #define __Pyx_PyType_FromModuleAndSpec(m, s, b)  PyType_FromModuleAndSpec(m, s, b)
  #define __Pyx_PyCMethod  PyCMethod
#endif
#ifndef METH_METHOD
  #define METH_METHOD 0x200
#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_LIMITED_API
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
#elif CYTHON_COMPILING_IN_GRAAL
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #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_COMPILING_IN_LIMITED_API
  #define __Pyx_PyThreadState_Current PyThreadState_Get()
#elif !CYTHON_FAST_THREAD_STATE
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x030d00A1
  #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#endif
#if CYTHON_USE_MODULE_STATE
static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
{
    void *result;
    result = PyModule_GetState(op);
    if (!result)
        Py_FatalError("Couldn't find the module state");
    return result;
}
#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
#else
#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
#endif
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype)  __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((type)->name)
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
#else
  #define __Pyx_PyType_GetSlot(type, name, func_ctype)  ((func_ctype) PyType_GetSlot((type), Py_##name))
  #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
    ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
     (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
     __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
#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
#define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStrWithError(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
    PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
    if (res == NULL) PyErr_Clear();
    return res;
}
#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
#define __Pyx_PyDict_GetItemStrWithError  PyDict_GetItemWithError
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#else
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
#if CYTHON_COMPILING_IN_PYPY
    return PyDict_GetItem(dict, name);
#else
    PyDictEntry *ep;
    PyDictObject *mp = (PyDictObject*) dict;
    long hash = ((PyStringObject *) name)->ob_shash;
    assert(hash != -1);
    ep = (mp->ma_lookup)(mp, name, hash);
    if (ep == NULL) {
        return NULL;
    }
    return ep->me_value;
#endif
}
#define __Pyx_PyDict_GetItemStr           PyDict_GetItem
#endif
#if CYTHON_USE_TYPE_SLOTS
  #define __Pyx_PyType_GetFlags(tp)   (((PyTypeObject *)tp)->tp_flags)
  #define __Pyx_PyType_HasFeature(type, feature)  ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
#else
  #define __Pyx_PyType_GetFlags(tp)   (PyType_GetFlags((PyTypeObject *)tp))
  #define __Pyx_PyType_HasFeature(type, feature)  PyType_HasFeature(type, feature)
#endif
#define __Pyx_PyObject_GetIterNextFunc(iterator)  __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
#if CYTHON_USE_TYPE_SPECS
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((void)u, 1114111U)
  #define __Pyx_PyUnicode_KIND(u)         ((void)u, (0))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)u)
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GetLength(u))
#else
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #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)         ((int)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, (Py_UCS4) ch)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#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
  #if !defined(PyUnicode_DecodeUnicodeEscape)
    #define PyUnicode_DecodeUnicodeEscape(s, size, errors)  PyUnicode_Decode(s, size, "unicode_escape", errors)
  #endif
  #if !defined(PyUnicode_Contains)
    #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  #endif
  #if !defined(PyByteArray_Check)
    #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  #endif
  #if !defined(PyObject_Format)
    #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  #endif
#endif
#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 CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#elif CYTHON_COMPILING_IN_CPYTHON
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
enum __Pyx_ReferenceSharing {
  __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  __Pyx_ReferenceSharing_OwnStrongReference,
  __Pyx_ReferenceSharing_FunctionArgument,
  __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
};
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
    (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
      (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
      (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
#else
#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
#endif
#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  #else
    #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  #endif
#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  #else
    #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  #endif
#else
  #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
#endif
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
    __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
#else
  #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
#endif
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyObject_GetItem(dict, key);
  if (*result == NULL) {
    if (PyErr_ExceptionMatches(PyExc_KeyError)) {
      PyErr_Clear();
      return 0;
    }
    return -1;
  }
  return 1;
}
#else
static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  *result = PyDict_GetItemWithError(dict, key);
  if (*result == NULL) {
    return PyErr_Occurred() ? -1 : 0;
  }
  Py_INCREF(*result);
  return 1;
}
#endif
#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  #define __Pyx_VISIT_CONST(obj)  Py_VISIT(obj)
#else
  #define __Pyx_VISIT_CONST(obj)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
#else
  #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
#endif
#if CYTHON_ASSUME_SAFE_SIZE
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
#else
  #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
#define __Pyx_PyLong_AsHash_t   __Pyx_PyIndex_AsSsize_t
#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
    #define __Pyx_PySendResult PySendResult
#else
    typedef enum {
        PYGEN_RETURN = 0,
        PYGEN_ERROR = -1,
        PYGEN_NEXT = 1,
    } __Pyx_PySendResult;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
#else
  #define __Pyx_pyiter_sendfunc sendfunc
#endif
#if !CYTHON_USE_AM_SEND
#define __PYX_HAS_PY_AM_SEND 0
#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
#define __PYX_HAS_PY_AM_SEND 1
#else
#define __PYX_HAS_PY_AM_SEND 2  // our own backported implementation
#endif
#if __PYX_HAS_PY_AM_SEND < 2
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
        __Pyx_pyiter_sendfunc am_send;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
#endif
#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
#else
    #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
#endif
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
#else
#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
#ifdef __cplusplus
extern "C"
#endif
PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
    int value;
    PyObject *py_value = PyObject_GetAttrString(inspect, name);
    if (!py_value) return 0;
    value = (int) PyLong_AsLong(py_value);
    Py_DECREF(py_value);
    *write_to = value;
    return value != -1 || !PyErr_Occurred();
}
static int __Pyx_init_co_variables(void) {
    PyObject *inspect;
    int result;
    inspect = PyImport_ImportModule("inspect");
    result =
#if !defined(CO_OPTIMIZED)
        __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
#endif
#if !defined(CO_NEWLOCALS)
        __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
#endif
#if !defined(CO_VARARGS)
        __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
#endif
#if !defined(CO_VARKEYWORDS)
        __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
#endif
#if !defined(CO_ASYNC_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
#endif
#if !defined(CO_GENERATOR)
        __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
#endif
#if !defined(CO_COROUTINE)
        __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
#endif
        1;
    Py_DECREF(inspect);
    return result ? 0 : -1;
}
#else
static int __Pyx_init_co_variables(void) {
    return 0;  // It's a limited API-only feature
}
#endif

/* MathInitCode */
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
#endif
#ifndef CYTHON_CLINE_IN_TRACEBACK
#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
#endif
#if CYTHON_CLINE_IN_TRACEBACK
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
#else
#define __PYX_MARK_ERR_POS(f_index, lineno)  { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifdef CYTHON_EXTERN_C
    #undef __PYX_EXTERN_C
    #define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
    #ifdef _MSC_VER
    #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
    #else
    #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
    #endif
#else
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__H2MM_C
#define __PYX_HAVE_API__H2MM_C
/* Early includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE PyObject *
    __Pyx_CAPI_PyList_GetItemRef(PyObject *list, Py_ssize_t index)
    {
        PyObject *item = PyList_GetItem(list, index);
        Py_XINCREF(item);
        return item;
    }
    #else
    #define __Pyx_CAPI_PyList_GetItemRef PyList_GetItemRef
    #endif

    #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Extend(PyObject *list, PyObject *iterable)
    {
        return PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable);
    }

    static CYTHON_INLINE int
    __Pyx_CAPI_PyList_Clear(PyObject *list)
    {
        return PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL);
    }
    #else
    #define __Pyx_CAPI_PyList_Extend PyList_Extend
    #define __Pyx_CAPI_PyList_Clear PyList_Clear
    #endif
    

    #if PY_MAJOR_VERSION >= 3
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj)
    #else
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj, NULL)
    #endif
    
#include <stddef.h>

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif

    #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result)
    {
        int res;
        PyObject *key_obj = PyUnicode_FromString(key);
        if (key_obj == NULL) {
            *result = NULL;
            return -1;
        }
        res = __Pyx_PyDict_GetItemRef(mp, key_obj, result);
        Py_DECREF(key_obj);
        return res;
    }
    #else
    #define __Pyx_CAPI_PyDict_GetItemStringRef PyDict_GetItemStringRef
    #endif
    #if PY_VERSION_HEX < 0x030d0000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030F0000)
    static CYTHON_INLINE int
    __Pyx_CAPI_PyDict_SetDefaultRef(PyObject *d, PyObject *key, PyObject *default_value,
                        PyObject **result)
    {
        PyObject *value;
        if (__Pyx_PyDict_GetItemRef(d, key, &value) < 0) {
            // get error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (value != NULL) {
            // present
            if (result) {
                *result = value;
            }
            else {
                Py_DECREF(value);
            }
            return 1;
        }

        // missing: set the item
        if (PyDict_SetItem(d, key, default_value) < 0) {
            // set error
            if (result) {
                *result = NULL;
            }
            return -1;
        }
        if (result) {
            Py_INCREF(default_value);
            *result = default_value;
        }
        return 0;
    }
    #else
    #define __Pyx_CAPI_PyDict_SetDefaultRef PyDict_SetDefaultRef
    #endif
    

    #if PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int __Pyx_PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
    {
        PyObject *obj = PyWeakref_GetObject(ref);
        if (obj == NULL) {
            // SystemError if ref is NULL
            *pobj = NULL;
            return -1;
        }
        if (obj == Py_None) {
            *pobj = NULL;
            return 0;
        }
        Py_INCREF(obj);
        *pobj = obj;
        return 1;
    }
    #else
    #define __Pyx_PyWeakref_GetRef PyWeakref_GetRef
    #endif
    
#include "pythread.h"

    #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600) && !defined(PyContextVar_Get)
    #define PyContextVar_Get(var, d, v)         ((d) ?             ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) :             ((v)[0] = NULL, 0)         )
    #endif
    

    #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    #ifdef _MSC_VER
    #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy or the limited API.")
    #else
    #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy or the limited API.
    #endif
    #endif
    

    /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
    
#include "numpy/arrayobject.h"
#include "numpy/ndarrayobject.h"
#include "numpy/ndarraytypes.h"
#include "numpy/arrayscalars.h"
#include "numpy/ufuncobject.h"
#include "math.h"
#include "C_H2MM.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

#ifdef CYTHON_FREETHREADING_COMPATIBLE
#if CYTHON_FREETHREADING_COMPATIBLE
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#else
#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
#endif
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#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 Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#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 CYTHON_ASSUME_SAFE_MACROS
    #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_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
#else
    #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AsString(s))
    #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AsString(s))
    #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
#endif
#define __Pyx_PyObject_AsWritableString(s)    ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*)(__pyx_uintptr_t) __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_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o)       PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
    return Py_NewRef(obj);
#else
    Py_INCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
    return Py_XNewRef(obj);
#else
    Py_XINCREF(obj);
    return obj;
#endif
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
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_Long(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_PyLong_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
#else
#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
#endif
#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_VERSION_HEX >= 0x030C00A7
  #ifndef _PyLong_SIGN_MASK
    #define _PyLong_SIGN_MASK 3
  #endif
  #ifndef _PyLong_NON_SIZE_BITS
    #define _PyLong_NON_SIZE_BITS 3
  #endif
  #define __Pyx_PyLong_Sign(x)  (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  #define __Pyx_PyLong_IsNeg(x)  ((__Pyx_PyLong_Sign(x) & 2) != 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (!__Pyx_PyLong_IsNeg(x))
  #define __Pyx_PyLong_IsZero(x)  (__Pyx_PyLong_Sign(x) & 1)
  #define __Pyx_PyLong_IsPos(x)  (__Pyx_PyLong_Sign(x) == 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  (__Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  #define __Pyx_PyLong_SignedDigitCount(x)\
        ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
    #define __Pyx_PyLong_IsCompact(x)     PyUnstable_Long_IsCompact((PyLongObject*) x)
    #define __Pyx_PyLong_CompactValue(x)  PyUnstable_Long_CompactValue((PyLongObject*) x)
  #else
    #define __Pyx_PyLong_IsCompact(x)     (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
    #define __Pyx_PyLong_CompactValue(x)  ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  #endif
  typedef Py_ssize_t  __Pyx_compact_pylong;
  typedef size_t  __Pyx_compact_upylong;
  #else
  #define __Pyx_PyLong_IsNeg(x)  (Py_SIZE(x) < 0)
  #define __Pyx_PyLong_IsNonNeg(x)  (Py_SIZE(x) >= 0)
  #define __Pyx_PyLong_IsZero(x)  (Py_SIZE(x) == 0)
  #define __Pyx_PyLong_IsPos(x)  (Py_SIZE(x) > 0)
  #define __Pyx_PyLong_CompactValueUnsigned(x)  ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  #define __Pyx_PyLong_DigitCount(x)  __Pyx_sst_abs(Py_SIZE(x))
  #define __Pyx_PyLong_SignedDigitCount(x)  Py_SIZE(x)
  #define __Pyx_PyLong_IsCompact(x)  (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  #define __Pyx_PyLong_CompactValue(x)\
        ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  typedef sdigit  __Pyx_compact_pylong;
  typedef digit  __Pyx_compact_upylong;
  #endif
  #if PY_VERSION_HEX >= 0x030C00A5
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->long_value.ob_digit)
  #else
  #define __Pyx_PyLong_Digits(x)  (((PyLongObject*)x)->ob_digit)
  #endif
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
#else
  #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#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__ */
/* PretendToInitialize */
#ifdef __cplusplus
#if __cplusplus > 201103L
#include <type_traits>
#endif
template <typename T>
static void __Pyx_pretend_to_initialize(T* ptr) {
#if __cplusplus > 201103L
    if ((std::is_trivially_default_constructible<T>::value))
#endif
        *ptr = T();
    (void)ptr;
}
#else
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
#endif


#if !CYTHON_USE_MODULE_STATE
static PyObject *__pyx_m = NULL;
#endif
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * const __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) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
    #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

/* #### Code section: filename_table ### */

static const char* const __pyx_f[] = {
  "H2MM_C/H2MM_C.pyx",
  "<stringsource>",
  "cpython/contextvars.pxd",
  "array.pxd",
  "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd",
  "cpython/type.pxd",
  "cpython/bool.pxd",
  "cpython/complex.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Atomics.proto (used by UnpackUnboundCMethod) */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __pyx_atomic_int_type int
#define __pyx_nonatomic_int_type int
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__))
    #include <stdatomic.h>
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)))
    #include <atomic>
#endif
#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
                        (__STDC_VERSION__ >= 201112L) &&\
                        !defined(__STDC_NO_ATOMICS__) &&\
                       ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type atomic_int
    #define __pyx_atomic_ptr_type atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) atomic_load(value)
    #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C atomics"
    #endif
#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
                    (__cplusplus >= 201103L) ||\
\
                    (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
                    ATOMIC_INT_LOCK_FREE == 2)
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type std::atomic_int
    #define __pyx_atomic_ptr_type std::atomic_uintptr_t
    #define __pyx_nonatomic_ptr_type uintptr_t
    #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
    #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
    #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
    #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #define __pyx_atomic_load(value) std::atomic_load(value)
    #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
    #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
    #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
    #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
    #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
        #pragma message ("Using standard C++ atomics")
    #elif defined(__PYX_DEBUG_ATOMICS)
        #warning "Using standard C++ atomics"
    #endif
#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_ptr_type void*
    #define __pyx_nonatomic_ptr_type void*
    #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
    #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER)
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #define __pyx_atomic_ptr_type void*
    #undef __pyx_nonatomic_int_type
    #define __pyx_nonatomic_int_type long
    #define __pyx_nonatomic_ptr_type void*
    #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
    #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
    #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
    static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
        __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
    #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
    #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
    #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
    #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
    static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
        __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
        int result = old == *expected;
        *expected = old;
        return result;
    }
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif

/* CriticalSectionsDefinition.proto (used by CriticalSections) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_End(cs)
#define __Pyx_PyCriticalSection2_End(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_End PyCriticalSection_End
#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
#endif

/* CriticalSections.proto (used by ParseKeywordsImpl) */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
#else
#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
#endif
#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_BEGIN_CRITICAL_SECTION(o) {
#define __Pyx_END_CRITICAL_SECTION() }
#else
#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
#endif

/* 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()

/* BufferFormatStructs.proto (used by BufferFormatCheck) */
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  const 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_ {
  const __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  const __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;

/* IncludeStructmemberH.proto (used by FixUpExtensionType) */
#include <structmember.h>

/* 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])
#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
#define __Pyx_MEMSLICE_INIT  { 0, 0, { 0 }, { 0 }, { 0 } }
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview))
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview))
#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

/* #### Code section: numeric_typedefs ### */

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":743
 * # 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;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":744
 * 
 * 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;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":745
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * 
*/
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":746
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_uint8      uint8_t
*/
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":748
 * ctypedef npy_int64      int64_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
*/
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":749
 * 
 * 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;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":750
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * 
*/
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":751
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_float32    float32_t
*/
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":753
 * ctypedef npy_uint64     uint64_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
*/
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":754
 * 
 * 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;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":761
 * ctypedef double complex complex128_t
 * 
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
*/
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":762
 * 
 * ctypedef npy_longlong   longlong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
*/
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":764
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
*/
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":765
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
*/
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":767
 * 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;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":768
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
*/
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":769
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef float complex       cfloat_t
*/
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* #### Code section: complex_type_declarations ### */
/* Declarations.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #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 && (1) && (!0 || __cplusplus)
  #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);

/* Declarations.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #ifdef __cplusplus
    typedef ::std::complex< long double > __pyx_t_long_double_complex;
  #else
    typedef long double _Complex __pyx_t_long_double_complex;
  #endif
#else
    typedef struct { long double real, imag; } __pyx_t_long_double_complex;
#endif
static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double);

/* #### Code section: type_declarations ### */

/*--- Type declarations ---*/
#ifndef _ARRAYARRAY_H
struct arrayobject;
typedef struct arrayobject arrayobject;
#endif
struct __pyx_obj_6H2MM_C_opt_lim_const;
struct __pyx_obj_6H2MM_C_ConvCodes;
struct __pyx_obj_6H2MM_C_h2mm_model;
struct __pyx_obj_6H2MM_C__h2mm_lims;
struct __pyx_defaults;
struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik;
struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;
struct __pyx_opt_args_7cpython_11contextvars_get_value;
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;

/* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value {
  int __pyx_n;
  PyObject *default_value;
};

/* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
  int __pyx_n;
  PyObject *default_value;
};
struct __pyx_t_6H2MM_C_BoundStruct;
typedef struct __pyx_t_6H2MM_C_BoundStruct __pyx_t_6H2MM_C_BoundStruct;
struct __pyx_t_6H2MM_C_PrintStruct;
typedef struct __pyx_t_6H2MM_C_PrintStruct __pyx_t_6H2MM_C_PrintStruct;

/* "H2MM_C.pyx":100
 * 
 * 
 * ctypedef struct BoundStruct:             # <<<<<<<<<<<<<<
 *     PyObject *func
 *     PyObject *args
*/
struct __pyx_t_6H2MM_C_BoundStruct {
  PyObject *func;
  PyObject *args;
  PyObject *kwargs;
  PyObject *error;
};

/* "H2MM_C.pyx":107
 * 
 * 
 * ctypedef struct PrintStruct:             # <<<<<<<<<<<<<<
 *     bint keep
 *     int64_t disp_freq
*/
struct __pyx_t_6H2MM_C_PrintStruct {
  int keep;
  int64_t disp_freq;
  int64_t max_iter;
  double max_time;
  PyObject *formatter;
  PyObject *func;
  PyObject *args;
  PyObject *kwargs;
  PyObject *error;
};

/* "H2MM_C.pyx":418
 * ############################### Utility Classes ###############################
 * ###############################################################################
 * cdef class opt_lim_const:             # <<<<<<<<<<<<<<
 *     """
 *     Special class for setting default optimization min/max values.
*/
struct __pyx_obj_6H2MM_C_opt_lim_const {
  PyObject_HEAD
  int64_t _max_iter;
  double _max_time;
  double _converged_min;
  int64_t _num_cores;
  PyObject *_formatter;
  PyObject *_outstream;
};


/* "H2MM_C.pyx":687
 *                                     formatter=StdPrinter, outstream=get_stdout)
 * 
 * cdef class ConvCodes:             # <<<<<<<<<<<<<<
 *     """Bitmask for conv_code flags"""
 *     @property
*/
struct __pyx_obj_6H2MM_C_ConvCodes {
  PyObject_HEAD
};


/* "H2MM_C.pyx":852
 * 
 * 
 * cdef class h2mm_model:             # <<<<<<<<<<<<<<
 *     """
 *     The base class for storing objects representing the H2MM model, stores
*/
struct __pyx_obj_6H2MM_C_h2mm_model {
  PyObject_HEAD
  struct __pyx_vtabstruct_6H2MM_C_h2mm_model *__pyx_vtab;
  h2mm_mod *model;
};


/* "H2MM_C.pyx":1679
 * 
 * 
 * cdef class _h2mm_lims:             # <<<<<<<<<<<<<<
 *     # hidden type for making a C-level h2mm_limits object
 *     cdef:
*/
struct __pyx_obj_6H2MM_C__h2mm_lims {
  PyObject_HEAD
  h2mm_minmax limits;
};


/* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
struct __pyx_defaults {
  PyObject_HEAD
  PyObject *arg0;
};


/* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ {
  PyObject_HEAD
  PyObject *__pyx_v_ncols;
};


/* "H2MM_C.pyx":285
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_y;
};


/* "H2MM_C.pyx":287
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_y;
};

struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_xx;
  PyObject *__pyx_v_yy;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "H2MM_C.pyx":1287
 *         return self.copy()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self;
};


/* "H2MM_C.pyx":1290
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))             # <<<<<<<<<<<<<<
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *__pyx_outer_scope;
  int64_t __pyx_genexpr_arg_0;
  int64_t __pyx_v_i;
  int64_t __pyx_t_0;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
};


/* "H2MM_C.pyx":1291
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))             # <<<<<<<<<<<<<<
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
 *         return hash(p+t+o)
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *__pyx_outer_scope;
  int64_t __pyx_genexpr_arg_0;
  int64_t __pyx_v_i;
  int64_t __pyx_t_0;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
};


/* "H2MM_C.pyx":1292
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))             # <<<<<<<<<<<<<<
 *         return hash(p+t+o)
 * 
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *__pyx_outer_scope;
  int64_t __pyx_genexpr_arg_0;
  int64_t __pyx_v_i;
  int64_t __pyx_t_0;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
};


/* "H2MM_C.pyx":3093
 *     else:
 *         shape = (len(models), )
 *     if any(not isinstance(model, h2mm_model) for model in models):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
 *     cdef int64_t nmodel = len(models)
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_model;
};


/* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik {
  PyObject_HEAD
  int64_t *__pyx_v_burst_sizes;
};


/* "H2MM_C.pyx":3702
 *         raise err
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))             # <<<<<<<<<<<<<<
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
*/
struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *__pyx_outer_scope;
  int64_t __pyx_genexpr_arg_0;
  int64_t __pyx_v_i;
  int64_t __pyx_t_0;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
};


/* "View.MemoryView":110
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/
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":299
 * 
 * 
 * @cname('__pyx_MemviewEnum')             # <<<<<<<<<<<<<<
 * cdef class Enum(object):
 *     cdef object name
*/
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":334
 * 
 * 
 * @cname('__pyx_memoryview')             # <<<<<<<<<<<<<<
 * cdef class memoryview:
 * 
*/
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  void *_unused;
  PyThread_type_lock lock;
  __pyx_atomic_int_type acquisition_count;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo const *typeinfo;
};


/* "View.MemoryView":951
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/
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 *);
};



/* "H2MM_C.pyx":852
 * 
 * 
 * cdef class h2mm_model:             # <<<<<<<<<<<<<<
 *     """
 *     The base class for storing objects representing the H2MM model, stores
*/

struct __pyx_vtabstruct_6H2MM_C_h2mm_model {
  struct __pyx_obj_6H2MM_C_h2mm_model *(*from_ptr)(h2mm_mod *);
  struct __pyx_obj_6H2MM_C_h2mm_model *(*move_ptr)(h2mm_mod *);
};
static struct __pyx_vtabstruct_6H2MM_C_h2mm_model *__pyx_vtabptr_6H2MM_C_h2mm_model;


/* "View.MemoryView":110
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname("__pyx_array")
 * cdef class array:
*/

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


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

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 *);
  PyObject *(*_get_base)(struct __pyx_memoryview_obj *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":951
 * 
 * 
 * @cython.collection_type("sequence")             # <<<<<<<<<<<<<<
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):
*/

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
/* #### Code section: utility_code_proto ### */

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, Py_ssize_t);
    void (*DECREF)(void*, PyObject*, Py_ssize_t);
    void (*GOTREF)(void*, PyObject*, Py_ssize_t);
    void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
    void* (*SetupContext)(const char*, Py_ssize_t, 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;
  #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__));\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #define __Pyx_RefNannyFinishContextNogil() {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __Pyx_RefNannyFinishContext();\
              PyGILState_Release(__pyx_gilstate_save);\
          }
  #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); else {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContextNogil()
  #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_Py_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; Py_XDECREF(tmp);\
    } while (0)
#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)

/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
#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

/* PyThreadStateGet.proto (used by PyErrFetchRestore) */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#if PY_VERSION_HEX >= 0x030C00A6
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->current_exception != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
#else
#define __Pyx_PyErr_Occurred()  (__pyx_tstate->curexc_type != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  (__pyx_tstate->curexc_type)
#endif
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  (PyErr_Occurred() != NULL)
#define __Pyx_PyErr_CurrentExceptionType()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
#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 && PY_VERSION_HEX < 0x030C00A6
#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

/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
#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

/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

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

/* TupleAndListFromArray.proto (used by fastcall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#endif
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
#endif

/* IncludeStringH.proto (used by BytesEquals) */
#include <string.h>

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

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

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
#elif CYTHON_ASSUME_SAFE_MACROS
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
#else
    #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
#endif
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
#define __Pyx_KwValues_VARARGS(args, nargs) NULL
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
#if CYTHON_METH_FASTCALL
    #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
    #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
    #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
    static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
    CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  #else
    #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  #endif
#else
    #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
    #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
    #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
    #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
    #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
#endif
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
#else
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
#endif

/* PyDictVersioning.proto (used by GetModuleGlobalName) */
#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_XNewRef(__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)  do {\
    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_mstate_global->__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);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
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

/* py_dict_items.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* CallCFunction.proto (used by CallUnboundCMethod0) */
#define __Pyx_CallCFunction(cfunc, self, args)\
    ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
    ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
    ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
    ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)

/* PyObjectCall.proto (used by PyObjectFastCall) */
#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

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

/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
#define __Pyx_PyObject_FastCall(func, args, nargs)  __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);

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

/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
typedef struct {
    PyObject *type;
    PyObject **method_name;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
    __pyx_atomic_int_type initialized;
#endif
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
#if !CYTHON_ATOMICS
    return 1;
#else
    __pyx_nonatomic_int_type expected = 0;
    if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
        return 0;
    }
    return expected;
#endif
}
static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
#if CYTHON_ATOMICS
    __pyx_atomic_store(&cfunc->initialized, 2);
#endif
}
#else
#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
#endif

/* CallUnboundCMethod0.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* OwnedDictNext.proto (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
#else
CYTHON_INLINE
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
#endif

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

/* ParseKeywordsImpl.export */
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name
);
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

/* CallUnboundCMethod2.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* ParseKeywords.proto */
static CYTHON_INLINE int __Pyx_ParseKeywords(
    PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
    PyObject *kwds2, PyObject *values[],
    Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs
);

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

/* ArgTypeTestFunc.export */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))

/* PyValueError_Check.proto */
#define __Pyx_PyExc_ValueError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ValueError)

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

/* PyObjectFastCallMethod.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
#else
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
#endif

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);

/* PyMemoryError_Check.proto */
#define __Pyx_PyExc_MemoryError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_MemoryError)

/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value);
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char);

/* GCCDiagnostics.proto (used by CIntToPyUnicode) */
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* IncludeStdlibH.proto (used by CIntToPyUnicode) */
#include <stdlib.h>

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* JoinPyUnicode.export */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

CYTHON_UNUSED static 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*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
    (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, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (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, int unsafe_shared);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
    (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, int unsafe_shared);
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, int unsafe_shared);

/* 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

/* RejectKeywords.export */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

/* PyTypeError_Check.proto */
#define __Pyx_PyExc_TypeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_TypeError)

/* DivInt[Py_ssize_t].proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant);

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

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

/* AssertionsEnabled.proto */
#if CYTHON_COMPILING_IN_LIMITED_API  ||  PY_VERSION_HEX >= 0x030C0000
  static int __pyx_assertions_enabled_flag;
  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  #if __clang__ || __GNUC__
  __attribute__((no_sanitize("thread")))
  #endif
  static int __Pyx_init_assertions_enabled(void) {
    PyObject *builtins, *debug, *debug_str;
    int flag;
    builtins = PyEval_GetBuiltins();
    if (!builtins) goto bad;
    debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
    if (!debug_str) goto bad;
    debug = PyObject_GetItem(builtins, debug_str);
    Py_DECREF(debug_str);
    if (!debug) goto bad;
    flag = PyObject_IsTrue(debug);
    Py_DECREF(debug);
    if (flag == -1) goto bad;
    __pyx_assertions_enabled_flag = flag;
    return 0;
  bad:
    __pyx_assertions_enabled_flag = 1;
    return -1;
  }
#else
  #define __Pyx_init_assertions_enabled()  (0)
  #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)
#endif

/* PyAssertionError_Check.proto */
#define __Pyx_PyExc_AssertionError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AssertionError)

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

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

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

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

/* GetTopmostException.proto (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
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

/* 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

/* HasAttr.proto (used by ImportImpl) */
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_HasAttr(o, n)  PyObject_HasAttrWithError(o, n)
#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
#endif

/* ImportImpl.export */
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);

/* Import.proto */
static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, 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_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
    return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
}
#endif
#define __Pyx_PyErr_ExceptionMatches2(err1, err2)  __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#ifdef PyExceptionInstance_Check
  #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
#else
  #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
#endif

CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* 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);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
#if !CYTHON_USE_TYPE_SLOTS
#define  __Pyx_PySequence_Multiply PySequence_Repeat
#else
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
#endif

/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);

/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
    (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, int unsafe_shared);

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

/* PyIndexError_Check.proto */
#define __Pyx_PyExc_IndexError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_IndexError)

/* DivInt[long].proto */
static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant);

/* 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);
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
        L->ob_item[len] = x;
        #else
        PyList_SET_ITEM(list, len, x);
        #endif
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
#endif

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

/* StringJoin.proto */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_size_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_size_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_size_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char);

/* PyImportError_Check.proto */
#define __Pyx_PyExc_ImportError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_ImportError)

/* PyNotImplementedError_Check.proto */
#define __Pyx_PyExc_NotImplementedError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_NotImplementedError)

/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL)
#else
#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n)
#endif

/* 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)   __Pyx_PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyObject_Unicode.proto */
#define __Pyx_PyObject_Unicode(obj)\
    (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))

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

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

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

/* pep479.proto */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);

/* PyRange_Check.proto */
#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  #define PyRange_Check(obj)  __Pyx_TypeCheck((obj), &PyRange_Type)
#endif

/* PyObjectVectorCallKwBuilder.proto */
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#if CYTHON_VECTORCALL
#if PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
#endif
#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
#else
#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
#endif

/* PyLongBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2))
#endif

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

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

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

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

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_int64_t(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_int64_t(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_int64_t(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int64_t(int64_t value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int64_t(int64_t value, Py_ssize_t width, char padding_char, char format_char);

/* 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));
}

/* UnicodeConcatInPlace.proto */
# if CYTHON_COMPILING_IN_CPYTHON
    #if CYTHON_REFNANNY
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared, __pyx_refnanny)
    #else
        #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared)
    #endif
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_OwnStrongReference)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique)
    #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_SharedReference)
    static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    );
#else
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace __Pyx_PyUnicode_Concat
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace __Pyx_PyUnicode_Concat
#endif
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right))
#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlaceSafe(left, right)\
    ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\
    PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right))

/* CallUnboundCMethod1.proto */
CYTHON_UNUSED
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw);

/* PyLongCompare.proto */
static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

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

/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);

/* PyNumber_Hex.proto */
#define __Pyx_PyNumber_Hex(obj) PyNumber_ToBase((obj), 16)

/* PyAttributeError_Check.proto */
#define __Pyx_PyExc_AttributeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_AttributeError)

/* PyObjectVectorCallMethodKwBuilder.proto */
#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod
#else
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#endif

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

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

/* BufferFormatCheck.proto (used by BufferGetAndValidate) */
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,
                              const __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,
  const __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 };

/* BufferIndexError.proto */
static void __Pyx_RaiseBufferIndexError(int axis);

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);

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

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

/* UnpackTuple2.proto (used by dict_iter) */
static CYTHON_INLINE int __Pyx_unpack_tuple2(
    PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int 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);

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

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

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

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

/* ModInt[Py_ssize_t].proto */
static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant);

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

/* ModInt[int64_t].proto */
static CYTHON_INLINE int64_t __Pyx_mod_int64_t(int64_t, int64_t, int b_is_constant);

/* CIntToPyUnicode.proto */
#define __Pyx_PyUnicode_From_npy_intp(value, width, padding_char, format_char) (\
    ((format_char) == ('c')) ?\
        __Pyx_uchar___Pyx_PyUnicode_From_npy_intp(value, width, padding_char) :\
        __Pyx____Pyx_PyUnicode_From_npy_intp(value, width, padding_char, format_char)\
    )
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_npy_intp(npy_intp value, Py_ssize_t width, char padding_char);
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_npy_intp(npy_intp value, Py_ssize_t width, char padding_char, char format_char);

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyCallable_Check(obj)   (Py_TYPE(obj)->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

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

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

/* PyRuntimeError_Check.proto */
#define __Pyx_PyExc_RuntimeError_Check(obj)  __Pyx_TypeCheck(obj, PyExc_RuntimeError)

/* AllocateExtensionType.proto */
static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);

/* CallTypeTraverse.proto */
#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
#else
static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
#endif

/* CheckTypeForFreelists.proto */
#if CYTHON_USE_FREELISTS
#if CYTHON_USE_TYPE_SPECS
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  Py_TPFLAGS_IS_ABSTRACT
#else
#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS  (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
#endif
#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
    (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
     (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
#endif

/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
#if CYTHON_COMPILING_IN_LIMITED_API
static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
#endif

/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)

/* FixUpExtensionType.proto */
static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);

/* ValidateBasesTuple.proto (used by PyType_Ready) */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
#endif

/* PyType_Ready.proto */
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);

/* DelItemOnTypeDict.proto (used by SetupReduce) */
static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k);
#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k)

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

/* SetVTable.proto */
static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);

/* GetVTable.proto (used by MergeVTables) */
static void* __Pyx_GetVtable(PyTypeObject *type);

/* MergeVTables.proto */
static int __Pyx_MergeVtables(PyTypeObject *type);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_3
#define __PYX_HAVE_RT_ImportType_proto_3_2_3
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_3(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_2_3(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_2_3 {
   __Pyx_ImportType_CheckSize_Error_3_2_3 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_2_3 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_2_3 = 2
};
static PyTypeObject *__Pyx_ImportType_3_2_3(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_3 check_size);
#endif

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

/* Py3UpdateBases.proto */
static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* dict_setdefault.proto (used by FetchCommonType) */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);

/* AddModuleRef.proto (used by FetchSharedCythonModule) */
#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
     __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
#else
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#endif

/* FetchSharedCythonModule.proto (used by FetchCommonType) */
static PyObject *__Pyx_FetchSharedCythonABIModule(void);

/* FetchCommonType.proto (used by CommonTypesMetaclass) */
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);

/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
static int __pyx_CommonTypesMetaclass_init(PyObject *module);
#define __Pyx_CommonTypesMetaclass_USED

/* PyMethodNew.proto (used by CythonFunctionShared) */
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);

/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
#endif

/* CythonFunctionShared.proto (used by CythonFunction) */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (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 {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_dict;
#endif
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    PyObject *defaults;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
    PyObject *func_is_coroutine;
} __pyx_CyFunctionObject;
#undef __Pyx_CyOrPyCFunction_Check
#define __Pyx_CyFunction_Check(obj)  __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
#define __Pyx_CyOrPyCFunction_Check(obj)  __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
#define __Pyx_CyFunction_CheckExact(obj)  __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
#undef __Pyx_IsSameCFunction
#define __Pyx_IsSameCFunction(func, cfunc)   __Pyx__IsSameCyOrCFunction(func, cfunc)
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
                                                         PyTypeObject *defaults_type);
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(PyObject *module);
#if CYTHON_METH_FASTCALL
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
#if CYTHON_COMPILING_IN_LIMITED_API
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
#else
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
#endif
#endif

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* PyObjectLookupSpecial.proto (used by Py3ClassCreate) */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
#define __Pyx_PyObject_LookupSpecial(obj, attr_name)  __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
#else
#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* ClassMethod.proto */
#if !CYTHON_COMPILING_IN_LIMITED_API
#include "descrobject.h"
#endif
CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

/* CLineInTraceback.proto (used by AddTraceback) */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#else
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#endif

/* CodeObjectCache.proto (used by AddTraceback) */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject __Pyx_CachedCodeObjectType;
#else
typedef PyCodeObject __Pyx_CachedCodeObjectType;
#endif
typedef struct {
    __Pyx_CachedCodeObjectType* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    __pyx_atomic_int_type accessor_count;
  #endif
};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);

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

/* ArrayAPI.proto */
#ifndef _ARRAYARRAY_H
#define _ARRAYARRAY_H
typedef struct arraydescr {
    int typecode;
    int itemsize;
    PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
    int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
    char *formats;
} arraydescr;
typedef union {
    char *ob_item;
    float *as_floats;
    double *as_doubles;
    int *as_ints;
    unsigned int *as_uints;
    unsigned char *as_uchars;
    signed char *as_schars;
    char *as_chars;
    unsigned long *as_ulongs;
    long *as_longs;
    unsigned long long *as_ulonglongs;
    long long *as_longlongs;
    short *as_shorts;
    unsigned short *as_ushorts;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_DEPRECATED(3.13)
    #endif
        wchar_t *as_pyunicodes;
    void *as_voidptr;
} __Pyx_data_union;
struct arrayobject {
    PyObject_HEAD
    Py_ssize_t ob_size;
    __Pyx_data_union data;
    Py_ssize_t allocated;
    struct arraydescr *ob_descr;
    PyObject *weakreflist;
    int ob_exports;
};
#ifndef NO_NEWARRAY_INLINE
static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr) {
    arrayobject *op;
    size_t nbytes;
    if (size < 0) {
        PyErr_BadInternalCall();
        return NULL;
    }
    nbytes = size * descr->itemsize;
    if (nbytes / descr->itemsize != (size_t)size) {
        return PyErr_NoMemory();
    }
    op = (arrayobject *) type->tp_alloc(type, 0);
    if (op == NULL) {
        return NULL;
    }
    op->ob_descr = descr;
    op->allocated = size;
    op->weakreflist = NULL;
    __Pyx_SET_SIZE(op, size);
    if (size <= 0) {
        op->data.ob_item = NULL;
    }
    else {
        op->data.ob_item = PyMem_NEW(char, nbytes);
        if (op->data.ob_item == NULL) {
            Py_DECREF(op);
            return PyErr_NoMemory();
        }
    }
    return (PyObject *) op;
}
#else
PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr);
#endif
static CYTHON_INLINE __Pyx_data_union __Pyx_PyArray_Data(arrayobject *self) {
#if CYTHON_COMPILING_IN_GRAAL
    __Pyx_data_union data;
    data.ob_item = GraalPyArray_Data((PyObject*)self);
    return data;
#else
    return self->data;
#endif
}
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
#if CYTHON_COMPILING_IN_GRAAL
    return GraalPyArray_Resize((PyObject*)self, n);
#else
    void *items = (void*) self->data.ob_item;
    PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = n;
    return 0;
#endif
}
static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
#if CYTHON_COMPILING_IN_GRAAL
    return GraalPyArray_Resize((PyObject*)self, n);
#else
    void *items = (void*) self->data.ob_item;
    Py_ssize_t newsize;
    if (n < self->allocated && n*4 > self->allocated) {
        __Pyx_SET_SIZE(self, n);
        return 0;
    }
    newsize = n + (n / 2) + 1;
    if (newsize <= n) {
        PyErr_NoMemory();
        return -1;
    }
    PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = newsize;
    return 0;
#endif
}
#endif

/* CheckUnpickleChecksum.proto */
static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members);

/* 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;

/* IntPow.proto */
static CYTHON_INLINE int64_t __Pyx_pow_int64_t(int64_t, int64_t);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_double(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 && (1) && (!0 || __cplusplus)
    #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 && (1) && (!0 || __cplusplus)
    #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

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #define __Pyx_c_eq_long__double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_long__double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_long__double(a, b) ((a)-(b))
    #define __Pyx_c_prod_long__double(a, b) ((a)*(b))
    #define __Pyx_c_quot_long__double(a, b) ((a)/(b))
    #define __Pyx_c_neg_long__double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0)
    #define __Pyx_c_conj_long__double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_long__double(z)     (::std::abs(z))
        #define __Pyx_c_pow_long__double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_long__double(z) ((z)==0)
    #define __Pyx_c_conj_long__double(z)    (conjl(z))
    #if 1
        #define __Pyx_c_abs_long__double(z)     (cabsl(z))
        #define __Pyx_c_pow_long__double(a, b)  (cpowl(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex);
    static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex);
    #if 1
        static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex);
        static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex);
    #endif
#endif

/* MemviewRefcount.proto */
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count)
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int);

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

/* MemviewSliceInit.proto */
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyLong_As_int64_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int64_t(int64_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_npy_intp(npy_intp value);

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

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

/* TypeInfoToFormat.proto */
struct __pyx_typeinfo_string {
    char string[3];
};
static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(const __Pyx_TypeInfo *type);

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

/* UpdateUnpickledDict.proto */
static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index);

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

/* FormatTypeName.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
typedef PyObject *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%U"
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
#else
static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
#endif
#else  // !LIMITED_API
typedef const char *__Pyx_TypeName;
#define __Pyx_FMT_TYPENAME "%.200s"
#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
#define __Pyx_DECREF_TypeName(obj)
#endif

/* GetRuntimeVersion.proto */
#if __PYX_LIMITED_VERSION_HEX < 0x030b0000
static unsigned long __Pyx_cached_runtime_version = 0;
static void __Pyx_init_runtime_version(void);
#else
#define __Pyx_init_runtime_version()
#endif
static unsigned long __Pyx_get_runtime_version(void);

/* IterNextPlain.proto (used by CoroutineBase) */
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
#endif

/* ReturnWithStopIteration.proto (used by CoroutineBase) */
static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);

/* CoroutineBase.proto (used by Generator) */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *gi_weakreflist;
#endif
    PyObject *classobj;
    PyObject *yieldfrom;
    __Pyx_pyiter_sendfunc yieldfrom_am_send;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
    PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
    uint64_t __pyx_pymonitoring_version;
#endif
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
#if __PYX_HAS_PY_AM_SEND == 2
static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
#endif
static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);

/* Generator.proto */
#define __Pyx_Generator_USED
#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(PyObject *module);
static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);

/* DecompressString.proto */
static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);

/* MultiPhaseInitModuleState.proto */
#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
static PyObject *__Pyx_State_FindModule(void*);
static int __Pyx_State_AddModule(PyObject* module, void*);
static int __Pyx_State_RemoveModule(void*);
#elif CYTHON_USE_MODULE_STATE
#define __Pyx_State_FindModule PyState_FindModule
#define __Pyx_State_AddModule PyState_AddModule
#define __Pyx_State_RemoveModule PyState_RemoveModule
#endif

/* #### Code section: module_declarations ### */
/* CythonABIVersion.proto */
#if CYTHON_COMPILING_IN_LIMITED_API
    #if CYTHON_METH_FASTCALL
        #define __PYX_FASTCALL_ABI_SUFFIX  "_fastcall"
    #else
        #define __PYX_FASTCALL_ABI_SUFFIX
    #endif
    #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#else
    #define __PYX_LIMITED_ABI_SUFFIX
#endif
#if __PYX_HAS_PY_AM_SEND == 1
    #define __PYX_AM_SEND_ABI_SUFFIX
#elif __PYX_HAS_PY_AM_SEND == 2
    #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
#else
    #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
#endif
#ifndef __PYX_MONITORING_ABI_SUFFIX
    #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_USE_TP_FINALIZE
    #define __PYX_TP_FINALIZE_ABI_SUFFIX
#else
    #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
#endif
#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
    #define __PYX_FREELISTS_ABI_SUFFIX
#else
    #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
#endif
#define CYTHON_ABI  __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."

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_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* 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*/
static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
#endif
static CYTHON_INLINE __Pyx_data_union __pyx_f_7cpython_5array_5array_4data_data(arrayobject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/
static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/
static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_10h2mm_model_from_ptr(h2mm_mod *__pyx_v_model); /* proto*/
static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_10h2mm_model_move_ptr(h2mm_mod *__pyx_v_model); /* proto*/

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

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

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

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.type" */

/* Module declarations from "cpython.version" */

/* Module declarations from "cpython.exc" */

/* Module declarations from "cpython.module" */

/* Module declarations from "cpython.tuple" */

/* Module declarations from "cpython.list" */

/* Module declarations from "cpython.sequence" */

/* Module declarations from "cpython.mapping" */

/* Module declarations from "cpython.iterator" */

/* Module declarations from "cpython.number" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.bool" */

/* Module declarations from "cpython.long" */

/* Module declarations from "cpython.float" */

/* Module declarations from "cython.view" */
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/

/* Module declarations from "cython.dataclasses" */

/* Module declarations from "cython" */

/* Module declarations from "__builtin__" */

/* Module declarations from "cpython.complex" */

/* Module declarations from "libc.stddef" */

/* Module declarations from "cpython.unicode" */

/* Module declarations from "cpython.pyport" */

/* Module declarations from "cpython.dict" */

/* Module declarations from "cpython.instance" */

/* Module declarations from "cpython.function" */

/* Module declarations from "cpython.method" */

/* Module declarations from "cpython.weakref" */

/* Module declarations from "cpython.getargs" */

/* Module declarations from "cpython.pythread" */

/* Module declarations from "cpython.pystate" */

/* Module declarations from "cpython.set" */

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

/* Module declarations from "cpython.bytes" */

/* Module declarations from "cpython.pycapsule" */

/* Module declarations from "cpython.contextvars" */

/* Module declarations from "cpython" */

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

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

/* Module declarations from "libc.stdlib" */

/* Module declarations from "libc.stdint" */

/* Module declarations from "array" */

/* Module declarations from "cpython.array" */
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/

/* Module declarations from "numpy" */

/* Module declarations from "numpy" */
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/

/* Module declarations from "H2MM_C" */
static PyObject *__pyx_collections_abc_Sequence = 0;
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 int __pyx_f_6H2MM_C_Py_free_model_fields(h2mm_mod *); /*proto*/
static int __pyx_f_6H2MM_C_Py_free_models(int64_t const , h2mm_mod *); /*proto*/
static h2mm_mod *__pyx_f_6H2MM_C_Py_allocate_models(int64_t const , int64_t const , int64_t const , int64_t const ); /*proto*/
static PyObject *__pyx_f_6H2MM_C_get_conv_convtype(int64_t); /*proto*/
static PyObject *__pyx_f_6H2MM_C_get_conv_str(int64_t); /*proto*/
static PyObject *__pyx_f_6H2MM_C_get_conv_descr(int64_t); /*proto*/
static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_model_copy_from_ptr(h2mm_mod *); /*proto*/
static int __pyx_f_6H2MM_C_cy_limit(h2mm_mod *, h2mm_mod *, h2mm_mod *, double, lm *, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_call(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_all(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_diff(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_diff_time(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_comp(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_comp_time(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_model_print_iter(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *); /*proto*/
static int __pyx_f_6H2MM_C_free_deltas(int64_t, int32_t **); /*proto*/
static int __pyx_f_6H2MM_C_free_idx_diffs_arrays(int64_t, int64_t *, uint8_t **, int32_t **); /*proto*/
static PyObject *__pyx_f_6H2MM_C_reshape_burst_arrays(PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cast_burst_uint8(PyObject *, PyObject *, int64_t *, int64_t **, uint8_t ***); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cast_bursts_deltas(PyObject *, int64_t, int64_t *, int32_t ***); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cast_indexes_times(PyObject *, PyObject *, int *, int64_t *, int64_t **, uint8_t ***, int32_t ***); /*proto*/
static PyArrayObject *__pyx_f_6H2MM_C_make_gamma_arrays(int64_t, int64_t, int64_t *, double ***); /*proto*/
static PyArrayObject *__pyx_f_6H2MM_C_make_h2mm_out_arrays(int64_t, h2mm_mod *); /*proto*/
static PyObject *__pyx_f_6H2MM_C_make_h2mm_arr_modptr(PyObject *, int *, int64_t *, h2mm_mod **); /*proto*/
static PyArrayObject *__pyx_f_6H2MM_C_make_gamma_gamma_arrays(int64_t, h2mm_mod *, int64_t, int64_t *, double ****); /*proto*/
static int __pyx_f_6H2MM_C_free_gammagamma(int64_t, double ***); /*proto*/
static PyObject *__pyx_f_6H2MM_C_make_ph_path_arrays(int64_t, int64_t *, int64_t, ph_path **); /*proto*/
static int __pyx_f_6H2MM_C_free_idx_diffs_path_arrays(int64_t, int64_t *, uint8_t **, int32_t **, uint8_t **); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cast_indexes_times_paths(PyObject *, PyObject *, PyObject *, int *, int64_t *, int64_t **, uint8_t ***, int32_t ***, uint8_t ***); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cpath_ll_full(int64_t, int64_t *, int32_t **, uint8_t **, uint8_t **, h2mm_mod *, int64_t); /*proto*/
static PyObject *__pyx_f_6H2MM_C_cpath_ll(int64_t, int64_t *, int32_t **, uint8_t **, uint8_t **, h2mm_mod *, int64_t); /*proto*/
static PyObject *__pyx_f_6H2MM_C___pyx_unpickle_ConvCodes__set_state(struct __pyx_obj_6H2MM_C_ConvCodes *, PyObject *); /*proto*/
static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static int 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 *, PyObject *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/
static int __pyx_memoryview_err_no_memory(void); /*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 PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo const *); /*proto*/
/* #### Code section: typeinfo ### */
static const __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), { 0 }, 0, 'O', 0, 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_uint8_t = { "uint8_t", NULL, sizeof(uint8_t), { 0 }, 0, __PYX_IS_UNSIGNED(uint8_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(uint8_t), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_nn_int64_t = { "int64_t", NULL, sizeof(int64_t), { 0 }, 0, __PYX_IS_UNSIGNED(int64_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(int64_t), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 };
static const __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, __PYX_IS_UNSIGNED(long) ? 'U' : 'I', __PYX_IS_UNSIGNED(long), 0 };
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "H2MM_C"
extern int __pyx_module_is_main_H2MM_C;
int __pyx_module_is_main_H2MM_C = 0;

/* Implementation of "H2MM_C" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin___import__;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
/* #### Code section: string_decls ### */
static const char __pyx_k_c[] = "c";
static const char __pyx_k__7[] = "";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_Module_for_analyzing_data_with[] = "\nModule for analyzing data with photon by photon hidden Markov moddeling\n";
/* #### Code section: decls ### */
static PyObject *__pyx_lambda_funcdef_6H2MM_C_lambda3(CYTHON_UNUSED PyObject *__pyx_self); /* 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___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 int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7Printer_update(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7Printer_2close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7Printer_4__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7Printer_6__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7Printer_8__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10StdPrinter___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_keep, PyObject *__pyx_v_single_line); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10StdPrinter_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10StdPrinter_4close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_keep); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter_4close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___6genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_nrows, PyObject *__pyx_v_ncols, PyObject *__pyx_v_xlim, PyObject *__pyx_v_ylim, PyObject *__pyx_v_plot_kwargs, PyObject *__pyx_v_plot_type, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_4_get_xylim(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_6close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_plot_bic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time); /* proto */
static PyObject *__pyx_pf_6H2MM_C_2plot_obs(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */
static PyObject *__pyx_pf_6H2MM_C_4plot_bic_obs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const___cinit__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_formatter, PyObject *__pyx_v_outstream); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8max_iter___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_8max_iter_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8max_time___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_8max_time_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_time); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_13converged_min___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_13converged_min_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_converged_min); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9num_cores___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_9num_cores_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_num_cores); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9formatter___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_9formatter_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_formatter); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9outstream___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_9outstream_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_outstream); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_2__getitem__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_6H2MM_C_13opt_lim_const_4__setitem__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_6__repr__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8_get_max_iter(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_10_get_max_time(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_time); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_12_get_converged_min(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_converged_min); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_14_get_num_cores(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_num_cores); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_16_get_formatter(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_formatter); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_18_get_outstream(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_outstream); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6H2MM_C_6get_stdout(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_11ll_computed___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8from_opt___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_6output___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_9converged___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8max_iter___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8max_time___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_5error___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8post_opt___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_6frozen___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes___reduce_cython__(struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_2__setstate_cython__(struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model___cinit__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model_2__init__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_prior, PyObject *__pyx_v_trans, PyObject *__pyx_v_obs, PyObject *__pyx_v_loglik, PyObject *__pyx_v_niter, PyObject *__pyx_v_nphot, PyObject *__pyx_v_is_conv); /* proto */
static void __pyx_pf_6H2MM_C_10h2mm_model_4__dealloc__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6tobytes(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8frombytes(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_10__repr__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_12__str__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5prior___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model_5prior_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_prior); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5trans___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model_5trans_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_trans); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_3obs___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model_3obs_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_obs); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6loglik___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_1k___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_3bic___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6nstate___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_4ndet___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5nphot___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_7is_conv___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6is_opt___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_7is_calc___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_9conv_code___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8conv_str___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5niter___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static int __pyx_pf_6H2MM_C_10h2mm_model_5niter_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_niter); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_14set_converged(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_converged); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_16sort_states(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_18__eq__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_20normalize(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_22copy(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_24__copy__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___3genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___6genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0); /* proto */
static Py_hash_t __pyx_pf_6H2MM_C_10h2mm_model_26__hash__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_28optimize(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_bounds_func, PyObject *__pyx_v_bounds, PyObject *__pyx_v_bounds_kwargs, PyObject *__pyx_v_print_func, PyObject *__pyx_v_print_freq, PyObject *__pyx_v_print_args, PyObject *__pyx_v_print_kwargs, PyObject *__pyx_v_print_stream, PyObject *__pyx_v_print_formatter, PyObject *__pyx_v_print_fmt_args, PyObject *__pyx_v_print_fmt_kwargs, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_reset_niter, PyObject *__pyx_v_gamma, PyObject *__pyx_v_opt_array, PyObject *__pyx_v_inplace); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_30evaluate(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_gamma, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_inplace); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6H2MM_C_10_h2mm_lims___cinit__(struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyArrayObject *__pyx_v_min_prior, PyArrayObject *__pyx_v_max_prior, PyArrayObject *__pyx_v_min_trans, PyArrayObject *__pyx_v_max_trans, PyArrayObject *__pyx_v_min_obs, PyArrayObject *__pyx_v_max_obs); /* proto */
static void __pyx_pf_6H2MM_C_10_h2mm_lims_2__dealloc__(struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10_h2mm_lims_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10_h2mm_lims_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_min_prior, PyObject *__pyx_v_max_prior, PyObject *__pyx_v_min_trans, PyObject *__pyx_v_max_trans, PyObject *__pyx_v_min_obs, PyObject *__pyx_v_max_obs, PyObject *__pyx_v_nstate, PyObject *__pyx_v_ndet); /* proto */
static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits_2make_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_warning); /* proto */
static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits_4_make_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model); /* proto */
static PyObject *__pyx_pf_6H2MM_C_8factory_h2mm_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nstate, PyObject *__pyx_v_ndet, PyObject *__pyx_v_bounds, PyObject *__pyx_v_trans_scale, PyObject *__pyx_v_prior_dist, PyObject *__pyx_v_trans_dist, PyObject *__pyx_v_obs_dist); /* proto */
static PyObject *__pyx_pf_6H2MM_C_31__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6H2MM_C_10EM_H2MM_C(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_bounds_func, PyObject *__pyx_v_bounds, PyObject *__pyx_v_bounds_kwargs, PyObject *__pyx_v_print_func, PyObject *__pyx_v_print_freq, PyObject *__pyx_v_print_args, PyObject *__pyx_v_print_kwargs, PyObject *__pyx_v_print_stream, PyObject *__pyx_v_print_formatter, PyObject *__pyx_v_print_fmt_args, PyObject *__pyx_v_print_fmt_kwargs, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_reset_niter, PyObject *__pyx_v_gamma, PyObject *__pyx_v_opt_array); /* proto */
static PyObject *__pyx_pf_6H2MM_C_20make_h2mm_arr_modptr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_12H2MM_arr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_models, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_6H2MM_C_14viterbi_path(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_h_mod, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores); /* proto */
static PyObject *__pyx_pf_6H2MM_C_16viterbi_sort(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores); /* proto */
static PyObject *__pyx_pf_6H2MM_C_11path_loglik_genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_6H2MM_C_18path_loglik(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_state_path, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_BIC, PyObject *__pyx_v_total_loglik, PyObject *__pyx_v_loglikarray, PyObject *__pyx_v_loglikpath); /* proto */
static PyObject *__pyx_pf_6H2MM_C_20sim_statepath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, int __pyx_v_lenp, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6H2MM_C_22sim_sparsestatepath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_times, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6H2MM_C_24sim_phtraj_from_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_states, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6H2MM_C_26sim_phtraj_from_times(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_times, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6H2MM_C_29__pyx_unpickle_ConvCodes(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_6H2MM_C_opt_lim_const(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C_ConvCodes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C_h2mm_model(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C__h2mm_lims(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_defaults(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct____init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_4___hash__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_9_path_loglik(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_10_genexpr(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*/
/* #### Code section: late_includes ### */
/* #### Code section: module_state ### */
/* SmallCodeConfig */
#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

typedef struct {
  PyObject *__pyx_d;
  PyObject *__pyx_b;
  PyObject *__pyx_cython_runtime;
  PyObject *__pyx_empty_tuple;
  PyObject *__pyx_empty_bytes;
  PyObject *__pyx_empty_unicode;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  PyTypeObject *__pyx_ptype_7cpython_5array_array;
  PyTypeObject *__pyx_ptype_5numpy_dtype;
  PyTypeObject *__pyx_ptype_5numpy_flatiter;
  PyTypeObject *__pyx_ptype_5numpy_broadcast;
  PyTypeObject *__pyx_ptype_5numpy_ndarray;
  PyTypeObject *__pyx_ptype_5numpy_generic;
  PyTypeObject *__pyx_ptype_5numpy_number;
  PyTypeObject *__pyx_ptype_5numpy_integer;
  PyTypeObject *__pyx_ptype_5numpy_signedinteger;
  PyTypeObject *__pyx_ptype_5numpy_unsignedinteger;
  PyTypeObject *__pyx_ptype_5numpy_inexact;
  PyTypeObject *__pyx_ptype_5numpy_floating;
  PyTypeObject *__pyx_ptype_5numpy_complexfloating;
  PyTypeObject *__pyx_ptype_5numpy_flexible;
  PyTypeObject *__pyx_ptype_5numpy_character;
  PyTypeObject *__pyx_ptype_5numpy_ufunc;
  PyObject *__pyx_type_6H2MM_C_opt_lim_const;
  PyObject *__pyx_type_6H2MM_C_ConvCodes;
  PyObject *__pyx_type_6H2MM_C_h2mm_model;
  PyObject *__pyx_type_6H2MM_C__h2mm_lims;
  PyObject *__pyx_type_6H2MM_C___pyx_defaults;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct____init__;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_4___hash__;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik;
  PyObject *__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr;
  PyObject *__pyx_type___pyx_array;
  PyObject *__pyx_type___pyx_MemviewEnum;
  PyObject *__pyx_type___pyx_memoryview;
  PyObject *__pyx_type___pyx_memoryviewslice;
  PyTypeObject *__pyx_ptype_6H2MM_C_opt_lim_const;
  PyTypeObject *__pyx_ptype_6H2MM_C_ConvCodes;
  PyTypeObject *__pyx_ptype_6H2MM_C_h2mm_model;
  PyTypeObject *__pyx_ptype_6H2MM_C__h2mm_lims;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_defaults;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct____init__;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik;
  PyTypeObject *__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr;
  PyTypeObject *__pyx_array_type;
  PyTypeObject *__pyx_MemviewEnum_type;
  PyTypeObject *__pyx_memoryview_type;
  PyTypeObject *__pyx_memoryviewslice_type;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type__strip;
  PyObject *__pyx_k__15;
  PyObject *__pyx_k__16;
  PyObject *__pyx_k__17;
  PyObject *__pyx_k__18;
  PyObject *__pyx_k__19;
  PyObject *__pyx_k__21;
  PyObject *__pyx_slice[4];
  PyObject *__pyx_tuple[28];
  PyObject *__pyx_codeobj_tab[65];
  PyObject *__pyx_string_tab[807];
  PyObject *__pyx_number_tab[15];
/* #### Code section: module_state_contents ### */

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *__pyx_freelist_6H2MM_C___pyx_scope_struct____init__[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct____init__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_1_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_1_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_2_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_2_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_3_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_3_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *__pyx_freelist_6H2MM_C___pyx_scope_struct_4___hash__[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_4___hash__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_5_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_5_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_6_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_6_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_7_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_7_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_8_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_8_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *__pyx_freelist_6H2MM_C___pyx_scope_struct_9_path_loglik[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_9_path_loglik;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *__pyx_freelist_6H2MM_C___pyx_scope_struct_10_genexpr[8];
int __pyx_freecount_6H2MM_C___pyx_scope_struct_10_genexpr;
#endif
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CythonFunctionShared.module_state_decls */
PyTypeObject *__pyx_CyFunctionType;

/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

/* IterNextPlain.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
#endif

/* Generator.module_state_decls */
PyTypeObject *__pyx_GeneratorType;

/* #### Code section: module_state_end ### */
} __pyx_mstatetype;

#if CYTHON_USE_MODULE_STATE
#ifdef __cplusplus
namespace {
extern struct PyModuleDef __pyx_moduledef;
} /* anonymous namespace */
#else
static struct PyModuleDef __pyx_moduledef;
#endif

#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))

#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
#else
static __pyx_mstatetype __pyx_mstate_global_static =
#ifdef __cplusplus
    {};
#else
    {0};
#endif
static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
#endif
/* #### Code section: constant_name_defines ### */
#define __pyx_kp_u_ __pyx_string_tab[0]
#define __pyx_kp_u_12e __pyx_string_tab[1]
#define __pyx_kp_u_5d __pyx_string_tab[2]
#define __pyx_kp_u_6e __pyx_string_tab[3]
#define __pyx_kp_u_Abstract_base_class_for_formatt __pyx_string_tab[4]
#define __pyx_kp_u_All_dimensions_preceding_dimensi __pyx_string_tab[5]
#define __pyx_kp_u_An_error_occured_on_iteration __pyx_string_tab[6]
#define __pyx_kp_u_Bad_pointer_check_cython_code __pyx_string_tab[7]
#define __pyx_kp_u_Beta_Feature_note_This_class_is __pyx_string_tab[8]
#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[9]
#define __pyx_kp_u_Bursts_photons_are_out_of_order __pyx_string_tab[10]
#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[11]
#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[12]
#define __pyx_kp_u_Cannot_change_the_number_of_stat __pyx_string_tab[13]
#define __pyx_kp_u_Cannot_change_the_number_of_stat_2 __pyx_string_tab[14]
#define __pyx_kp_u_Cannot_change_the_number_of_stre __pyx_string_tab[15]
#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[16]
#define __pyx_kp_u_Cannot_give_negative_or_non_int __pyx_string_tab[17]
#define __pyx_kp_u_Cannot_have_negative_iterations __pyx_string_tab[18]
#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[19]
#define __pyx_kp_u_Cannot_set_niter_for_this_type_o __pyx_string_tab[20]
#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[21]
#define __pyx_kp_u_Class_for_prining_to_code_IPyth __pyx_string_tab[22]
#define __pyx_kp_u_Conflicting_values_for_numbers_o __pyx_string_tab[23]
#define __pyx_kp_u_Conflicting_values_for_numbers_o_2 __pyx_string_tab[24]
#define __pyx_kp_u_Converged_Model_cannot_have_inf __pyx_string_tab[25]
#define __pyx_kp_u_D_must_be_1D_uint8_array __pyx_string_tab[26]
#define __pyx_kp_u_Detector_indexes_out_of_range __pyx_string_tab[27]
#define __pyx_kp_u_Dim_0_of_one_of_the_matrices_doe __pyx_string_tab[28]
#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[29]
#define __pyx_kp_u_Empty_or_null_array_raise_issue __pyx_string_tab[30]
#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[31]
#define __pyx_kp_u_Fixed_model_cannot_mutate_conver __pyx_string_tab[32]
#define __pyx_kp_u_Fixed_models_cannot_be_altered __pyx_string_tab[33]
#define __pyx_kp_u_H2MM_C_H2MM_C_pyx __pyx_string_tab[34]
#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[35]
#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[36]
#define __pyx_kp_u_Init_model_no_data_linked_theref __pyx_string_tab[37]
#define __pyx_kp_u_Initial_model_out_of_min_max_obs __pyx_string_tab[38]
#define __pyx_kp_u_Initial_model_out_of_min_max_pri __pyx_string_tab[39]
#define __pyx_kp_u_Initial_model_out_of_min_max_tra __pyx_string_tab[40]
#define __pyx_kp_u_Input_array_not_stochastic_new_a __pyx_string_tab[41]
#define __pyx_kp_u_Input_matrix_not_row_stochastic __pyx_string_tab[42]
#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[43]
#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[44]
#define __pyx_kp_u_Iteration __pyx_string_tab[45]
#define __pyx_kp_u_Iteration_2 __pyx_string_tab[46]
#define __pyx_kp_u_Iteration_time __pyx_string_tab[47]
#define __pyx_kp_u_Length_must_be_at_least_3 __pyx_string_tab[48]
#define __pyx_kp_u_Limits_and_model_have_different __pyx_string_tab[49]
#define __pyx_kp_u_Limits_and_model_have_different_2 __pyx_string_tab[50]
#define __pyx_kp_u_Max __pyx_string_tab[51]
#define __pyx_kp_u_MemoryView_of __pyx_string_tab[52]
#define __pyx_kp_u_Mismatch_in_photon_streams_betwe __pyx_string_tab[53]
#define __pyx_kp_u_Mismatch_in_states_between_model __pyx_string_tab[54]
#define __pyx_kp_u_Model_uninitialized_with_data_ca __pyx_string_tab[55]
#define __pyx_kp_u_Must_be_h2mm_model __pyx_string_tab[56]
#define __pyx_kp_u_Must_have_at_least_2_times __pyx_string_tab[57]
#define __pyx_kp_u_Must_have_at_least_3_time_points __pyx_string_tab[58]
#define __pyx_kp_u_Must_have_at_least_3_times __pyx_string_tab[59]
#define __pyx_kp_u_Must_implement_close __pyx_string_tab[60]
#define __pyx_kp_u_Must_implement_update __pyx_string_tab[61]
#define __pyx_kp_u_Must_specify_number_of_photons_i __pyx_string_tab[62]
#define __pyx_kp_u_No_limits_specified_this_is_a_no __pyx_string_tab[63]
#define __pyx_kp_u_Non_int_options_for_num_cores_ar __pyx_string_tab[64]
#define __pyx_kp_u_None __pyx_string_tab[65]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[66]
#define __pyx_kp_u_Obs_matrix_must_have_ndim_2_wron __pyx_string_tab[67]
#define __pyx_kp_u_Obs_must_be_a_2D_numpy_floating __pyx_string_tab[68]
#define __pyx_kp_u_Optimization_limits_num_cores __pyx_string_tab[69]
#define __pyx_kp_u_Optimization_reached_maximum_num __pyx_string_tab[70]
#define __pyx_kp_u_Optimization_reached_maxiumum_ti __pyx_string_tab[71]
#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[72]
#define __pyx_kp_u_Out_of_order_photon __pyx_string_tab[73]
#define __pyx_kp_u_Prior_matrix_must_have_ndim_1_to __pyx_string_tab[74]
#define __pyx_kp_u_Prior_must_be_1D_numpy_floating __pyx_string_tab[75]
#define __pyx_kp_u_Special_class_for_setting_limit __pyx_string_tab[76]
#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[77]
#define __pyx_kp_u_The_model_converged_after __pyx_string_tab[78]
#define __pyx_kp_u_Times_must_be_1D __pyx_string_tab[79]
#define __pyx_kp_u_Too_many_photon_streams_in_data __pyx_string_tab[80]
#define __pyx_kp_u_Too_many_photon_streams_in_data_2 __pyx_string_tab[81]
#define __pyx_kp_u_Total __pyx_string_tab[82]
#define __pyx_kp_u_Trans_matrix_is_not_square_and_c __pyx_string_tab[83]
#define __pyx_kp_u_Trans_matrix_must_have_ndim_2_wr __pyx_string_tab[84]
#define __pyx_kp_u_Trans_must_be_a_2D_numpy_floatin __pyx_string_tab[85]
#define __pyx_kp_u_Trans_must_be_a_square_array __pyx_string_tab[86]
#define __pyx_kp_u_Type_of_max_obs_changed __pyx_string_tab[87]
#define __pyx_kp_u_Type_of_max_prior_changed __pyx_string_tab[88]
#define __pyx_kp_u_Type_of_max_trans_changed __pyx_string_tab[89]
#define __pyx_kp_u_Type_of_min_obs_changed __pyx_string_tab[90]
#define __pyx_kp_u_Type_of_min_prior_changed __pyx_string_tab[91]
#define __pyx_kp_u_Type_of_min_trans_changed __pyx_string_tab[92]
#define __pyx_kp_u_Uknown_error_raise_issue_on_gith __pyx_string_tab[93]
#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[94]
#define __pyx_kp_u_Unknown_error_check_C_code_raise __pyx_string_tab[95]
#define __pyx_kp_u_Unknown_error_in_phtragen_raise __pyx_string_tab[96]
#define __pyx_kp_u_Unknown_error_in_sparsestatepath __pyx_string_tab[97]
#define __pyx_kp_u_Unknown_error_raise_issue_on_git __pyx_string_tab[98]
#define __pyx_kp_u__10 __pyx_string_tab[99]
#define __pyx_kp_u__11 __pyx_string_tab[100]
#define __pyx_kp_u__12 __pyx_string_tab[101]
#define __pyx_kp_u__13 __pyx_string_tab[102]
#define __pyx_kp_u__14 __pyx_string_tab[103]
#define __pyx_kp_u__2 __pyx_string_tab[104]
#define __pyx_kp_u__20 __pyx_string_tab[105]
#define __pyx_kp_u__22 __pyx_string_tab[106]
#define __pyx_kp_u__23 __pyx_string_tab[107]
#define __pyx_kp_u__3 __pyx_string_tab[108]
#define __pyx_kp_u__4 __pyx_string_tab[109]
#define __pyx_kp_u__5 __pyx_string_tab[110]
#define __pyx_kp_u__7 __pyx_string_tab[111]
#define __pyx_kp_u_add_note __pyx_string_tab[112]
#define __pyx_kp_u_all_elements_of_models_must_be_h __pyx_string_tab[113]
#define __pyx_kp_u_and __pyx_string_tab[114]
#define __pyx_kp_u_and_limits_object __pyx_string_tab[115]
#define __pyx_kp_u_at_0x __pyx_string_tab[116]
#define __pyx_kp_u_bounds_func_must_be_None_minmax __pyx_string_tab[117]
#define __pyx_kp_u_bounds_must_be_None_or_h2mm_limi __pyx_string_tab[118]
#define __pyx_kp_u_bounds_states_incompatible_with __pyx_string_tab[119]
#define __pyx_kp_u_bounds_streams_incompatible_with __pyx_string_tab[120]
#define __pyx_kp_u_burst __pyx_string_tab[121]
#define __pyx_kp_u_but_buffer_has_size __pyx_string_tab[122]
#define __pyx_kp_u_bytes_too_small_to_read_as_h2mm __pyx_string_tab[123]
#define __pyx_kp_u_cannot_be_read_as_1D_uint8_nump __pyx_string_tab[124]
#define __pyx_kp_u_cannot_find_package_version __pyx_string_tab[125]
#define __pyx_kp_u_cannot_inplace_evaluate_fixed_mo __pyx_string_tab[126]
#define __pyx_kp_u_cannot_inpnlace_optimize_fixed_h __pyx_string_tab[127]
#define __pyx_kp_u_check_array_dimensions __pyx_string_tab[128]
#define __pyx_kp_u_collections_abc __pyx_string_tab[129]
#define __pyx_kp_u_computed_mode __pyx_string_tab[130]
#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[131]
#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[132]
#define __pyx_kp_u_conv __pyx_string_tab[133]
#define __pyx_kp_u_converged __pyx_string_tab[134]
#define __pyx_kp_u_converged_min_2 __pyx_string_tab[135]
#define __pyx_kp_u_converged_min_must_be_float_and __pyx_string_tab[136]
#define __pyx_kp_u_converged_min_must_be_float_got __pyx_string_tab[137]
#define __pyx_kp_u_converged_min_must_be_float_grea __pyx_string_tab[138]
#define __pyx_kp_u_converged_min_must_be_greater_th __pyx_string_tab[139]
#define __pyx_kp_u_converged_state __pyx_string_tab[140]
#define __pyx_kp_u_copmuted_model_by __pyx_string_tab[141]
#define __pyx_kp_u_dets_meaning_buffer_size_should __pyx_string_tab[142]
#define __pyx_kp_u_difference_is_too_large __pyx_string_tab[143]
#define __pyx_kp_u_different_from_others_specified __pyx_string_tab[144]
#define __pyx_kp_u_disable __pyx_string_tab[145]
#define __pyx_kp_u_enable __pyx_string_tab[146]
#define __pyx_kp_u_error_in_current_calculation __pyx_string_tab[147]
#define __pyx_kp_u_error_in_next_iteration __pyx_string_tab[148]
#define __pyx_kp_u_final_optimized_model_by __pyx_string_tab[149]
#define __pyx_kp_u_formatter_2 __pyx_string_tab[150]
#define __pyx_kp_u_gc __pyx_string_tab[151]
#define __pyx_kp_u_got __pyx_string_tab[152]
#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[153]
#define __pyx_kp_u_has_different_size_from_other_s __pyx_string_tab[154]
#define __pyx_kp_u_hashed __pyx_string_tab[155]
#define __pyx_kp_u_hashed_model __pyx_string_tab[156]
#define __pyx_kp_u_improvement __pyx_string_tab[157]
#define __pyx_kp_u_in __pyx_string_tab[158]
#define __pyx_kp_u_in_time_is_not_1D __pyx_string_tab[159]
#define __pyx_kp_u_in_times_has_different_size_fro __pyx_string_tab[160]
#define __pyx_kp_u_insufficent_memory_to_allocate_p __pyx_string_tab[161]
#define __pyx_kp_u_insufficient_memory __pyx_string_tab[162]
#define __pyx_kp_u_insufficient_memory_cannot_alloc __pyx_string_tab[163]
#define __pyx_kp_u_insufficient_memory_cannot_alloc_2 __pyx_string_tab[164]
#define __pyx_kp_u_insufficient_memory_cannot_alloc_3 __pyx_string_tab[165]
#define __pyx_kp_u_insufficient_memory_for_deltas __pyx_string_tab[166]
#define __pyx_kp_u_insufficient_memory_for_gamma __pyx_string_tab[167]
#define __pyx_kp_u_insufficient_memory_for_gamma_ar __pyx_string_tab[168]
#define __pyx_kp_u_insufficient_memory_for_h2mm_mod __pyx_string_tab[169]
#define __pyx_kp_u_insufficient_memory_for_time_del __pyx_string_tab[170]
#define __pyx_kp_u_insufficient_memory_to_allocate __pyx_string_tab[171]
#define __pyx_kp_u_is __pyx_string_tab[172]
#define __pyx_kp_u_is_conv_must_be_boolean_or_int __pyx_string_tab[173]
#define __pyx_kp_u_is_too_short_must_have_at_least __pyx_string_tab[174]
#define __pyx_kp_u_isenabled __pyx_string_tab[175]
#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[176]
#define __pyx_kp_u_iteration_time __pyx_string_tab[177]
#define __pyx_kp_u_iterations __pyx_string_tab[178]
#define __pyx_kp_u_kb_for_output_models_array __pyx_string_tab[179]
#define __pyx_kp_u_limits_function_must_return_bool __pyx_string_tab[180]
#define __pyx_kp_u_limits_function_must_return_mode __pyx_string_tab[181]
#define __pyx_kp_u_loglik_2 __pyx_string_tab[182]
#define __pyx_kp_u_loglik_3 __pyx_string_tab[183]
#define __pyx_kp_u_loglik_must_be_negative __pyx_string_tab[184]
#define __pyx_kp_u_loglik_not_calculated_against_da __pyx_string_tab[185]
#define __pyx_kp_u_loglik_not_calculated_against_da_2 __pyx_string_tab[186]
#define __pyx_kp_u_mallformed_h2mm_model_bytes_arra __pyx_string_tab[187]
#define __pyx_kp_u_max_iter_2 __pyx_string_tab[188]
#define __pyx_kp_u_max_iter_must_be_greater_than_0 __pyx_string_tab[189]
#define __pyx_kp_u_max_iter_must_be_int_got __pyx_string_tab[190]
#define __pyx_kp_u_max_iter_must_be_integer_greater __pyx_string_tab[191]
#define __pyx_kp_u_max_obs_dissallows_row_stochasti __pyx_string_tab[192]
#define __pyx_kp_u_max_time_2 __pyx_string_tab[193]
#define __pyx_kp_u_max_time_must_be_float_and_great __pyx_string_tab[194]
#define __pyx_kp_u_max_time_must_be_float_got __pyx_string_tab[195]
#define __pyx_kp_u_maximum_iterations __pyx_string_tab[196]
#define __pyx_kp_u_maximum_time __pyx_string_tab[197]
#define __pyx_kp_u_mid_optimization __pyx_string_tab[198]
#define __pyx_kp_u_min_obs_cannot_be_greater_than_m __pyx_string_tab[199]
#define __pyx_kp_u_min_obs_disallows_row_stochastic __pyx_string_tab[200]
#define __pyx_kp_u_min_prior_cannot_be_greater_than __pyx_string_tab[201]
#define __pyx_kp_u_min_trans_cannot_be_greater_than __pyx_string_tab[202]
#define __pyx_kp_u_min_trans_disallows_row_stochast __pyx_string_tab[203]
#define __pyx_kp_u_model_must_be_h2mm_model_or_None __pyx_string_tab[204]
#define __pyx_kp_u_model_obs_out_of_range_of_min_ma __pyx_string_tab[205]
#define __pyx_kp_u_model_prior_out_of_range_of_min __pyx_string_tab[206]
#define __pyx_kp_u_model_trans_out_of_range_of_min __pyx_string_tab[207]
#define __pyx_kp_u_models_must_be_sequence_or_array __pyx_string_tab[208]
#define __pyx_kp_u_must_be_None_float_or_numpy_arr __pyx_string_tab[209]
#define __pyx_kp_u_must_be_readable_as_sequence_or __pyx_string_tab[210]
#define __pyx_kp_u_ndet __pyx_string_tab[211]
#define __pyx_kp_u_newly_created_model __pyx_string_tab[212]
#define __pyx_kp_u_niter_2 __pyx_string_tab[213]
#define __pyx_kp_u_niter_must_be_integer __pyx_string_tab[214]
#define __pyx_kp_u_niter_must_be_positive __pyx_string_tab[215]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[216]
#define __pyx_kp_u_nphot_2 __pyx_string_tab[217]
#define __pyx_kp_u_nphot_must_be_positive __pyx_string_tab[218]
#define __pyx_kp_u_nstate_2 __pyx_string_tab[219]
#define __pyx_kp_u_nubmer_of_bursts_in __pyx_string_tab[220]
#define __pyx_kp_u_nubmer_of_bursts_in_times __pyx_string_tab[221]
#define __pyx_kp_u_num_cores_must_be_greater_than_0 __pyx_string_tab[222]
#define __pyx_kp_u_num_cores_must_be_int_and_greate __pyx_string_tab[223]
#define __pyx_kp_u_num_cores_must_be_integer_greate __pyx_string_tab[224]
#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[225]
#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[226]
#define __pyx_kp_u_object_2 __pyx_string_tab[227]
#define __pyx_kp_u_obs_2 __pyx_string_tab[228]
#define __pyx_kp_u_obs_array_can_have_no_negative_v __pyx_string_tab[229]
#define __pyx_kp_u_obs_bounds_not_valid_for_this_nu __pyx_string_tab[230]
#define __pyx_kp_u_obs_dist_must_be_equal_or_random __pyx_string_tab[231]
#define __pyx_kp_u_opt_array_must_be_True_False_0_F __pyx_string_tab[232]
#define __pyx_kp_u_out_of_order __pyx_string_tab[233]
#define __pyx_kp_u_outstream_2 __pyx_string_tab[234]
#define __pyx_kp_u_photons_times __pyx_string_tab[235]
#define __pyx_kp_u_post_optimization_LL __pyx_string_tab[236]
#define __pyx_kp_u_previous_loglik __pyx_string_tab[237]
#define __pyx_kp_u_print_func_must_be_None_all_diff __pyx_string_tab[238]
#define __pyx_kp_u_prior_2 __pyx_string_tab[239]
#define __pyx_kp_u_prior_array_can_have_no_negative __pyx_string_tab[240]
#define __pyx_kp_u_prior_bounds_not_valid_for_the_n __pyx_string_tab[241]
#define __pyx_kp_u_prior_dist_must_be_equal_or_rand __pyx_string_tab[242]
#define __pyx_kp_u_returning_previous_model __pyx_string_tab[243]
#define __pyx_kp_u_revert_old_2 __pyx_string_tab[244]
#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[245]
#define __pyx_kp_u_singly_computed __pyx_string_tab[246]
#define __pyx_kp_u_standard_bounding_styles_require __pyx_string_tab[247]
#define __pyx_kp_u_states __pyx_string_tab[248]
#define __pyx_kp_u_states_and __pyx_string_tab[249]
#define __pyx_kp_u_streams __pyx_string_tab[250]
#define __pyx_kp_u_strided_and_direct __pyx_string_tab[251]
#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[252]
#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[253]
#define __pyx_kp_u_stringsource __pyx_string_tab[254]
#define __pyx_kp_u_times_array_must_be_1D __pyx_string_tab[255]
#define __pyx_kp_u_total __pyx_string_tab[256]
#define __pyx_kp_u_trans_2 __pyx_string_tab[257]
#define __pyx_kp_u_trans_array_can_have_no_negative __pyx_string_tab[258]
#define __pyx_kp_u_trans_bounds_not_valid_for_this __pyx_string_tab[259]
#define __pyx_kp_u_trans_dist_must_be_equal_or_rand __pyx_string_tab[260]
#define __pyx_kp_u_un __pyx_string_tab[261]
#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[262]
#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[263]
#define __pyx_kp_u_unhashable_model_must_sort_state __pyx_string_tab[264]
#define __pyx_kp_u_vs __pyx_string_tab[265]
#define __pyx_kp_u_vs_2 __pyx_string_tab[266]
#define __pyx_kp_u_with_error __pyx_string_tab[267]
#define __pyx_kp_u_xlim_and_ylim_must_be_nrow_x_nco __pyx_string_tab[268]
#define __pyx_kp_u_xlim_and_ylim_must_be_nrow_x_nco_2 __pyx_string_tab[269]
#define __pyx_n_u_ABC __pyx_string_tab[270]
#define __pyx_n_u_ASCII __pyx_string_tab[271]
#define __pyx_n_u_BIC __pyx_string_tab[272]
#define __pyx_n_u_ConvCodes __pyx_string_tab[273]
#define __pyx_n_u_ConvCodes___reduce_cython __pyx_string_tab[274]
#define __pyx_n_u_ConvCodes___setstate_cython __pyx_string_tab[275]
#define __pyx_n_u_DisplayHandle __pyx_string_tab[276]
#define __pyx_n_u_EM_H2MM_C __pyx_string_tab[277]
#define __pyx_n_u_Ellipsis __pyx_string_tab[278]
#define __pyx_n_u_False __pyx_string_tab[279]
#define __pyx_n_u_H2MM_C __pyx_string_tab[280]
#define __pyx_n_u_H2MM_arr __pyx_string_tab[281]
#define __pyx_n_u_IPyPlot __pyx_string_tab[282]
#define __pyx_n_u_IPyPlot___init __pyx_string_tab[283]
#define __pyx_n_u_IPyPlot___init___locals_genexpr __pyx_string_tab[284]
#define __pyx_n_u_IPyPlot__get_xylim __pyx_string_tab[285]
#define __pyx_n_u_IPyPlot_close __pyx_string_tab[286]
#define __pyx_n_u_IPyPlot_update __pyx_string_tab[287]
#define __pyx_n_u_IPyPrinter __pyx_string_tab[288]
#define __pyx_n_u_IPyPrinter___init __pyx_string_tab[289]
#define __pyx_n_u_IPyPrinter_close __pyx_string_tab[290]
#define __pyx_n_u_IPyPrinter_update __pyx_string_tab[291]
#define __pyx_n_u_IPython_display __pyx_string_tab[292]
#define __pyx_n_u_PackageNotFoundError __pyx_string_tab[293]
#define __pyx_n_u_Pretty __pyx_string_tab[294]
#define __pyx_n_u_Printer __pyx_string_tab[295]
#define __pyx_n_u_Printer___call __pyx_string_tab[296]
#define __pyx_n_u_Printer___enter __pyx_string_tab[297]
#define __pyx_n_u_Printer___exit __pyx_string_tab[298]
#define __pyx_n_u_Printer_close __pyx_string_tab[299]
#define __pyx_n_u_Printer_update __pyx_string_tab[300]
#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[301]
#define __pyx_n_u_Sequence __pyx_string_tab[302]
#define __pyx_n_u_StdPrinter __pyx_string_tab[303]
#define __pyx_n_u_StdPrinter___init __pyx_string_tab[304]
#define __pyx_n_u_StdPrinter_close __pyx_string_tab[305]
#define __pyx_n_u_StdPrinter_update __pyx_string_tab[306]
#define __pyx_n_u_T_2 __pyx_string_tab[307]
#define __pyx_n_u_View_MemoryView __pyx_string_tab[308]
#define __pyx_n_u_abc __pyx_string_tab[309]
#define __pyx_n_u_abstractmethod __pyx_string_tab[310]
#define __pyx_n_u_all __pyx_string_tab[311]
#define __pyx_n_u_allocate_buffer __pyx_string_tab[312]
#define __pyx_n_u_any __pyx_string_tab[313]
#define __pyx_n_u_append __pyx_string_tab[314]
#define __pyx_n_u_arg_list __pyx_string_tab[315]
#define __pyx_n_u_args __pyx_string_tab[316]
#define __pyx_n_u_argsort __pyx_string_tab[317]
#define __pyx_n_u_argwhere __pyx_string_tab[318]
#define __pyx_n_u_arr __pyx_string_tab[319]
#define __pyx_n_u_array __pyx_string_tab[320]
#define __pyx_n_u_asarray __pyx_string_tab[321]
#define __pyx_n_u_ascontiguousarray __pyx_string_tab[322]
#define __pyx_n_u_astype __pyx_string_tab[323]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[324]
#define __pyx_n_u_atleast_2d __pyx_string_tab[325]
#define __pyx_n_u_ax __pyx_string_tab[326]
#define __pyx_n_u_axis __pyx_string_tab[327]
#define __pyx_n_u_b __pyx_string_tab[328]
#define __pyx_n_u_base __pyx_string_tab[329]
#define __pyx_n_u_begs __pyx_string_tab[330]
#define __pyx_n_u_bic __pyx_string_tab[331]
#define __pyx_n_u_bnd_ptr __pyx_string_tab[332]
#define __pyx_n_u_bnds __pyx_string_tab[333]
#define __pyx_n_u_bound __pyx_string_tab[334]
#define __pyx_n_u_bound_err __pyx_string_tab[335]
#define __pyx_n_u_bound_func __pyx_string_tab[336]
#define __pyx_n_u_bounds __pyx_string_tab[337]
#define __pyx_n_u_bounds_func __pyx_string_tab[338]
#define __pyx_n_u_bounds_kwargs __pyx_string_tab[339]
#define __pyx_n_u_buf __pyx_string_tab[340]
#define __pyx_n_u_buffer __pyx_string_tab[341]
#define __pyx_n_u_burst_sizes __pyx_string_tab[342]
#define __pyx_n_u_burst_type __pyx_string_tab[343]
#define __pyx_n_u_burst_type_temp __pyx_string_tab[344]
#define __pyx_n_u_burstshape __pyx_string_tab[345]
#define __pyx_n_u_burstsingle __pyx_string_tab[346]
#define __pyx_n_u_c __pyx_string_tab[347]
#define __pyx_n_u_c_min __pyx_string_tab[348]
#define __pyx_n_u_call __pyx_string_tab[349]
#define __pyx_n_u_cdeltas __pyx_string_tab[350]
#define __pyx_n_u_chain __pyx_string_tab[351]
#define __pyx_n_u_cindexes __pyx_string_tab[352]
#define __pyx_n_u_cinit___locals_lambda __pyx_string_tab[353]
#define __pyx_n_u_class __pyx_string_tab[354]
#define __pyx_n_u_class_getitem __pyx_string_tab[355]
#define __pyx_n_u_clear_output __pyx_string_tab[356]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[357]
#define __pyx_n_u_close __pyx_string_tab[358]
#define __pyx_n_u_cls __pyx_string_tab[359]
#define __pyx_n_u_collections_abc __pyx_string_tab[360]
#define __pyx_n_u_comp __pyx_string_tab[361]
#define __pyx_n_u_comp_time __pyx_string_tab[362]
#define __pyx_n_u_concatenate __pyx_string_tab[363]
#define __pyx_n_u_const_obs __pyx_string_tab[364]
#define __pyx_n_u_conv_2 __pyx_string_tab[365]
#define __pyx_n_u_conv_code __pyx_string_tab[366]
#define __pyx_n_u_convcode __pyx_string_tab[367]
#define __pyx_n_u_converged_2 __pyx_string_tab[368]
#define __pyx_n_u_converged_min __pyx_string_tab[369]
#define __pyx_n_u_copy __pyx_string_tab[370]
#define __pyx_n_u_copy_2 __pyx_string_tab[371]
#define __pyx_n_u_count __pyx_string_tab[372]
#define __pyx_n_u_cpaths __pyx_string_tab[373]
#define __pyx_n_u_cpu_count __pyx_string_tab[374]
#define __pyx_n_u_cstate_path __pyx_string_tab[375]
#define __pyx_n_u_ctimes __pyx_string_tab[376]
#define __pyx_n_u_current __pyx_string_tab[377]
#define __pyx_n_u_data __pyx_string_tab[378]
#define __pyx_n_u_deltas __pyx_string_tab[379]
#define __pyx_n_u_demar __pyx_string_tab[380]
#define __pyx_n_u_dets __pyx_string_tab[381]
#define __pyx_n_u_dets_n __pyx_string_tab[382]
#define __pyx_n_u_dict __pyx_string_tab[383]
#define __pyx_n_u_dict_2 __pyx_string_tab[384]
#define __pyx_n_u_diff __pyx_string_tab[385]
#define __pyx_n_u_diff_time __pyx_string_tab[386]
#define __pyx_n_u_display __pyx_string_tab[387]
#define __pyx_n_u_doc __pyx_string_tab[388]
#define __pyx_n_u_double __pyx_string_tab[389]
#define __pyx_n_u_dtype __pyx_string_tab[390]
#define __pyx_n_u_dtype_is_object __pyx_string_tab[391]
#define __pyx_n_u_dwell_beg __pyx_string_tab[392]
#define __pyx_n_u_dwell_burst __pyx_string_tab[393]
#define __pyx_n_u_dwell_end __pyx_string_tab[394]
#define __pyx_n_u_dwell_mid __pyx_string_tab[395]
#define __pyx_n_u_dx __pyx_string_tab[396]
#define __pyx_n_u_dy __pyx_string_tab[397]
#define __pyx_n_u_e __pyx_string_tab[398]
#define __pyx_n_u_eln __pyx_string_tab[399]
#define __pyx_n_u_empty __pyx_string_tab[400]
#define __pyx_n_u_encode __pyx_string_tab[401]
#define __pyx_n_u_ends __pyx_string_tab[402]
#define __pyx_n_u_enter __pyx_string_tab[403]
#define __pyx_n_u_enumerate __pyx_string_tab[404]
#define __pyx_n_u_equal __pyx_string_tab[405]
#define __pyx_n_u_err __pyx_string_tab[406]
#define __pyx_n_u_error __pyx_string_tab[407]
#define __pyx_n_u_evaluate __pyx_string_tab[408]
#define __pyx_n_u_exc_tb __pyx_string_tab[409]
#define __pyx_n_u_exc_type __pyx_string_tab[410]
#define __pyx_n_u_exc_val __pyx_string_tab[411]
#define __pyx_n_u_exit __pyx_string_tab[412]
#define __pyx_n_u_exp __pyx_string_tab[413]
#define __pyx_n_u_eye __pyx_string_tab[414]
#define __pyx_n_u_factory_h2mm_model __pyx_string_tab[415]
#define __pyx_n_u_fig __pyx_string_tab[416]
#define __pyx_n_u_flags __pyx_string_tab[417]
#define __pyx_n_u_floating __pyx_string_tab[418]
#define __pyx_n_u_flush __pyx_string_tab[419]
#define __pyx_n_u_format __pyx_string_tab[420]
#define __pyx_n_u_formatter __pyx_string_tab[421]
#define __pyx_n_u_fortran __pyx_string_tab[422]
#define __pyx_n_u_from_iterable __pyx_string_tab[423]
#define __pyx_n_u_frombytes __pyx_string_tab[424]
#define __pyx_n_u_func __pyx_string_tab[425]
#define __pyx_n_u_gamma __pyx_string_tab[426]
#define __pyx_n_u_gamma_2 __pyx_string_tab[427]
#define __pyx_n_u_gamma_arr __pyx_string_tab[428]
#define __pyx_n_u_gamma_out __pyx_string_tab[429]
#define __pyx_n_u_genexpr __pyx_string_tab[430]
#define __pyx_n_u_get_converged_min __pyx_string_tab[431]
#define __pyx_n_u_get_formatter __pyx_string_tab[432]
#define __pyx_n_u_get_max_iter __pyx_string_tab[433]
#define __pyx_n_u_get_max_time __pyx_string_tab[434]
#define __pyx_n_u_get_num_cores __pyx_string_tab[435]
#define __pyx_n_u_get_outstream __pyx_string_tab[436]
#define __pyx_n_u_get_stdout __pyx_string_tab[437]
#define __pyx_n_u_get_xylim __pyx_string_tab[438]
#define __pyx_n_u_getstate __pyx_string_tab[439]
#define __pyx_n_u_h2mm_limits __pyx_string_tab[440]
#define __pyx_n_u_h2mm_limits___init __pyx_string_tab[441]
#define __pyx_n_u_h2mm_limits__make_model __pyx_string_tab[442]
#define __pyx_n_u_h2mm_limits_make_model __pyx_string_tab[443]
#define __pyx_n_u_h2mm_lims __pyx_string_tab[444]
#define __pyx_n_u_h2mm_lims___reduce_cython __pyx_string_tab[445]
#define __pyx_n_u_h2mm_lims___setstate_cython __pyx_string_tab[446]
#define __pyx_n_u_h2mm_model __pyx_string_tab[447]
#define __pyx_n_u_h2mm_model___copy __pyx_string_tab[448]
#define __pyx_n_u_h2mm_model___reduce_cython __pyx_string_tab[449]
#define __pyx_n_u_h2mm_model___setstate_cython __pyx_string_tab[450]
#define __pyx_n_u_h2mm_model_copy __pyx_string_tab[451]
#define __pyx_n_u_h2mm_model_evaluate __pyx_string_tab[452]
#define __pyx_n_u_h2mm_model_frombytes __pyx_string_tab[453]
#define __pyx_n_u_h2mm_model_normalize __pyx_string_tab[454]
#define __pyx_n_u_h2mm_model_optimize __pyx_string_tab[455]
#define __pyx_n_u_h2mm_model_set_converged __pyx_string_tab[456]
#define __pyx_n_u_h2mm_model_sort_states __pyx_string_tab[457]
#define __pyx_n_u_h2mm_model_tobytes __pyx_string_tab[458]
#define __pyx_n_u_h_mod __pyx_string_tab[459]
#define __pyx_n_u_has_ipython __pyx_string_tab[460]
#define __pyx_n_u_has_matplotlib __pyx_string_tab[461]
#define __pyx_n_u_hash___locals_genexpr __pyx_string_tab[462]
#define __pyx_n_u_hmod __pyx_string_tab[463]
#define __pyx_n_u_i __pyx_string_tab[464]
#define __pyx_n_u_icl __pyx_string_tab[465]
#define __pyx_n_u_id __pyx_string_tab[466]
#define __pyx_n_u_idxs __pyx_string_tab[467]
#define __pyx_n_u_import __pyx_string_tab[468]
#define __pyx_n_u_importlib_metadata __pyx_string_tab[469]
#define __pyx_n_u_importlib_metadata_2 __pyx_string_tab[470]
#define __pyx_n_u_index __pyx_string_tab[471]
#define __pyx_n_u_indexes __pyx_string_tab[472]
#define __pyx_n_u_indxs __pyx_string_tab[473]
#define __pyx_n_u_inf __pyx_string_tab[474]
#define __pyx_n_u_init __pyx_string_tab[475]
#define __pyx_n_u_inplace __pyx_string_tab[476]
#define __pyx_n_u_int64 __pyx_string_tab[477]
#define __pyx_n_u_integer __pyx_string_tab[478]
#define __pyx_n_u_is_conv __pyx_string_tab[479]
#define __pyx_n_u_is_coroutine __pyx_string_tab[480]
#define __pyx_n_u_isnan __pyx_string_tab[481]
#define __pyx_n_u_issubdtype __pyx_string_tab[482]
#define __pyx_n_u_items __pyx_string_tab[483]
#define __pyx_n_u_itemsize __pyx_string_tab[484]
#define __pyx_n_u_iter __pyx_string_tab[485]
#define __pyx_n_u_iter_time __pyx_string_tab[486]
#define __pyx_n_u_itertools __pyx_string_tab[487]
#define __pyx_n_u_j __pyx_string_tab[488]
#define __pyx_n_u_join __pyx_string_tab[489]
#define __pyx_n_u_k __pyx_string_tab[490]
#define __pyx_n_u_keep __pyx_string_tab[491]
#define __pyx_n_u_kwargs __pyx_string_tab[492]
#define __pyx_n_u_l __pyx_string_tab[493]
#define __pyx_n_u_lambda __pyx_string_tab[494]
#define __pyx_n_u_lenp __pyx_string_tab[495]
#define __pyx_n_u_limits __pyx_string_tab[496]
#define __pyx_n_u_linspace __pyx_string_tab[497]
#define __pyx_n_u_ll __pyx_string_tab[498]
#define __pyx_n_u_ln __pyx_string_tab[499]
#define __pyx_n_u_log __pyx_string_tab[500]
#define __pyx_n_u_loglik __pyx_string_tab[501]
#define __pyx_n_u_loglikarray __pyx_string_tab[502]
#define __pyx_n_u_loglikp __pyx_string_tab[503]
#define __pyx_n_u_loglikpath __pyx_string_tab[504]
#define __pyx_n_u_long __pyx_string_tab[505]
#define __pyx_n_u_m_iter __pyx_string_tab[506]
#define __pyx_n_u_m_time __pyx_string_tab[507]
#define __pyx_n_u_main __pyx_string_tab[508]
#define __pyx_n_u_major __pyx_string_tab[509]
#define __pyx_n_u_make_h2mm_arr_modptr_locals_gene __pyx_string_tab[510]
#define __pyx_n_u_make_model __pyx_string_tab[511]
#define __pyx_n_u_make_model_2 __pyx_string_tab[512]
#define __pyx_n_u_matplotlib __pyx_string_tab[513]
#define __pyx_n_u_matplotlib_pyplot __pyx_string_tab[514]
#define __pyx_n_u_max __pyx_string_tab[515]
#define __pyx_n_u_max_iter __pyx_string_tab[516]
#define __pyx_n_u_max_obs __pyx_string_tab[517]
#define __pyx_n_u_max_prior __pyx_string_tab[518]
#define __pyx_n_u_max_time __pyx_string_tab[519]
#define __pyx_n_u_max_trans __pyx_string_tab[520]
#define __pyx_n_u_mdl __pyx_string_tab[521]
#define __pyx_n_u_memview __pyx_string_tab[522]
#define __pyx_n_u_metaclass __pyx_string_tab[523]
#define __pyx_n_u_min __pyx_string_tab[524]
#define __pyx_n_u_min_obs __pyx_string_tab[525]
#define __pyx_n_u_min_prior __pyx_string_tab[526]
#define __pyx_n_u_min_trans __pyx_string_tab[527]
#define __pyx_n_u_minmax __pyx_string_tab[528]
#define __pyx_n_u_minor __pyx_string_tab[529]
#define __pyx_n_u_mode __pyx_string_tab[530]
#define __pyx_n_u_model __pyx_string_tab[531]
#define __pyx_n_u_models __pyx_string_tab[532]
#define __pyx_n_u_modelshape __pyx_string_tab[533]
#define __pyx_n_u_modelsingle __pyx_string_tab[534]
#define __pyx_n_u_module __pyx_string_tab[535]
#define __pyx_n_u_mro_entries __pyx_string_tab[536]
#define __pyx_n_u_multi __pyx_string_tab[537]
#define __pyx_n_u_n_core __pyx_string_tab[538]
#define __pyx_n_u_name __pyx_string_tab[539]
#define __pyx_n_u_name_2 __pyx_string_tab[540]
#define __pyx_n_u_nbursts __pyx_string_tab[541]
#define __pyx_n_u_ncols __pyx_string_tab[542]
#define __pyx_n_u_ncore __pyx_string_tab[543]
#define __pyx_n_u_ndet_2 __pyx_string_tab[544]
#define __pyx_n_u_ndim __pyx_string_tab[545]
#define __pyx_n_u_new __pyx_string_tab[546]
#define __pyx_n_u_new_2 __pyx_string_tab[547]
#define __pyx_n_u_newaxis __pyx_string_tab[548]
#define __pyx_n_u_next __pyx_string_tab[549]
#define __pyx_n_u_niter __pyx_string_tab[550]
#define __pyx_n_u_nmodels __pyx_string_tab[551]
#define __pyx_n_u_none __pyx_string_tab[552]
#define __pyx_n_u_none_kwargs __pyx_string_tab[553]
#define __pyx_n_u_normalize __pyx_string_tab[554]
#define __pyx_n_u_nout __pyx_string_tab[555]
#define __pyx_n_u_np __pyx_string_tab[556]
#define __pyx_n_u_nphot __pyx_string_tab[557]
#define __pyx_n_u_nrows __pyx_string_tab[558]
#define __pyx_n_u_nstate __pyx_string_tab[559]
#define __pyx_n_u_num __pyx_string_tab[560]
#define __pyx_n_u_num_cores __pyx_string_tab[561]
#define __pyx_n_u_numpy __pyx_string_tab[562]
#define __pyx_n_u_obj __pyx_string_tab[563]
#define __pyx_n_u_object __pyx_string_tab[564]
#define __pyx_n_u_object_3 __pyx_string_tab[565]
#define __pyx_n_u_obs __pyx_string_tab[566]
#define __pyx_n_u_obs_alpha __pyx_string_tab[567]
#define __pyx_n_u_obs_beta __pyx_string_tab[568]
#define __pyx_n_u_obs_dist __pyx_string_tab[569]
#define __pyx_n_u_obs_sigma __pyx_string_tab[570]
#define __pyx_n_u_old __pyx_string_tab[571]
#define __pyx_n_u_ones __pyx_string_tab[572]
#define __pyx_n_u_opt_array __pyx_string_tab[573]
#define __pyx_n_u_opt_array_2 __pyx_string_tab[574]
#define __pyx_n_u_opt_lim_const __pyx_string_tab[575]
#define __pyx_n_u_opt_lim_const___reduce_cython __pyx_string_tab[576]
#define __pyx_n_u_opt_lim_const___setstate_cython __pyx_string_tab[577]
#define __pyx_n_u_opt_lim_const__get_converged_min __pyx_string_tab[578]
#define __pyx_n_u_opt_lim_const__get_formatter __pyx_string_tab[579]
#define __pyx_n_u_opt_lim_const__get_max_iter __pyx_string_tab[580]
#define __pyx_n_u_opt_lim_const__get_max_time __pyx_string_tab[581]
#define __pyx_n_u_opt_lim_const__get_num_cores __pyx_string_tab[582]
#define __pyx_n_u_opt_lim_const__get_outstream __pyx_string_tab[583]
#define __pyx_n_u_optimization_limits __pyx_string_tab[584]
#define __pyx_n_u_optimize __pyx_string_tab[585]
#define __pyx_n_u_os __pyx_string_tab[586]
#define __pyx_n_u_out __pyx_string_tab[587]
#define __pyx_n_u_out_arr __pyx_string_tab[588]
#define __pyx_n_u_out_arr_size __pyx_string_tab[589]
#define __pyx_n_u_out_mod __pyx_string_tab[590]
#define __pyx_n_u_out_model __pyx_string_tab[591]
#define __pyx_n_u_out_text __pyx_string_tab[592]
#define __pyx_n_u_outstream __pyx_string_tab[593]
#define __pyx_n_u_pack __pyx_string_tab[594]
#define __pyx_n_u_param __pyx_string_tab[595]
#define __pyx_n_u_path __pyx_string_tab[596]
#define __pyx_n_u_path_loglik __pyx_string_tab[597]
#define __pyx_n_u_path_loglik_locals_genexpr __pyx_string_tab[598]
#define __pyx_n_u_path_n __pyx_string_tab[599]
#define __pyx_n_u_paths __pyx_string_tab[600]
#define __pyx_n_u_ph_beg __pyx_string_tab[601]
#define __pyx_n_u_ph_burst __pyx_string_tab[602]
#define __pyx_n_u_ph_counts __pyx_string_tab[603]
#define __pyx_n_u_ph_counts_temp __pyx_string_tab[604]
#define __pyx_n_u_ph_end __pyx_string_tab[605]
#define __pyx_n_u_ph_mid __pyx_string_tab[606]
#define __pyx_n_u_plot __pyx_string_tab[607]
#define __pyx_n_u_plot_bic __pyx_string_tab[608]
#define __pyx_n_u_plot_bic_obs __pyx_string_tab[609]
#define __pyx_n_u_plot_kwargs __pyx_string_tab[610]
#define __pyx_n_u_plot_obs __pyx_string_tab[611]
#define __pyx_n_u_plot_type __pyx_string_tab[612]
#define __pyx_n_u_plt __pyx_string_tab[613]
#define __pyx_n_u_pop __pyx_string_tab[614]
#define __pyx_n_u_prepare __pyx_string_tab[615]
#define __pyx_n_u_print __pyx_string_tab[616]
#define __pyx_n_u_print_args __pyx_string_tab[617]
#define __pyx_n_u_print_err __pyx_string_tab[618]
#define __pyx_n_u_print_fmt_args __pyx_string_tab[619]
#define __pyx_n_u_print_fmt_kwargs __pyx_string_tab[620]
#define __pyx_n_u_print_fmtr __pyx_string_tab[621]
#define __pyx_n_u_print_formatter __pyx_string_tab[622]
#define __pyx_n_u_print_freq __pyx_string_tab[623]
#define __pyx_n_u_print_func __pyx_string_tab[624]
#define __pyx_n_u_print_kwargs __pyx_string_tab[625]
#define __pyx_n_u_print_stream __pyx_string_tab[626]
#define __pyx_n_u_print_strings __pyx_string_tab[627]
#define __pyx_n_u_prior __pyx_string_tab[628]
#define __pyx_n_u_prior_alpha __pyx_string_tab[629]
#define __pyx_n_u_prior_beta __pyx_string_tab[630]
#define __pyx_n_u_prior_dist __pyx_string_tab[631]
#define __pyx_n_u_prior_sigma __pyx_string_tab[632]
#define __pyx_n_u_prnt_strct __pyx_string_tab[633]
#define __pyx_n_u_product __pyx_string_tab[634]
#define __pyx_n_u_ptr_print_func __pyx_string_tab[635]
#define __pyx_n_u_pyplot __pyx_string_tab[636]
#define __pyx_n_u_python_version __pyx_string_tab[637]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[638]
#define __pyx_n_u_pyx_result __pyx_string_tab[639]
#define __pyx_n_u_pyx_state __pyx_string_tab[640]
#define __pyx_n_u_pyx_type __pyx_string_tab[641]
#define __pyx_n_u_pyx_unpickle_ConvCodes __pyx_string_tab[642]
#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[643]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[644]
#define __pyx_n_u_qualname __pyx_string_tab[645]
#define __pyx_n_u_random __pyx_string_tab[646]
#define __pyx_n_u_reduce __pyx_string_tab[647]
#define __pyx_n_u_reduce_cython __pyx_string_tab[648]
#define __pyx_n_u_reduce_ex __pyx_string_tab[649]
#define __pyx_n_u_register __pyx_string_tab[650]
#define __pyx_n_u_replace __pyx_string_tab[651]
#define __pyx_n_u_res __pyx_string_tab[652]
#define __pyx_n_u_reset_niter __pyx_string_tab[653]
#define __pyx_n_u_reshape __pyx_string_tab[654]
#define __pyx_n_u_ret __pyx_string_tab[655]
#define __pyx_n_u_revert __pyx_string_tab[656]
#define __pyx_n_u_revert_old __pyx_string_tab[657]
#define __pyx_n_u_scale __pyx_string_tab[658]
#define __pyx_n_u_scatter __pyx_string_tab[659]
#define __pyx_n_u_seed __pyx_string_tab[660]
#define __pyx_n_u_seedp __pyx_string_tab[661]
#define __pyx_n_u_self __pyx_string_tab[662]
#define __pyx_n_u_send __pyx_string_tab[663]
#define __pyx_n_u_set_converged __pyx_string_tab[664]
#define __pyx_n_u_set_name __pyx_string_tab[665]
#define __pyx_n_u_set_xlim __pyx_string_tab[666]
#define __pyx_n_u_set_ylim __pyx_string_tab[667]
#define __pyx_n_u_setdefault __pyx_string_tab[668]
#define __pyx_n_u_setstate __pyx_string_tab[669]
#define __pyx_n_u_setstate_cython __pyx_string_tab[670]
#define __pyx_n_u_shape __pyx_string_tab[671]
#define __pyx_n_u_sim_phtraj_from_state __pyx_string_tab[672]
#define __pyx_n_u_sim_phtraj_from_times __pyx_string_tab[673]
#define __pyx_n_u_sim_sparsestatepath __pyx_string_tab[674]
#define __pyx_n_u_sim_statepath __pyx_string_tab[675]
#define __pyx_n_u_single __pyx_string_tab[676]
#define __pyx_n_u_single_line __pyx_string_tab[677]
#define __pyx_n_u_size __pyx_string_tab[678]
#define __pyx_n_u_slots __pyx_string_tab[679]
#define __pyx_n_u_sort __pyx_string_tab[680]
#define __pyx_n_u_sort_states __pyx_string_tab[681]
#define __pyx_n_u_srt __pyx_string_tab[682]
#define __pyx_n_u_st __pyx_string_tab[683]
#define __pyx_n_u_start __pyx_string_tab[684]
#define __pyx_n_u_state __pyx_string_tab[685]
#define __pyx_n_u_state_path __pyx_string_tab[686]
#define __pyx_n_u_states_2 __pyx_string_tab[687]
#define __pyx_n_u_states_arr __pyx_string_tab[688]
#define __pyx_n_u_states_n __pyx_string_tab[689]
#define __pyx_n_u_stdout __pyx_string_tab[690]
#define __pyx_n_u_step __pyx_string_tab[691]
#define __pyx_n_u_stop __pyx_string_tab[692]
#define __pyx_n_u_stream __pyx_string_tab[693]
#define __pyx_n_u_strip __pyx_string_tab[694]
#define __pyx_n_u_struct __pyx_string_tab[695]
#define __pyx_n_u_subplots __pyx_string_tab[696]
#define __pyx_n_u_sum __pyx_string_tab[697]
#define __pyx_n_u_sum_loglik __pyx_string_tab[698]
#define __pyx_n_u_sys __pyx_string_tab[699]
#define __pyx_n_u_test __pyx_string_tab[700]
#define __pyx_n_u_test_2 __pyx_string_tab[701]
#define __pyx_n_u_text __pyx_string_tab[702]
#define __pyx_n_u_throw __pyx_string_tab[703]
#define __pyx_n_u_time __pyx_string_tab[704]
#define __pyx_n_u_times __pyx_string_tab[705]
#define __pyx_n_u_times_arr __pyx_string_tab[706]
#define __pyx_n_u_times_n __pyx_string_tab[707]
#define __pyx_n_u_tobytes __pyx_string_tab[708]
#define __pyx_n_u_total_loglik __pyx_string_tab[709]
#define __pyx_n_u_total_time __pyx_string_tab[710]
#define __pyx_n_u_trans __pyx_string_tab[711]
#define __pyx_n_u_trans_dist __pyx_string_tab[712]
#define __pyx_n_u_trans_scale __pyx_string_tab[713]
#define __pyx_n_u_uint8 __pyx_string_tab[714]
#define __pyx_n_u_uniform __pyx_string_tab[715]
#define __pyx_n_u_unpack __pyx_string_tab[716]
#define __pyx_n_u_update __pyx_string_tab[717]
#define __pyx_n_u_use_setstate __pyx_string_tab[718]
#define __pyx_n_u_value __pyx_string_tab[719]
#define __pyx_n_u_values __pyx_string_tab[720]
#define __pyx_n_u_version __pyx_string_tab[721]
#define __pyx_n_u_version_2 __pyx_string_tab[722]
#define __pyx_n_u_version_info __pyx_string_tab[723]
#define __pyx_n_u_viterbi_path __pyx_string_tab[724]
#define __pyx_n_u_viterbi_sort __pyx_string_tab[725]
#define __pyx_n_u_warn __pyx_string_tab[726]
#define __pyx_n_u_warning __pyx_string_tab[727]
#define __pyx_n_u_warnings __pyx_string_tab[728]
#define __pyx_n_u_width __pyx_string_tab[729]
#define __pyx_n_u_write __pyx_string_tab[730]
#define __pyx_n_u_x __pyx_string_tab[731]
#define __pyx_n_u_xlim __pyx_string_tab[732]
#define __pyx_n_u_xmax __pyx_string_tab[733]
#define __pyx_n_u_xmin __pyx_string_tab[734]
#define __pyx_n_u_xx __pyx_string_tab[735]
#define __pyx_n_u_y __pyx_string_tab[736]
#define __pyx_n_u_ylim __pyx_string_tab[737]
#define __pyx_n_u_ymax __pyx_string_tab[738]
#define __pyx_n_u_ymin __pyx_string_tab[739]
#define __pyx_n_u_yy __pyx_string_tab[740]
#define __pyx_n_u_zeros __pyx_string_tab[741]
#define __pyx_n_u_zip __pyx_string_tab[742]
#define __pyx_kp_b_T __pyx_string_tab[743]
#define __pyx_kp_b__6 __pyx_string_tab[744]
#define __pyx_kp_b__7 __pyx_string_tab[745]
#define __pyx_kp_b__8 __pyx_string_tab[746]
#define __pyx_kp_b__9 __pyx_string_tab[747]
#define __pyx_kp_b_iso88591_0_B_b_uF_Q_iq_uF_3b_j_2_6_Ky_Rv __pyx_string_tab[748]
#define __pyx_kp_b_iso88591_0_Q_1_31_Q_U_s_A_z_2B_q_t6_2_Zt __pyx_string_tab[749]
#define __pyx_kp_b_iso88591_0_q_0_QQR_5Q_8_11A_t_4vV2_1_Q_1 __pyx_string_tab[750]
#define __pyx_kp_b_iso88591_1 __pyx_string_tab[751]
#define __pyx_kp_b_iso88591_1ARvQawgQ __pyx_string_tab[752]
#define __pyx_kp_b_iso88591_1_2 __pyx_string_tab[753]
#define __pyx_kp_b_iso88591_1_AQ_aq_xq_A __pyx_string_tab[754]
#define __pyx_kp_b_iso88591_1_Ja_IQ_HD_O4q __pyx_string_tab[755]
#define __pyx_kp_b_iso88591_2_B_b_uF_Q_iq_uF_3b_j_q_V1A_KvQ __pyx_string_tab[756]
#define __pyx_kp_b_iso88591_2_D_7_fL_hfJa_0r_q_1IV1_U_3aq_F __pyx_string_tab[757]
#define __pyx_kp_b_iso88591_318_R_vV3a_iq_vV1Cr_j_31_RvQfF __pyx_string_tab[758]
#define __pyx_kp_b_iso88591_31P_q_1_A_7_9G1HAYa_ccdde_t7_a __pyx_string_tab[759]
#define __pyx_kp_b_iso88591_3a __pyx_string_tab[760]
#define __pyx_kp_b_iso88591_3aq_t1_E_E_r_b_E_TU_E_wat1 __pyx_string_tab[761]
#define __pyx_kp_b_iso88591_5Qf_t1A_z_4O1A_1_A_v_q_ayXYYffg __pyx_string_tab[762]
#define __pyx_kp_b_iso88591_9_N_1_iq_1_iq_y_iq_t1HCq_6_s_D __pyx_string_tab[763]
#define __pyx_kp_b_iso88591_A __pyx_string_tab[764]
#define __pyx_kp_b_iso88591_A2_F_5_S_3c_2Q_AQ_aq_5_1_aq_c_iq __pyx_string_tab[765]
#define __pyx_kp_b_iso88591_A_2_Q_b_3j_A_3a_D_A_Qa_q __pyx_string_tab[766]
#define __pyx_kp_b_iso88591_A_2_Qk_1_9Bc_1A_Q_c_T_A_1D_q __pyx_string_tab[767]
#define __pyx_kp_b_iso88591_A_4q __pyx_string_tab[768]
#define __pyx_kp_b_iso88591_A_4q_3a_xs_Bj_A_Q_Bj_j_iijjk_we4 __pyx_string_tab[769]
#define __pyx_kp_b_iso88591_A_4t6_r_4q __pyx_string_tab[770]
#define __pyx_kp_b_iso88591_A_9Cq_a __pyx_string_tab[771]
#define __pyx_kp_b_iso88591_A_9G5_Bk_az_9Bc_1A_Q_c_T_A_9_aq __pyx_string_tab[772]
#define __pyx_kp_b_iso88591_A_A __pyx_string_tab[773]
#define __pyx_kp_b_iso88591_A_F_5_AU_1O2T_wb_fGSTTXX_ddeeggh __pyx_string_tab[774]
#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_awk_awk __pyx_string_tab[775]
#define __pyx_kp_b_iso88591_A_G6 __pyx_string_tab[776]
#define __pyx_kp_b_iso88591_A_QfA_4vS_hd_6_1_5_q_Qd_5_Q_E_E __pyx_string_tab[777]
#define __pyx_kp_b_iso88591_A_S_4_q __pyx_string_tab[778]
#define __pyx_kp_b_iso88591_A_S_4q_q __pyx_string_tab[779]
#define __pyx_kp_b_iso88591_A_b_Q_F_1_F_1_S_d_aq_j_uG4vYV_ff __pyx_string_tab[780]
#define __pyx_kp_b_iso88591_A_gT_ar_5_1_2T_e1Bb_Q_5_1_2T_e1B __pyx_string_tab[781]
#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[782]
#define __pyx_kp_b_iso88591_A_s_1_4q_4xq_a_4q_5_AQ_5_r_Bd_1 __pyx_string_tab[783]
#define __pyx_kp_b_iso88591_A_t5 __pyx_string_tab[784]
#define __pyx_kp_b_iso88591_A_t7_HA __pyx_string_tab[785]
#define __pyx_kp_b_iso88591_A_z_4_1 __pyx_string_tab[786]
#define __pyx_kp_b_iso88591_FfA_1ARvQaq_t1Be7_ar_d_uTUU_ffn __pyx_string_tab[787]
#define __pyx_kp_b_iso88591_HCq __pyx_string_tab[788]
#define __pyx_kp_b_iso88591_J_PQ_1ARvQawgXRvQaq_t1BeSZZ___a __pyx_string_tab[789]
#define __pyx_kp_b_iso88591_N_4z_1A_4xs_D_HCuA_A_A_Gddeeiij __pyx_string_tab[790]
#define __pyx_kp_b_iso88591_Q __pyx_string_tab[791]
#define __pyx_kp_b_iso88591_Q4_uBa_j_RvQfF_A_d_a_uG1_q_9AT __pyx_string_tab[792]
#define __pyx_kp_b_iso88591_UV __pyx_string_tab[793]
#define __pyx_kp_b_iso88591__24 __pyx_string_tab[794]
#define __pyx_kp_b_iso88591__25 __pyx_string_tab[795]
#define __pyx_kp_b_iso88591__26 __pyx_string_tab[796]
#define __pyx_kp_b_iso88591__27 __pyx_string_tab[797]
#define __pyx_kp_b_iso88591_a_A_n_6oQa_1_Q_a_9L_ay_ddeennoo __pyx_string_tab[798]
#define __pyx_kp_b_iso88591_a_D_4vWCr_D_hc_3d_PSSUUZZ___eef __pyx_string_tab[799]
#define __pyx_kp_b_iso88591_a_h_havYgV7_A_1_xq_1_t6_r_iq_ay __pyx_string_tab[800]
#define __pyx_kp_b_iso88591_k_o_jjw_x_A_A_B_a_4z_c_Zq_U_WBb __pyx_string_tab[801]
#define __pyx_kp_b_iso88591_q __pyx_string_tab[802]
#define __pyx_kp_b_iso88591_q_0_kQR_9HAQ_7_1L_a_1 __pyx_string_tab[803]
#define __pyx_kp_b_iso88591_q_a __pyx_string_tab[804]
#define __pyx_kp_b_iso88591_y_4A_1_3avS_c_AV3a_AQ_q_AQ_1_AQ __pyx_string_tab[805]
#define __pyx_n_b_O __pyx_string_tab[806]
#define __pyx_float_0_0 __pyx_number_tab[0]
#define __pyx_float_1_0 __pyx_number_tab[1]
#define __pyx_float_1eneg_5 __pyx_number_tab[2]
#define __pyx_float_1eneg_14 __pyx_number_tab[3]
#define __pyx_int_0 __pyx_number_tab[4]
#define __pyx_int_neg_1 __pyx_number_tab[5]
#define __pyx_int_1 __pyx_number_tab[6]
#define __pyx_int_neg_2 __pyx_number_tab[7]
#define __pyx_int_2 __pyx_number_tab[8]
#define __pyx_int_3 __pyx_number_tab[9]
#define __pyx_int_7 __pyx_number_tab[10]
#define __pyx_int_8 __pyx_number_tab[11]
#define __pyx_int_2046 __pyx_number_tab[12]
#define __pyx_int_136983863 __pyx_number_tab[13]
#define __pyx_int_238750788 __pyx_number_tab[14]
/* #### Code section: module_state_clear ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  if (!clear_module_state) return 0;
  Py_CLEAR(clear_module_state->__pyx_d);
  Py_CLEAR(clear_module_state->__pyx_b);
  Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character);
  Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C_opt_lim_const);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C_opt_lim_const);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C_ConvCodes);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C_ConvCodes);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C_h2mm_model);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C_h2mm_model);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C__h2mm_lims);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C__h2mm_lims);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_defaults);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_defaults);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct____init__);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_4___hash__);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik);
  Py_CLEAR(clear_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr);
  Py_CLEAR(clear_module_state->__pyx_array_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_array);
  Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum);
  Py_CLEAR(clear_module_state->__pyx_memoryview_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview);
  Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type);
  Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice);
  Py_CLEAR(clear_module_state->__pyx_k__15);
  Py_CLEAR(clear_module_state->__pyx_k__16);
  Py_CLEAR(clear_module_state->__pyx_k__17);
  Py_CLEAR(clear_module_state->__pyx_k__18);
  Py_CLEAR(clear_module_state->__pyx_k__19);
  Py_CLEAR(clear_module_state->__pyx_k__21);
  for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  for (int i=0; i<28; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<65; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<807; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<15; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_clear_contents ### */
/* CommonTypesMetaclass.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_CyFunctionType);

/* Generator.module_state_clear */
Py_CLEAR(clear_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_clear_end ### */
return 0;
}
#endif
/* #### Code section: module_state_traverse ### */
#if CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  if (!traverse_module_state) return 0;
  Py_VISIT(traverse_module_state->__pyx_d);
  Py_VISIT(traverse_module_state->__pyx_b);
  Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character);
  Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C_opt_lim_const);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C_opt_lim_const);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C_ConvCodes);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C_ConvCodes);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C_h2mm_model);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C_h2mm_model);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C__h2mm_lims);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C__h2mm_lims);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_defaults);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_defaults);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct____init__);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_4___hash__);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik);
  Py_VISIT(traverse_module_state->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr);
  Py_VISIT(traverse_module_state->__pyx_array_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_array);
  Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum);
  Py_VISIT(traverse_module_state->__pyx_memoryview_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview);
  Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type);
  Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice);
  Py_VISIT(traverse_module_state->__pyx_k__15);
  Py_VISIT(traverse_module_state->__pyx_k__16);
  Py_VISIT(traverse_module_state->__pyx_k__17);
  Py_VISIT(traverse_module_state->__pyx_k__18);
  Py_VISIT(traverse_module_state->__pyx_k__19);
  Py_VISIT(traverse_module_state->__pyx_k__21);
  for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  for (int i=0; i<28; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<65; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<807; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  for (int i=0; i<15; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
/* #### Code section: module_state_traverse_contents ### */
/* CommonTypesMetaclass.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);

/* CythonFunctionShared.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_CyFunctionType);

/* Generator.module_state_traverse */
Py_VISIT(traverse_module_state->__pyx_GeneratorType);

/* #### Code section: module_state_traverse_end ### */
return 0;
}
#endif
/* #### Code section: module_code ### */

/* "H2MM_C.pyx":437
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):             # <<<<<<<<<<<<<<
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_28lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_28lambda3 = {"lambda3", (PyCFunction)__pyx_pw_6H2MM_C_28lambda3, METH_NOARGS, 0};
static PyObject *__pyx_pw_6H2MM_C_28lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_lambda_funcdef_6H2MM_C_lambda3(__pyx_self);

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

static PyObject *__pyx_lambda_funcdef_6H2MM_C_lambda3(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda3", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_stdout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __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;

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

/* "View.MemoryView":129
 *         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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 129, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c));
    }
    __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, 129, __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, 130, __pyx_L3_error)
    } else {

      /* "View.MemoryView":130
 * 
 *     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_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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, 129, __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, 129, __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":129
 *         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;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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_dim;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11[5];
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":135
 *         cdef Py_ssize_t dim
 * 
 *         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, 135, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":136
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
*/
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":138
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->ndim != 0));
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":139
 * 
 *         if not self.ndim:
 *             raise ValueError, "Empty shape tuple for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0);
    __PYX_ERR(1, 139, __pyx_L1_error)

    /* "View.MemoryView":138
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
*/
  }

  /* "View.MemoryView":141
 *             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);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":142
 * 
 *         if itemsize <= 0:
 *             raise ValueError, "itemsize <= 0 for cython.array"             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0);
    __PYX_ERR(1, 142, __pyx_L1_error)

    /* "View.MemoryView":141
 *             raise ValueError, "Empty shape tuple for cython.array"
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "itemsize <= 0 for cython.array"
 * 
*/
  }

  /* "View.MemoryView":144
 *             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_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "View.MemoryView":145
 * 
 *         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_v_format;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":144
 *             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":146
 *         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_4 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_4);
  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":147
 *             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, 147, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":150
 * 
 * 
 *         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":151
 * 
 *         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":153
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  __pyx_t_3 = (!(__pyx_v_self->_shape != 0));
  if (unlikely(__pyx_t_3)) {

    /* "View.MemoryView":154
 * 
 *         if not self._shape:
 *             raise MemoryError, "unable to allocate shape and strides."             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0);
    __PYX_ERR(1, 154, __pyx_L1_error)

    /* "View.MemoryView":153
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError, "unable to allocate shape and strides."
 * 
*/
  }

  /* "View.MemoryView":157
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  __pyx_t_8 = 0;
  __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4);
  __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error)
      #endif
      if (__pyx_t_1 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1));
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1);
    #endif
    ++__pyx_t_1;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __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":158
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    __pyx_t_3 = (__pyx_v_dim <= 0);
    if (unlikely(__pyx_t_3)) {

      /* "View.MemoryView":159
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
*/
      __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis;
      __pyx_t_11[1] = __pyx_t_5;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_;
      __pyx_t_11[3] = __pyx_t_10;
      __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2;
      __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127);
      if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(1, 159, __pyx_L1_error)

      /* "View.MemoryView":158
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim
*/
    }

    /* "View.MemoryView":160
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
*/
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":157
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError, f"Invalid shape in axis {idx}: {dim}."
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "View.MemoryView":163
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "View.MemoryView":164
 *         cdef char order
 *         if mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         elif mode == 'fortran':
*/
    __pyx_v_order = 'C';

    /* "View.MemoryView":165
 *         if mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         elif mode == 'fortran':
 *             order = b'F'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c;

    /* "View.MemoryView":163
 * 
 *         cdef char order
 *         if mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":166
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error)
  if (likely(__pyx_t_3)) {

    /* "View.MemoryView":167
 *             self.mode = u'c'
 *         elif mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         else:
*/
    __pyx_v_order = 'F';

    /* "View.MemoryView":168
 *         elif mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran;

    /* "View.MemoryView":166
 *             order = b'C'
 *             self.mode = u'c'
 *         elif mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
*/
    goto __pyx_L11;
  }

  /* "View.MemoryView":170
 *             self.mode = u'fortran'
 *         else:
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(1, 170, __pyx_L1_error)
  }
  __pyx_L11:;

  /* "View.MemoryView":172
 *             raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)             # <<<<<<<<<<<<<<
 * 
 *         self.free_data = allocate_buffer
*/
  __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":174
 *         self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 * 
*/
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":175
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 * 
 *         if allocate_buffer:
*/
  __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_3;

  /* "View.MemoryView":177
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  if (__pyx_v_allocate_buffer) {

    /* "View.MemoryView":178
 * 
 *         if allocate_buffer:
 *             _allocate_buffer(self)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error)

    /* "View.MemoryView":177
 *         self.dtype_is_object = format == b'O'
 * 
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 *             _allocate_buffer(self)
 * 
*/
  }

  /* "View.MemoryView":129
 *         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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __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":180
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  char *__pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__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":182
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":
*/
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":183
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":184
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             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_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":185
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             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":184
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
 *             if self.mode == u"c":             # <<<<<<<<<<<<<<
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *             elif self.mode == u"fortran":
*/
      goto __pyx_L4;
    }

    /* "View.MemoryView":186
 *             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_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":187
 *                 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":186
 *             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_L4:;

    /* "View.MemoryView":188
 *             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));
    if (unlikely(__pyx_t_1)) {

      /* "View.MemoryView":189
 *                 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_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0);
      __PYX_ERR(1, 189, __pyx_L1_error)

      /* "View.MemoryView":188
 *             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":183
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *             if self.mode == u"c":
 *                 bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
  }

  /* "View.MemoryView":190
 *             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_2 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_2;

  /* "View.MemoryView":191
 *                 raise ValueError, "Can only create a buffer that is contiguous in memory."
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  __pyx_t_3 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_3;

  /* "View.MemoryView":193
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":194
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *             info.shape = self._shape
 *             info.strides = self._strides
*/
    __pyx_t_4 = __pyx_v_self->ndim;
    __pyx_v_info->ndim = __pyx_t_4;

    /* "View.MemoryView":195
 *         if flags & PyBUF_STRIDES:
 *             info.ndim = self.ndim
 *             info.shape = self._shape             # <<<<<<<<<<<<<<
 *             info.strides = self._strides
 *         else:
*/
    __pyx_t_5 = __pyx_v_self->_shape;
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":196
 *             info.ndim = self.ndim
 *             info.shape = self._shape
 *             info.strides = self._strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.ndim = 1
*/
    __pyx_t_5 = __pyx_v_self->_strides;
    __pyx_v_info->strides = __pyx_t_5;

    /* "View.MemoryView":193
 *         info.len = self.len
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.ndim = self.ndim
 *             info.shape = self._shape
*/
    goto __pyx_L6;
  }

  /* "View.MemoryView":198
 *             info.strides = self._strides
 *         else:
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL
*/
  /*else*/ {
    __pyx_v_info->ndim = 1;

    /* "View.MemoryView":199
 *         else:
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL             # <<<<<<<<<<<<<<
 *             info.strides = NULL
 * 
*/
    __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
    if (__pyx_t_1) {
      __pyx_t_5 = (&__pyx_v_self->len);
    } else {
      __pyx_t_5 = NULL;
    }
    __pyx_v_info->shape = __pyx_t_5;

    /* "View.MemoryView":200
 *             info.ndim = 1
 *             info.shape = &self.len if flags & PyBUF_ND else NULL
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.suboffsets = NULL
*/
    __pyx_v_info->strides = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":202
 *             info.strides = NULL
 * 
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
*/
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":203
 * 
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
*/
  __pyx_t_3 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "View.MemoryView":204
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self
*/
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":205
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
*/
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {
    __pyx_t_2 = __pyx_v_self->format;
  } else {
    __pyx_t_2 = NULL;
  }
  __pyx_v_info->format = __pyx_t_2;

  /* "View.MemoryView":206
 *         info.readonly = 0
 *         info.format = self.format if flags & PyBUF_FORMAT else NULL
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
*/
  __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":180
 *             _allocate_buffer(self)
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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":208
 *         info.obj = self
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {
  int __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":209
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":210
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
*/
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":209
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":211
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  if (__pyx_v_self->free_data) {
  } else {
    __pyx_t_1 = __pyx_v_self->free_data;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->data != NULL);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":212
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":213
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)             # <<<<<<<<<<<<<<
 *             free(self.data)
 *         PyObject_Free(self._shape)
*/
      __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":212
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
*/
    }

    /* "View.MemoryView":214
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
*/
    free(__pyx_v_self->data);

    /* "View.MemoryView":211
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data and self.data is not NULL:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":215
 *                 refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":208
 *         info.obj = self
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
*/

  /* function exit code */
}

/* "View.MemoryView":217
 *         PyObject_Free(self._shape)
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":219
 *     @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, 219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":217
 *         PyObject_Free(self._shape)
 * 
 *     @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":221
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

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;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":223
 *     @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":224
 *     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_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":221
 *         return self.get_memview()
 * 
 *     @cname('get_memview')             # <<<<<<<<<<<<<<
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/

  /* 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.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":226
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;

  /* "View.MemoryView":227
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
*/
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":226
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":229
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":230
 * 
 *     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_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __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, 230, __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":229
 *         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":232
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":233
 * 
 *     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_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __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, 233, __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":232
 *         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":235
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":236
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __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, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":235
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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":245
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_i;
  PyObject **__pyx_v_p;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":252
 *     cdef PyObject **p
 * 
 *     self.free_data = True             # <<<<<<<<<<<<<<
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
*/
  __pyx_v_self->free_data = 1;

  /* "View.MemoryView":253
 * 
 *     self.free_data = True
 *     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":254
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->data != 0));
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":255
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:
 *         raise MemoryError, "unable to allocate array data."             # <<<<<<<<<<<<<<
 * 
 *     if self.dtype_is_object:
*/
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0);
    __PYX_ERR(1, 255, __pyx_L1_error)

    /* "View.MemoryView":254
 *     self.free_data = True
 *     self.data = <char *>malloc(self.len)
 *     if not self.data:             # <<<<<<<<<<<<<<
 *         raise MemoryError, "unable to allocate array data."
 * 
*/
  }

  /* "View.MemoryView":257
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  if (__pyx_v_self->dtype_is_object) {

    /* "View.MemoryView":258
 * 
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
*/
    __pyx_v_p = ((PyObject **)__pyx_v_self->data);

    /* "View.MemoryView":259
 *     if self.dtype_is_object:
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):             # <<<<<<<<<<<<<<
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
*/
    if (unlikely(__pyx_v_self->itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 259, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1)  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 259, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 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;

      /* "View.MemoryView":260
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None             # <<<<<<<<<<<<<<
 *             Py_INCREF(Py_None)
 *     return 0
*/
      (__pyx_v_p[__pyx_v_i]) = Py_None;

      /* "View.MemoryView":261
 *         for i in range(self.len // self.itemsize):
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
      Py_INCREF(Py_None);
    }

    /* "View.MemoryView":257
 *         raise MemoryError, "unable to allocate array data."
 * 
 *     if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *         p = <PyObject **> self.data
 *         for i in range(self.len // self.itemsize):
*/
  }

  /* "View.MemoryView":262
 *             p[i] = Py_None
 *             Py_INCREF(Py_None)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":245
 *         pass
 * 
 * @cname("__pyx_array_allocate_buffer")             # <<<<<<<<<<<<<<
 * cdef int _allocate_buffer(array self) except -1:
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":265
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_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 const *__pyx_v_c_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  PyObject *__pyx_v_mode = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":268
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.             # <<<<<<<<<<<<<<
 * 
 *     if buf is NULL:
*/
  __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f');
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c);
    __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c;
  }
  __pyx_v_mode = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":270
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
  __pyx_t_2 = (__pyx_v_buf == NULL);
  if (__pyx_t_2) {

    /* "View.MemoryView":271
 * 
 *     if buf is NULL:
 *         result = array.__new__(array, shape, itemsize, format, mode)             # <<<<<<<<<<<<<<
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
*/
    __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":270
 *     cdef str mode = "fortran" if c_mode[0] == b'f' else "c"  # this often comes from a constant C string.
 * 
 *     if buf is NULL:             # <<<<<<<<<<<<<<
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":273
 *         result = array.__new__(array, shape, itemsize, format, mode)
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
*/
  /*else*/ {
    __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_mode);
    __Pyx_GIVEREF(__pyx_v_mode);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":274
 *     else:
 *         result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":276
 *         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":265
 * 
 * 
 * @cname("__pyx_array_new")             # <<<<<<<<<<<<<<
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf):
 *     cdef array result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":302
 * 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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 302, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 302, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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 */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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":303
 *     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":302
 * 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":304
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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":305
 *         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":304
 *     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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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 and _dict:
*/
  __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);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error);
  __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 and _dict:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_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 and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error);
    __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 and _dict:
 *         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 and _dict:             # <<<<<<<<<<<<<<
 *         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), 0x82a3537, None), state
*/
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error)
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = ('self.name is not None',)
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = ('self.name is not None',)
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_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))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __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), 0x82a3537, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, 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_mstate_global->__pyx_n_u_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))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __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), 0x82a3537, 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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(1, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __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;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, 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_XDECREF(__pyx_t_2);
  __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":348
 *     cdef const __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;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 348, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __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, 348, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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 */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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;
  Py_intptr_t __pyx_t_4;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":349
 * 
 *     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":350
 *     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:
 *             PyObject_GetBuffer(obj, &self.view, flags)
*/
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":351
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_obj != Py_None);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":352
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
*/
    __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error)

    /* "View.MemoryView":353
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_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);
    if (__pyx_t_1) {

      /* "View.MemoryView":354
 *             PyObject_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":355
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
*/
      Py_INCREF(Py_None);

      /* "View.MemoryView":353
 *         if type(self) is memoryview or obj is not None:
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
*/
    }

    /* "View.MemoryView":351
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             PyObject_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
*/
  }

  /* "View.MemoryView":357
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED());
  if (__pyx_t_1) {

    /* "View.MemoryView":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L9_bool_binop_done;
    }

    /* "View.MemoryView":361
 *             if (__pyx_memoryview_thread_locks_used < 8 and
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):             # <<<<<<<<<<<<<<
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
*/
    __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING());
    __pyx_t_1 = __pyx_t_2;
    __pyx_L9_bool_binop_done:;

    /* "View.MemoryView":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    if (__pyx_t_1) {

      /* "View.MemoryView":362
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 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":363
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
 *                 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":359
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and             # <<<<<<<<<<<<<<
 * 
 *                     not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()):
*/
    }

    /* "View.MemoryView":364
 *                 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);
    if (__pyx_t_1) {

      /* "View.MemoryView":365
 *                 __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":366
 *             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);
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":367
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
        PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error)

        /* "View.MemoryView":366
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
*/
      }

      /* "View.MemoryView":364
 *                 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":357
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if (__pyx_memoryview_thread_locks_used < 8 and
*/
  }

  /* "View.MemoryView":369
 *                     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":370
 * 
 *         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');
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00');
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":369
 *                     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_L13;
  }

  /* "View.MemoryView":372
 *             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             # <<<<<<<<<<<<<<
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
*/
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L13:;

  /* "View.MemoryView":374
 *             self.dtype_is_object = dtype_is_object
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0             # <<<<<<<<<<<<<<
 *         self.typeinfo = NULL
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count)));
    __pyx_t_5 = (sizeof(__pyx_atomic_int_type));
    if (unlikely(__pyx_t_5 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(1, 374, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(1, 374, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error)
  #endif

  /* "View.MemoryView":375
 * 
 *         assert <Py_intptr_t><void*>(&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
*/
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":348
 *     cdef const __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":377
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyThread_type_lock __pyx_t_5;
  PyThread_type_lock __pyx_t_6;

  /* "View.MemoryView":378
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":379
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)             # <<<<<<<<<<<<<<
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
*/
    PyBuffer_Release((&__pyx_v_self->view));

    /* "View.MemoryView":378
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":380
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":382
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
 *             Py_DECREF(Py_None)
 * 
*/
    ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;

    /* "View.MemoryView":383
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
*/
    Py_DECREF(Py_None);

    /* "View.MemoryView":380
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
*/
  }
  __pyx_L3:;

  /* "View.MemoryView":387
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  __pyx_t_1 = (__pyx_v_self->lock != NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":388
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
*/
    __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING();
    if (__pyx_t_1) {
      __pyx_t_2 = 0;
    } else {
      __pyx_t_2 = __pyx_memoryview_thread_locks_used;
    }
    __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":389
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __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_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock);
      if (__pyx_t_1) {

        /* "View.MemoryView":390
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __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":391
 *                 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_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used);
        if (__pyx_t_1) {

          /* "View.MemoryView":393
 *                     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_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":392
 *                     __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_5;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;

          /* "View.MemoryView":391
 *                 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":394
 *                         __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":389
 *         if self.lock != NULL:
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __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":396
 *                     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":387
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
*/
  }

  /* "View.MemoryView":377
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             PyBuffer_Release(&self.view)
*/

  /* function exit code */
}

/* "View.MemoryView":398
 *                 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":400
 *     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":402
 *         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, 402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_3;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3));
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3);
        #endif
        ++__pyx_t_3;
      }
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error)
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error)
          PyErr_Clear();
        }
        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":403
 * 
 *         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, 403, __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 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":402
 *         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":405
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":398
 *                 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":408
 * 
 * 
 *     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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":409
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  if (__pyx_t_1) {

    /* "View.MemoryView":410
 *     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":409
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
*/
  }

  /* "View.MemoryView":412
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
*/
  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __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_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 412, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_indices = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "View.MemoryView":415
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "View.MemoryView":416
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":415
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
*/
  }

  /* "View.MemoryView":418
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
*/
  /*else*/ {
    __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_5;

    /* "View.MemoryView":419
 *         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_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":408
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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":421
 *             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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":422
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  if (unlikely(__pyx_v_self->view.readonly)) {

    /* "View.MemoryView":423
 *     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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0);
    __PYX_ERR(1, 423, __pyx_L1_error)

    /* "View.MemoryView":422
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
*/
  }

  /* "View.MemoryView":425
 *             raise TypeError, "Cannot assign to read-only memoryview"
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
*/
  __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(1, 425, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":427
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":428
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)
*/
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "View.MemoryView":429
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
    __pyx_t_4 = (__pyx_v_obj != Py_None);
    if (__pyx_t_4) {

      /* "View.MemoryView":430
 *             obj = self.is_slice(value)
 *             if obj is not None:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
*/
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __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;

      /* "View.MemoryView":429
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj is not None:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":432
 *                 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_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __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;
    }
    __pyx_L5:;

    /* "View.MemoryView":427
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj is not None:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":434
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
*/
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "View.MemoryView":421
 *             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_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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":436
 *             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;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":437
 * 
 *     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_mstate_global->__pyx_memoryview_type); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "View.MemoryView":438
 *     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":439
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
*/
        __pyx_t_7 = NULL;
        __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "View.MemoryView":440
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
*/
        __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error)
          __Pyx_GOTREF((PyObject *)__pyx_t_6);
        }
        __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "View.MemoryView":438
 *     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;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "View.MemoryView":441
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
      if (__pyx_t_11) {
        __Pyx_ErrRestore(0,0,0);

        /* "View.MemoryView":442
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;

      /* "View.MemoryView":438
 *     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_L6_except_error:;
      __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":437
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
*/
  }

  /* "View.MemoryView":444
 *                 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":436
 *             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_XDECREF(__pyx_t_9);
  __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":446
 *         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;
  __Pyx_memviewslice __pyx_v_msrc;
  __Pyx_memviewslice __pyx_v_mdst;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":449
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
*/
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error)
  __pyx_v_msrc = (__pyx_t_1[0]);

  /* "View.MemoryView":450
 *         cdef __Pyx_memviewslice src_slice
 *         cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]             # <<<<<<<<<<<<<<
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
*/
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error)
  __pyx_v_mdst = (__pyx_t_1[0]);

  /* "View.MemoryView":452
 *         cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
 * 
 *         memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error)

  /* "View.MemoryView":446
 *         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_2);
  __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":454
 *         memoryview_copy_contents(msrc, mdst, 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[128];
  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
  __Pyx_memviewslice *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":456
 *     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":461
 *         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_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error)
  __pyx_v_dst_slice = __pyx_t_1;

  /* "View.MemoryView":463
 *         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_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
  if (__pyx_t_2) {

    /* "View.MemoryView":464
 * 
 *         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":465
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    __pyx_t_2 = (__pyx_v_tmp == NULL);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":466
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
*/
      PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error)

      /* "View.MemoryView":465
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
*/
    }

    /* "View.MemoryView":467
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
*/
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":463
 *         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":469
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
*/
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":471
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
*/
  /*try:*/ {

    /* "View.MemoryView":472
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
    if (__pyx_v_self->dtype_is_object) {

      /* "View.MemoryView":473
 *         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":472
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
*/
      goto __pyx_L8;
    }

    /* "View.MemoryView":475
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    /*else*/ {
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":479
 * 
 * 
 *             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_2 = (__pyx_v_self->view.suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":480
 * 
 *             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_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error)

      /* "View.MemoryView":479
 * 
 * 
 *             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":481
 *             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":484
 *                                 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_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __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_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":454
 *         memoryview_copy_contents(msrc, mdst, 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_3);
  __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":486
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":487
 * 
 *     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 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":488
 *     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, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":486
 *             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":490
 *         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;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":493
 *         """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_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":496
 *         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, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":497
 * 
 *         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":498
 *         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_v_struct;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":497
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    }

    /* "View.MemoryView":502
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
    /*else:*/ {
      __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error)
      __pyx_t_9 = (__pyx_t_8 == 1);
      if (__pyx_t_9) {

        /* "View.MemoryView":503
 *         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_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __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":502
 *             raise ValueError, "Unable to convert item to object"
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
*/
      }

      /* "View.MemoryView":504
 *             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;

    /* "View.MemoryView":499
 *         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_6, &__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5);
    __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0;
    if (__pyx_t_11) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_1);

      /* "View.MemoryView":500
 *             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_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0);
      __PYX_ERR(1, 500, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "View.MemoryView":497
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
*/
    __pyx_L5_except_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":490
 *         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_10);
  __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":506
 *             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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":509
 *         """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_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":514
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
  __pyx_t_3 = PyTuple_Check(__pyx_v_value); 
  if (__pyx_t_3) {

    /* "View.MemoryView":515
 * 
 *         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_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __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, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __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, 515, __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, 515, __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) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":514
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":517
 *             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_v_struct;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":519
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
  __pyx_t_8 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(1, 519, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_9 = __pyx_v_bytesvalue;
  __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error)
  __pyx_t_13 = (__pyx_t_11 + __pyx_t_12);
  for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_10 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_10[0]);

    /* "View.MemoryView":520
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    __pyx_v_i = __pyx_t_8;

    /* "View.MemoryView":519
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
*/
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":520
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
*/
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "View.MemoryView":506
 *             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_9);
  __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":522
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t *__pyx_t_3;
  char *__pyx_t_4;
  void *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__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":524
 *     @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_1 = __pyx_v_self->view.readonly;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":525
 *     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_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0);
    __PYX_ERR(1, 525, __pyx_L1_error)

    /* "View.MemoryView":524
 *     @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":527
 *             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":528
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_3;

    /* "View.MemoryView":527
 *             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":530
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
*/
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":532
 *             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":533
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_3;

    /* "View.MemoryView":532
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
*/
    goto __pyx_L7;
  }

  /* "View.MemoryView":535
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
*/
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L7:;

  /* "View.MemoryView":537
 *             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":538
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
*/
    __pyx_t_3 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_3;

    /* "View.MemoryView":537
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
*/
    goto __pyx_L8;
  }

  /* "View.MemoryView":540
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
*/
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L8:;

  /* "View.MemoryView":542
 *             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":543
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
*/
    __pyx_t_4 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":542
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
*/
    goto __pyx_L9;
  }

  /* "View.MemoryView":545
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
*/
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L9:;

  /* "View.MemoryView":547
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
*/
  __pyx_t_5 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_5;

  /* "View.MemoryView":548
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
*/
  __pyx_t_6 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":549
 *         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_7 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_7;

  /* "View.MemoryView":550
 *         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_7 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_7;

  /* "View.MemoryView":551
 *         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":552
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __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":522
 *             itemp[i] = c
 * 
 *     @cname('getbuffer')             # <<<<<<<<<<<<<<
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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":555
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":557
 *     @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, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":558
 *     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)-1))) __PYX_ERR(1, 558, __pyx_L1_error)

  /* "View.MemoryView":559
 *         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":555
 * 
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
*/

  /* 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":561
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":563
 *     @property
 *     def base(self):
 *         return self._get_base()             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":561
 *         return result
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def base(self):
 *         return self._get_base()
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":565
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":566
 * 
 *     cdef _get_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":565
 *         return self._get_base()
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
*/

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

/* "View.MemoryView":568
 *         return self.obj
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_7genexpr__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":570
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __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_7genexpr__pyx_v_length = (__pyx_t_2[0]);
      __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  } /* exit inner scope */
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __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":568
 *         return self.obj
 * 
 *     @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":572
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_8genexpr1__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":574
 *     @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);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":576
 *         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_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0);
    __PYX_ERR(1, 576, __pyx_L1_error)

    /* "View.MemoryView":574
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError, "Buffer view does not expose strides"
*/
  }

  /* "View.MemoryView":578
 *             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);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __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_8genexpr1__pyx_v_stride = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __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":572
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 *     @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":580
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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_8genexpr2__pyx_v_suboffset;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":582
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
  if (__pyx_t_1) {

    /* "View.MemoryView":583
 *     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_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":582
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
*/
  }

  /* "View.MemoryView":585
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  } /* exit inner scope */
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __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":580
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __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":587
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":589
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":587
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 * 
 *     @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":591
 *         return self.view.ndim
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":593
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":591
 *         return self.view.ndim
 * 
 *     @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":595
 *         return self.view.itemsize
 * 
 *     @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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":597
 *     @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_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __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, 597, __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":595
 *         return self.view.itemsize
 * 
 *     @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":599
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

/* 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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":601
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":602
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
    __pyx_v_result = __pyx_mstate_global->__pyx_int_1;

    /* "View.MemoryView":604
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
*/
    __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_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "View.MemoryView":605
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
*/
      __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "View.MemoryView":607
 *                 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":601
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
*/
  }

  /* "View.MemoryView":609
 *             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":599
 *         return self.size * self.view.itemsize
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def size(self):
 *         if self._size is None:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __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":611
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  int __pyx_t_1;

  /* "View.MemoryView":612
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
  if (__pyx_t_1) {

    /* "View.MemoryView":613
 *     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":612
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
*/
  }

  /* "View.MemoryView":615
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":611
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":617
 *         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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_4[5];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":618
 * 
 *     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_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __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_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":619
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3;

  /* "View.MemoryView":618
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
*/
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":617
 *         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":621
 *                                                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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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;
  PyObject *__pyx_t_3[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":622
 * 
 *     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_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __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_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of;
  __pyx_t_3[1] = __pyx_t_2;
  __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object_2;
  __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2));
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __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":621
 *                                                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":625
 * 
 * 
 *     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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_c_contig", __pyx_kwds); return NULL;}
  __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
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":628
 *         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_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":629
 *         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_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":625
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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":631
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_f_contig", __pyx_kwds); return NULL;}
  __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
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":634
 *         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_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":635
 *         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_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":631
 *         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_2);
  __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":637
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":639
 *     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":641
 *         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":642
 * 
 *         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), __pyx_k_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, 642, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":647
 *                                    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, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":637
 *         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":649
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_fortran", __pyx_kwds); return NULL;}
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":651
 *     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":653
 *         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":654
 * 
 *         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), __pyx_k_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, 654, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":659
 *                                 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, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":649
 *         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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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":662
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
*/

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__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;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":664
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":665
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __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":666
 *     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":662
 * 
 * 
 * @cname('__pyx_memoryview_new')             # <<<<<<<<<<<<<<
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, 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_XDECREF(__pyx_t_4);
  __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":668
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":670
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":668
 *     return result
 * 
 * @cname('__pyx_memoryview_check')             # <<<<<<<<<<<<<<
 * cdef inline bint memoryview_check(object o) noexcept:
 *     return isinstance(o, memoryview)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":672
 *     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) {
  Py_ssize_t __pyx_v_idx;
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6[3];
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":678
 *     """
 *     cdef Py_ssize_t idx
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)             # <<<<<<<<<<<<<<
 * 
 *     result = [slice(None)] * ndim
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_index); 
  if (__pyx_t_2) {
    __Pyx_INCREF(((PyObject*)__pyx_v_index));
    __pyx_t_1 = __pyx_v_index;
  } else {
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_v_tup = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":680
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error);
    }
  }
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":681
 * 
 *     result = [slice(None)] * ndim
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     idx = 0
*/
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":682
 *     result = [slice(None)] * ndim
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     idx = 0
 *     for item in tup:
*/
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":683
 *     have_slices = False
 *     seen_ellipsis = False
 *     idx = 0             # <<<<<<<<<<<<<<
 *     for item in tup:
 *         if item is Ellipsis:
*/
  __pyx_v_idx = 0;

  /* "View.MemoryView":684
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  if (unlikely(__pyx_v_tup == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 684, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error)
      #endif
      if (__pyx_t_4 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4);
    #endif
    ++__pyx_t_4;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":685
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    if (__pyx_t_2) {

      /* "View.MemoryView":686
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
      if (__pyx_t_2) {

        /* "View.MemoryView":687
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             have_slices = True
*/
        if (unlikely(__pyx_v_tup == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(1, 687, __pyx_L1_error)
        }
        __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error)
        __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5));

        /* "View.MemoryView":688
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
*/
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":686
 *     for item in tup:
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
*/
      }

      /* "View.MemoryView":689
 *                 idx += ndim - len(tup)
 *                 seen_ellipsis = True
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if isinstance(item, slice):
*/
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":685
 *     idx = 0
 *     for item in tup:
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 idx += ndim - len(tup)
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":691
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      if (__pyx_t_2) {

        /* "View.MemoryView":692
 *         else:
 *             if isinstance(item, slice):
 *                 have_slices = True             # <<<<<<<<<<<<<<
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
*/
        __pyx_v_have_slices = 1;

        /* "View.MemoryView":691
 *             have_slices = True
 *         else:
 *             if isinstance(item, slice):             # <<<<<<<<<<<<<<
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
*/
        goto __pyx_L7;
      }

      /* "View.MemoryView":693
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0));
      if (unlikely(__pyx_t_2)) {

        /* "View.MemoryView":694
 *                 have_slices = True
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"             # <<<<<<<<<<<<<<
 *             result[idx] = item
 *         idx += 1
*/
        __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type;
        __pyx_t_6[1] = __pyx_t_3;
        __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4;
        __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(1, 694, __pyx_L1_error)

        /* "View.MemoryView":693
 *             if isinstance(item, slice):
 *                 have_slices = True
 *             elif not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
*/
      }
      __pyx_L7:;

      /* "View.MemoryView":695
 *             elif not PyIndex_Check(item):
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item             # <<<<<<<<<<<<<<
 *         idx += 1
 * 
*/
      if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "View.MemoryView":696
 *                 raise TypeError, f"Cannot index with type '{type(item)}'"
 *             result[idx] = item
 *         idx += 1             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - idx
*/
    __pyx_v_idx = (__pyx_v_idx + 1);

    /* "View.MemoryView":684
 *     seen_ellipsis = False
 *     idx = 0
 *     for item in tup:             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":698
 *         idx += 1
 * 
 *     nslices = ndim - idx             # <<<<<<<<<<<<<<
 *     return have_slices or nslices, tuple(result)
 * 
*/
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx);

  /* "View.MemoryView":699
 * 
 *     nslices = ndim - idx
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_L9_bool_binop_done:;
  __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_7);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_7 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":672
 *     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_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __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_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":701
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  int __pyx_r;
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":702
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     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":703
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    __pyx_t_4 = (__pyx_v_suboffset >= 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":704
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"             # <<<<<<<<<<<<<<
 *     return 0  # return type just used as an error flag
 * 
*/
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0);
      __PYX_ERR(1, 704, __pyx_L1_error)

      /* "View.MemoryView":703
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag
*/
    }
  }

  /* "View.MemoryView":705
 *         if suboffset >= 0:
 *             raise ValueError, "Indirect dimensions not supported"
 *     return 0  # return type just used as an error flag             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":701
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":711
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

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;
  Py_ssize_t __pyx_v_cindex;
  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;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_3;
  char *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":713
 * @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":720
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
*/
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":724
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_1 = (__pyx_v_memview->view.ndim > 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
      __PYX_ERR(1, 724, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error)
  #endif

  /* "View.MemoryView":726
 *     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_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":727
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error)
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":728
 *     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":726
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":730
 *         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":731
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":737
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
*/
  __pyx_t_3 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_3;

  /* "View.MemoryView":738
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_4;

  /* "View.MemoryView":743
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step, cindex
*/
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":744
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step, cindex
 *     cdef bint have_start, have_stop, have_step
*/
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_6;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error)
          #endif
          if (__pyx_t_6 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6));
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6);
        #endif
        ++__pyx_t_6;
      }
      if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error)
    } else {
      __pyx_t_8 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_8)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_v_dim = __pyx_t_5;
    __pyx_t_5 = (__pyx_t_5 + 1);

    /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
    __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":750
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             cindex = index             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
*/
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error)
      __pyx_v_cindex = __pyx_t_9;

      /* "View.MemoryView":751
 *         if PyIndex_Check(index):
 *             cindex = 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_10 = __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_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error)

      /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             cindex = index
 *             slice_memviewslice(
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":757
 *                 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_1 = (__pyx_v_index == Py_None);
    if (__pyx_t_1) {

      /* "View.MemoryView":758
 *                 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":759
 *         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":760
 *             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":761
 *             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":757
 *                 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":763
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
*/
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_9;

      /* "View.MemoryView":764
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_9;

      /* "View.MemoryView":765
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error)
        __pyx_t_9 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_9 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_9;

      /* "View.MemoryView":767
 *             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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":768
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":769
 *             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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = (__pyx_t_8 != Py_None);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":771
 *             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_10 = __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_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error)

      /* "View.MemoryView":777
 *                 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":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             cindex = index
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":779
 *             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_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":780
 * 
 *     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":781
 *     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, 781, __pyx_L1_error) }

    /* "View.MemoryView":782
 *         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, 782, __pyx_L1_error) }

    /* "View.MemoryView":780
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
*/
    __pyx_t_2 = __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_2)) __PYX_ERR(1, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":779
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
*/
  }

  /* "View.MemoryView":785
 *                                     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":786
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "View.MemoryView":785
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
*/
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":711
 * 
 * 
 * @cname('__pyx_memview_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __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":793
 * 
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')             # <<<<<<<<<<<<<<
 * cdef int slice_memviewslice(
 *         __Pyx_memviewslice *dst,
*/

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":814
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
*/
  __pyx_t_1 = (!__pyx_v_is_slice);
  if (__pyx_t_1) {

    /* "View.MemoryView":816
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
*/
    __pyx_t_1 = (__pyx_v_start < 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":817
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
*/
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":816
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
*/
    }

    /* "View.MemoryView":818
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_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);
    if (__pyx_t_2) {

      /* "View.MemoryView":819
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
*/
      __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error)

      /* "View.MemoryView":818
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
*/
    }

    /* "View.MemoryView":814
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":822
 *     else:
 * 
 *         if have_step:             # <<<<<<<<<<<<<<
 *             negative_step = step < 0
 *             if step == 0:
*/
  /*else*/ {
    __pyx_t_2 = (__pyx_v_have_step != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":823
 * 
 *         if have_step:
 *             negative_step = step < 0             # <<<<<<<<<<<<<<
 *             if step == 0:
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
*/
      __pyx_v_negative_step = (__pyx_v_step < 0);

      /* "View.MemoryView":824
 *         if have_step:
 *             negative_step = step < 0
 *             if step == 0:             # <<<<<<<<<<<<<<
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
*/
      __pyx_t_2 = (__pyx_v_step == 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":825
 *             negative_step = step < 0
 *             if step == 0:
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             negative_step = False
*/
        __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error)

        /* "View.MemoryView":824
 *         if have_step:
 *             negative_step = step < 0
 *             if step == 0:             # <<<<<<<<<<<<<<
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
*/
      }

      /* "View.MemoryView":822
 *     else:
 * 
 *         if have_step:             # <<<<<<<<<<<<<<
 *             negative_step = step < 0
 *             if step == 0:
*/
      goto __pyx_L6;
    }

    /* "View.MemoryView":827
 *                 _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
 *         else:
 *             negative_step = False             # <<<<<<<<<<<<<<
 *             step = 1
 * 
*/
    /*else*/ {
      __pyx_v_negative_step = 0;

      /* "View.MemoryView":828
 *         else:
 *             negative_step = False
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_step = 1;
    }
    __pyx_L6:;

    /* "View.MemoryView":831
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
*/
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":832
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
*/
      __pyx_t_2 = (__pyx_v_start < 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":833
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
*/
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":834
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
*/
        __pyx_t_2 = (__pyx_v_start < 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":835
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
*/
          __pyx_v_start = 0;

          /* "View.MemoryView":834
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
*/
        }

        /* "View.MemoryView":832
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
*/
        goto __pyx_L9;
      }

      /* "View.MemoryView":836
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
*/
      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
      if (__pyx_t_2) {

        /* "View.MemoryView":837
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
*/
        if (__pyx_v_negative_step) {

          /* "View.MemoryView":838
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
*/
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":837
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
*/
          goto __pyx_L11;
        }

        /* "View.MemoryView":840
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
*/
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L11:;

        /* "View.MemoryView":836
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
*/
      }
      __pyx_L9:;

      /* "View.MemoryView":831
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
*/
      goto __pyx_L8;
    }

    /* "View.MemoryView":842
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
*/
    /*else*/ {
      if (__pyx_v_negative_step) {

        /* "View.MemoryView":843
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
*/
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":842
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
*/
        goto __pyx_L12;
      }

      /* "View.MemoryView":845
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
*/
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L12:;
    }
    __pyx_L8:;

    /* "View.MemoryView":847
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
*/
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":848
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
*/
      __pyx_t_2 = (__pyx_v_stop < 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":849
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
*/
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":850
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
*/
        __pyx_t_2 = (__pyx_v_stop < 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":851
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
*/
          __pyx_v_stop = 0;

          /* "View.MemoryView":850
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
*/
        }

        /* "View.MemoryView":848
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
*/
        goto __pyx_L14;
      }

      /* "View.MemoryView":852
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
*/
      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
      if (__pyx_t_2) {

        /* "View.MemoryView":853
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
*/
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":852
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
*/
      }
      __pyx_L14:;

      /* "View.MemoryView":847
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
*/
      goto __pyx_L13;
    }

    /* "View.MemoryView":855
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
*/
    /*else*/ {
      if (__pyx_v_negative_step) {

        /* "View.MemoryView":856
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
*/
        __pyx_v_stop = -1L;

        /* "View.MemoryView":855
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
*/
        goto __pyx_L16;
      }

      /* "View.MemoryView":858
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 * 
*/
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L16:;
    }
    __pyx_L13:;

    /* "View.MemoryView":862
 * 
 *         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":864
 *             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":865
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
*/
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":864
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
*/
    }

    /* "View.MemoryView":867
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
*/
    __pyx_t_2 = (__pyx_v_new_shape < 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":868
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":867
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
*/
    }

    /* "View.MemoryView":871
 * 
 * 
 *         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":872
 * 
 *         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":873
 *         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":876
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
*/
  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":877
 * 
 *     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":876
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
*/
    goto __pyx_L19;
  }

  /* "View.MemoryView":879
 *         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_L19:;

  /* "View.MemoryView":881
 *         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);
  if (__pyx_t_2) {

    /* "View.MemoryView":882
 * 
 *     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);
    if (__pyx_t_2) {

      /* "View.MemoryView":883
 *     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);
      if (__pyx_t_2) {

        /* "View.MemoryView":884
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "
*/
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":883
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
*/
        goto __pyx_L22;
      }

      /* "View.MemoryView":886
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
*/
      /*else*/ {

        /* "View.MemoryView":887
 *             else:
 *                 _err_dim(PyExc_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(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error)
      }
      __pyx_L22:;

      /* "View.MemoryView":882
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
*/
      goto __pyx_L21;
    }

    /* "View.MemoryView":889
 *                                      "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_L21:;

    /* "View.MemoryView":881
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
*/
  }

  /* "View.MemoryView":891
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":793
 * 
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')             # <<<<<<<<<<<<<<
 * cdef int slice_memviewslice(
 *         __Pyx_memviewslice *dst,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":896
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

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[3];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":899
 * 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":900
 *                           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":903
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
  __pyx_t_2 = (__pyx_v_view->ndim == 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":904
 * 
 *     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, 904, __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(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(1, 904, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0);

    /* "View.MemoryView":905
 *     if view.ndim == 0:
 *         shape = view.len // itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
*/
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":903
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len // itemsize
 *         stride = itemsize
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":907
 *         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":908
 *     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":909
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
    if (__pyx_t_2) {

      /* "View.MemoryView":910
 *         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":909
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
*/
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":912
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  __pyx_t_2 = (__pyx_v_index < 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":913
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
*/
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":914
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    __pyx_t_2 = (__pyx_v_index < 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":915
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
*/
      __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
      __pyx_t_4[1] = __pyx_t_3;
      __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(1, 915, __pyx_L1_error)

      /* "View.MemoryView":914
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
    }

    /* "View.MemoryView":912
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
*/
  }

  /* "View.MemoryView":917
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":918
 * 
 *     if index >= shape:
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
*/
    __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
    __pyx_t_4[1] = __pyx_t_5;
    __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127);
    if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 918, __pyx_L1_error)

    /* "View.MemoryView":917
 *             raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError, f"Out of bounds on buffer access (axis {dim})"
 * 
*/
  }

  /* "View.MemoryView":920
 *         raise IndexError, f"Out of bounds on buffer access (axis {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":921
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  __pyx_t_2 = (__pyx_v_suboffset >= 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":922
 *     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":921
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
*/
  }

  /* "View.MemoryView":924
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":896
 * 
 * 
 * @cname('__pyx_pybuffer_index')             # <<<<<<<<<<<<<<
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":929
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":931
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     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":933
 *     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":934
 * 
 *     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":938
 * 
 *     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, 1);
  __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":939
 *     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":940
 *     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":941
 *         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":943
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 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);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":944
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error)

      /* "View.MemoryView":943
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
*/
    }
  }

  /* "View.MemoryView":946
 *             _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":929
 * 
 * 
 * @cname('__pyx_memslice_transpose')             # <<<<<<<<<<<<<<
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
 *     cdef int ndim = memslice.memview.view.ndim
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_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) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __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) {

  /* "View.MemoryView":965
 * 
 *     def __dealloc__(self):
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
*/
  __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":967
 *         __PYX_XCLEAR_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":968
 * 
 *     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);
  if (__pyx_t_1) {

    /* "View.MemoryView":969
 *     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, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":968
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
*/
  }

  /* "View.MemoryView":971
 *             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, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":967
 *         __PYX_XCLEAR_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":973
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":974
 * 
 *     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);
  if (__pyx_t_1) {

    /* "View.MemoryView":975
 *     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, 975, __pyx_L1_error)

    /* "View.MemoryView":974
 * 
 *     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":977
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef _get_base(self):
*/
  /*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, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":973
 *             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":979
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
*/

static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_base", 0);

  /* "View.MemoryView":980
 * 
 *     cdef _get_base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":979
 *             memoryview.assign_item_from_object(self, itemp, value)
 * 
 *     cdef _get_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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_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":999
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

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 const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":1008
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
  if (__pyx_t_1) {

    /* "View.MemoryView":1009
 * 
 *     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":1008
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "View.MemoryView":1014
 * 
 * 
 *     result = _memoryviewslice.__new__(_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, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__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":1016
 *     result = _memoryviewslice.__new__(_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":1017
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()
*/
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1019
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_base()             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __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":1020
 * 
 *     result.from_object = (<memoryview> memviewslice.memview)._get_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":1022
 *     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":1023
 * 
 *     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":1024
 *     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":1025
 *     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":1026
 *     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":1028
 *     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":1029
 * 
 *     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":1028
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
*/
    goto __pyx_L4;
  }

  /* "View.MemoryView":1031
 *         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":1033
 *         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":1034
 * 
 *     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":1037
 * 
 * 
 *     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":1038
 * 
 *     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":1039
 *     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);
    if (__pyx_t_1) {

      /* "View.MemoryView":1040
 *     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":1041
 *         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":1039
 *     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":1043
 *             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":1044
 * 
 *     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 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1045
 *     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 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __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, 1045, __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, 1045, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1047
 *         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":1048
 * 
 *     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":1050
 *     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":999
 *     pass  # ignore failure, it's a minor issue
 * 
 * @cname('__pyx_memoryview_fromslice')             # <<<<<<<<<<<<<<
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,
 *                           int ndim,
*/

  /* 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":1052
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1056
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":1057
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error)
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1058
 *     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":1056
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
*/
  }

  /* "View.MemoryView":1060
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
*/
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1061
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
*/
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1052
 *     return result
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')             # <<<<<<<<<<<<<<
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,
 *                                                    __Pyx_memviewslice *mslice) except NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1063
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

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;
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;

  /* "View.MemoryView":1068
 *     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":1069
 * 
 *     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":1070
 *     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":1072
 *     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":1073
 * 
 *     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":1075
 *     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":1076
 * 
 *     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":1077
 *     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":1078
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
*/
    __pyx_t_6 = (__pyx_v_suboffsets != 0);
    if (__pyx_t_6) {
      __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":1063
 *         return mslice
 * 
 * @cname('__pyx_memoryview_slice_copy')             # <<<<<<<<<<<<<<
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept:
 *     cdef int dim
*/

  /* function exit code */
}

/* "View.MemoryView":1080
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1084
 *     "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":1085
 *     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, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1080
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 * @cname('__pyx_memoryview_copy_object')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy(memoryview memview):
 *     "Create a new memoryview object"
*/

  /* 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":1087
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

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;
  PyObject *(*__pyx_t_2)(char *);
  int (*__pyx_t_3)(char *, PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1095
 *     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_mstate_global->__pyx_memoryviewslice_type); 
  if (__pyx_t_1) {

    /* "View.MemoryView":1096
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
*/
    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_2;

    /* "View.MemoryView":1097
 *     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_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_3;

    /* "View.MemoryView":1095
 *     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":1099
 *         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":1100
 *     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":1102
 *         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":1104
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __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_4)) __PYX_ERR(1, 1102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1087
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')             # <<<<<<<<<<<<<<
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __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":1110
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":1111
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:
 *     return -arg if arg < 0 else arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
*/
  __pyx_t_2 = (__pyx_v_arg < 0);
  if (__pyx_t_2) {
    __pyx_t_1 = (-__pyx_v_arg);
  } else {
    __pyx_t_1 = __pyx_v_arg;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":1110
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:             # <<<<<<<<<<<<<<
 *     return -arg if arg < 0 else arg
 * 
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1113
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

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":1119
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
*/
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1120
 *     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":1122
 *     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":1123
 * 
 *     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);
    if (__pyx_t_2) {

      /* "View.MemoryView":1124
 *     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":1125
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
*/
      goto __pyx_L4_break;

      /* "View.MemoryView":1123
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1127
 *             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":1128
 * 
 *     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);
    if (__pyx_t_2) {

      /* "View.MemoryView":1129
 *     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":1130
 *         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":1128
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
*/
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1132
 *             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));
  if (__pyx_t_2) {

    /* "View.MemoryView":1133
 * 
 *     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":1132
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
*/
  }

  /* "View.MemoryView":1135
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
*/
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1113
 *     return -arg if arg < 0 else arg
 * 
 * @cname('__pyx_get_best_slice_order')             # <<<<<<<<<<<<<<
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil:
 *     """
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1137
 *         return 'F'
 * 
 * @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,
*/

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;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;

  /* "View.MemoryView":1145
 * 
 *     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":1146
 *     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":1147
 *     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":1148
 *     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":1150
 *     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);
  if (__pyx_t_1) {

    /* "View.MemoryView":1151
 * 
 *     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);
    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);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1152
 *     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_1 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1151
 * 
 *     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":1153
 *         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":1151
 * 
 *     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":1155
 *             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_3 = __pyx_v_dst_extent;
      __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":1156
 *         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":1157
 *             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":1158
 *                 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":1150
 *     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":1160
 *                 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_3 = __pyx_v_dst_extent;
    __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":1161
 *     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":1165
 *                                      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":1166
 *                                      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":1137
 *         return 'F'
 * 
 * @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,
*/

  /* function exit code */
}

/* "View.MemoryView":1168
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept 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":1171
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept 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":1168
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) noexcept nogil:
*/

  /* function exit code */
}

/* "View.MemoryView":1174
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;

  /* "View.MemoryView":1177
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for shape in src.shape[:ndim]:
*/
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1179
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 * 
 *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         size *= shape
 * 
*/
  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_shape = (__pyx_t_2[0]);

    /* "View.MemoryView":1180
 * 
 *     for shape in src.shape[:ndim]:
 *         size *= shape             # <<<<<<<<<<<<<<
 * 
 *     return size
*/
    __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  }

  /* "View.MemoryView":1182
 *         size *= shape
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
*/
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1174
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 * @cname('__pyx_memoryview_slice_get_size')             # <<<<<<<<<<<<<<
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1184
 *     return size
 * 
 * @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,
*/

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":1194
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
  __pyx_t_1 = (__pyx_v_order == 'F');
  if (__pyx_t_1) {

    /* "View.MemoryView":1195
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = 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":1196
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 *     else:
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1197
 *         for idx in range(ndim):
 *             strides[idx] = 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":1194
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1199
 *             stride *= shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = 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":1200
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 * 
*/
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1201
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
*/
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1203
 *             stride *= shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
*/
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1184
 *     return size
 * 
 * @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,
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1205
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1217
 *     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":1218
 * 
 *     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":1220
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err_no_memory()
*/
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1221
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  __pyx_t_2 = (!(__pyx_v_result != 0));
  if (__pyx_t_2) {

    /* "View.MemoryView":1222
 *     result = malloc(size)
 *     if not result:
 *         _err_no_memory()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error)

    /* "View.MemoryView":1221
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err_no_memory()
 * 
*/
  }

  /* "View.MemoryView":1225
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
*/
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1226
 * 
 *     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":1227
 *     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":1228
 *     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":1229
 *     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, ndim, order)
*/
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1231
 *         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);
    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);
  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
 *     return stride
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')             # <<<<<<<<<<<<<<
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,
 *                              __Pyx_memviewslice *tmpslice,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1247
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

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[7];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1250
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi;
  __pyx_t_4[1] = __pyx_t_1;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got;
  __pyx_t_4[3] = __pyx_t_2;
  __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and;
  __pyx_t_4[5] = __pyx_t_3;
  __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127);
  if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(1, 1250, __pyx_L1_error)

  /* "View.MemoryView":1247
 * 
 * 
 * @cname('__pyx_memoryview_err_extents')             # <<<<<<<<<<<<<<
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
*/

  /* 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_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1252
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1254
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
*/
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(1, 1254, __pyx_L1_error)

  /* "View.MemoryView":1252
 *     raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
 * 
 * @cname('__pyx_memoryview_err_dim')             # <<<<<<<<<<<<<<
 * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil:
 *     raise <object>error, msg % dim
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1256
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "View.MemoryView":1258
 * @cname('__pyx_memoryview_err')
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_no_memory')
*/
  __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0);
  __PYX_ERR(1, 1258, __pyx_L1_error)

  /* "View.MemoryView":1256
 *     raise <object>error, msg % dim
 * 
 * @cname('__pyx_memoryview_err')             # <<<<<<<<<<<<<<
 * cdef int _err(PyObject *error, str msg) except -1 with gil:
 *     raise <object>error, msg
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1260
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

static int __pyx_memoryview_err_no_memory(void) {
  int __pyx_r;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1262
 * @cname('__pyx_memoryview_err_no_memory')
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 * 
*/
  PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error)

  /* "View.MemoryView":1260
 *     raise <object>error, msg
 * 
 * @cname('__pyx_memoryview_err_no_memory')             # <<<<<<<<<<<<<<
 * cdef int _err_no_memory() except -1 with gil:
 *     raise MemoryError
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "View.MemoryView":1265
 * 
 * 
 * @cname('__pyx_memoryview_copy_contents')             # <<<<<<<<<<<<<<
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,
 *                                   __Pyx_memviewslice dst,
*/

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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save;

  /* "View.MemoryView":1274
 *     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":1275
 *     """
 *     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":1277
 *     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":1278
 *     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":1279
 *     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":1282
 *     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);
  if (__pyx_t_2) {

    /* "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_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1282
 *     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":1284
 *     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);
  if (__pyx_t_2) {

    /* "View.MemoryView":1285
 *         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":1284
 *     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":1287
 *         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;
  __pyx_t_2 = (__pyx_t_3 > __pyx_t_4);
  if (__pyx_t_2) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1289
 *     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":1290
 * 
 *     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]));
    if (__pyx_t_2) {

      /* "View.MemoryView":1291
 *     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);
      if (__pyx_t_2) {

        /* "View.MemoryView":1292
 *         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":1293
 *             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":1291
 *     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":1295
 *                 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, 1295, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1290
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
*/
    }

    /* "View.MemoryView":1297
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1298
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
*/
      __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error)

      /* "View.MemoryView":1297
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
*/
    }
  }

  /* "View.MemoryView":1300
 *             _err_dim(PyExc_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);
  if (__pyx_t_2) {

    /* "View.MemoryView":1302
 *     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));
    if (__pyx_t_2) {

      /* "View.MemoryView":1303
 * 
 *         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":1302
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
*/
    }

    /* "View.MemoryView":1305
 *             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, 1305, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1306
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
*/
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1300
 *             _err_dim(PyExc_ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
*/
  }

  /* "View.MemoryView":1308
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (!__pyx_v_broadcasting);
  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):
*/
    __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim);
    if (__pyx_t_2) {

      /* "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_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "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):
*/
      goto __pyx_L12;
    }

    /* "View.MemoryView":1313
 *         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);
    if (__pyx_t_2) {

      /* "View.MemoryView":1314
 *             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":1313
 *         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":1316
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    if (__pyx_v_direct_copy) {

      /* "View.MemoryView":1318
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1319
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=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":1320
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
*/
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1321
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
*/
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1322
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1316
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    }

    /* "View.MemoryView":1308
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1324
 *             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));
  }
  if (__pyx_t_2) {

    /* "View.MemoryView":1327
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error)

    /* "View.MemoryView":1328
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
*/
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error)

    /* "View.MemoryView":1324
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
*/
  }

  /* "View.MemoryView":1330
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1331
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
*/
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1332
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
*/
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1334
 *     refcount_copying(&dst, dtype_is_object, ndim, inc=True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1335
 * 
 *     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,
*/

  /* function exit code */
  __pyx_L1_error:;
  __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1337
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

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":1342
 *                             int ndim_other) noexcept 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":1344
 *     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":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->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1346
 *     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":1347
 *         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":1349
 *         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":1350
 * 
 *     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":1351
 *     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":1352
 *         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
 *     return 0
 * 
 * @cname('__pyx_memoryview_broadcast_leading')             # <<<<<<<<<<<<<<
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,
 *                             int ndim,
*/

  /* 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) noexcept 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) {

  /* "View.MemoryView":1362
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
*/
  if (__pyx_v_dtype_is_object) {

    /* "View.MemoryView":1363
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
*/
    __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":1362
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil:
 * 
 *     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) noexcept nogil:
 * 
*/

  /* function exit code */
}

/* "View.MemoryView":1365
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @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,
*/

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) {
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();

  /* "View.MemoryView":1369
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) noexcept 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":1365
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc)
 * 
 * @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,
*/

  /* function exit code */
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
}

/* "View.MemoryView":1371
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @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) noexcept:
*/

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;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1375
 *                                     Py_ssize_t *strides, int ndim, bint inc) noexcept:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(shape[0]):
*/
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1377
 *     cdef Py_ssize_t stride = strides[0]
 * 
 *     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":1378
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
    __pyx_t_4 = (__pyx_v_ndim == 1);
    if (__pyx_t_4) {

      /* "View.MemoryView":1379
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
      if (__pyx_v_inc) {

        /* "View.MemoryView":1380
 *         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":1379
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
*/
        goto __pyx_L6;
      }

      /* "View.MemoryView":1382
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
*/
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1378
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
*/
      goto __pyx_L5;
    }

    /* "View.MemoryView":1384
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += stride
*/
    /*else*/ {
      __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":1386
 *             refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc)
 * 
 *         data += stride             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  }

  /* "View.MemoryView":1371
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)
 * 
 * @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) noexcept:
*/

  /* function exit code */
}

/* "View.MemoryView":1391
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

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":1395
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1396
 *                               bint dtype_is_object) noexcept nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)             # <<<<<<<<<<<<<<
 *     refcount_copying(dst, dtype_is_object, ndim, inc=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":1397
 *     refcount_copying(dst, dtype_is_object, ndim, inc=False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, inc=True)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1391
 * 
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,
 *                               size_t itemsize, void *item,
*/

  /* function exit code */
}

/* "View.MemoryView":1400
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

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":1405
 *                               size_t itemsize, void *item) noexcept 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":1406
 *     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":1408
 *     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);
  if (__pyx_t_1) {

    /* "View.MemoryView":1409
 * 
 *     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":1410
 *     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":1411
 *         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":1408
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
*/
    goto __pyx_L3;
  }

  /* "View.MemoryView":1413
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item)
 *             data += stride
*/
  /*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":1414
 *     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":1415
 *         for i in range(extent):
 *             _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":1400
 * 
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')             # <<<<<<<<<<<<<<
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,
 *                               Py_ssize_t *strides, int ndim,
*/

  /* function exit code */
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error)
  __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 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __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_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, __pyx_k_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __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_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(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, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(1, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
 *     __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, __pyx_state: tuple):
 *     __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)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __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, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); 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, __pyx_state: tuple):
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)             # <<<<<<<<<<<<<<
*/
  __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)

  /* "(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, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1)
*/

  /* 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.__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;
}

/* "BufferFormatFromTypeInfo":1450
 * 
 * 
 * @cname('__pyx_format_from_typeinfo')             # <<<<<<<<<<<<<<
 * cdef bytes format_from_typeinfo(const __Pyx_TypeInfo *type):
 *     cdef const __Pyx_StructField *field
*/

static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo const *__pyx_v_type) {
  __Pyx_StructField const *__pyx_v_field;
  struct __pyx_typeinfo_string __pyx_v_fmt;
  PyObject *__pyx_v_part = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_v_alignment = NULL;
  PyObject *__pyx_v_parts = NULL;
  PyObject *__pyx_v_extents = NULL;
  Py_ssize_t __pyx_7genexpr__pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_StructField const *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10[3];
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("format_from_typeinfo", 0);

  /* "BufferFormatFromTypeInfo":1457
 *     cdef Py_ssize_t i
 * 
 *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
 *         assert type.fields != NULL
 *         assert type.fields.type != NULL
*/
  __pyx_t_1 = (__pyx_v_type->typegroup == 'S');
  if (__pyx_t_1) {

    /* "BufferFormatFromTypeInfo":1458
 * 
 *     if type.typegroup == 'S':
 *         assert type.fields != NULL             # <<<<<<<<<<<<<<
 *         assert type.fields.type != NULL
 * 
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (__pyx_v_type->fields != NULL);
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(1, 1458, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 1458, __pyx_L1_error)
    #endif

    /* "BufferFormatFromTypeInfo":1459
 *     if type.typegroup == 'S':
 *         assert type.fields != NULL
 *         assert type.fields.type != NULL             # <<<<<<<<<<<<<<
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = (__pyx_v_type->fields->type != NULL);
      if (unlikely(!__pyx_t_1)) {
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
        __PYX_ERR(1, 1459, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(1, 1459, __pyx_L1_error)
    #endif

    /* "BufferFormatFromTypeInfo":1461
 *         assert type.fields.type != NULL
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
 *             alignment = b'^'
 *         else:
*/
    __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
    if (__pyx_t_1) {

      /* "BufferFormatFromTypeInfo":1462
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
 *             alignment = b'^'             # <<<<<<<<<<<<<<
 *         else:
 *             alignment = b''
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__6);
      __pyx_v_alignment = __pyx_mstate_global->__pyx_kp_b__6;

      /* "BufferFormatFromTypeInfo":1461
 *         assert type.fields.type != NULL
 * 
 *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
 *             alignment = b'^'
 *         else:
*/
      goto __pyx_L4;
    }

    /* "BufferFormatFromTypeInfo":1464
 *             alignment = b'^'
 *         else:
 *             alignment = b''             # <<<<<<<<<<<<<<
 * 
 *         parts = [b"T{"]
*/
    /*else*/ {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__7);
      __pyx_v_alignment = __pyx_mstate_global->__pyx_kp_b__7;
    }
    __pyx_L4:;

    /* "BufferFormatFromTypeInfo":1466
 *             alignment = b''
 * 
 *         parts = [b"T{"]             # <<<<<<<<<<<<<<
 *         field = type.fields
 * 
*/
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b_T);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_b_T);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_kp_b_T) != (0)) __PYX_ERR(1, 1466, __pyx_L1_error);
    __pyx_v_parts = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "BufferFormatFromTypeInfo":1467
 * 
 *         parts = [b"T{"]
 *         field = type.fields             # <<<<<<<<<<<<<<
 * 
 *         while field.type:
*/
    __pyx_t_3 = __pyx_v_type->fields;
    __pyx_v_field = __pyx_t_3;

    /* "BufferFormatFromTypeInfo":1469
 *         field = type.fields
 * 
 *         while field.type:             # <<<<<<<<<<<<<<
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')
*/
    while (1) {
      __pyx_t_1 = (__pyx_v_field->type != 0);
      if (!__pyx_t_1) break;

      /* "BufferFormatFromTypeInfo":1470
 * 
 *         while field.type:
 *             part = format_from_typeinfo(field.type)             # <<<<<<<<<<<<<<
 *             parts.append(part + b':' + field.name + b':')
 *             field += 1
*/
      __pyx_t_2 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "BufferFormatFromTypeInfo":1471
 *         while field.type:
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')             # <<<<<<<<<<<<<<
 *             field += 1
 * 
*/
      __pyx_t_2 = PyNumber_Add(__pyx_v_part, __pyx_mstate_global->__pyx_kp_b__8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_mstate_global->__pyx_kp_b__8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1471, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "BufferFormatFromTypeInfo":1472
 *             part = format_from_typeinfo(field.type)
 *             parts.append(part + b':' + field.name + b':')
 *             field += 1             # <<<<<<<<<<<<<<
 * 
 *         result = alignment.join(parts) + b'}'
*/
      __pyx_v_field = (__pyx_v_field + 1);
    }

    /* "BufferFormatFromTypeInfo":1474
 *             field += 1
 * 
 *         result = alignment.join(parts) + b'}'             # <<<<<<<<<<<<<<
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)
*/
    __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_mstate_global->__pyx_kp_b__9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_result = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "BufferFormatFromTypeInfo":1457
 *     cdef Py_ssize_t i
 * 
 *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
 *         assert type.fields != NULL
 *         assert type.fields.type != NULL
*/
    goto __pyx_L3;
  }

  /* "BufferFormatFromTypeInfo":1476
 *         result = alignment.join(parts) + b'}'
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)             # <<<<<<<<<<<<<<
 *         result = fmt.string
 *         if type.arraysize[0]:
*/
  /*else*/ {
    __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);

    /* "BufferFormatFromTypeInfo":1477
 *     else:
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         result = fmt.string             # <<<<<<<<<<<<<<
 *         if type.arraysize[0]:
 *             extents = [f"{type.arraysize[i]}" for i in range(type.ndim)]
*/
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_result = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "BufferFormatFromTypeInfo":1478
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         result = fmt.string
 *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
 *             extents = [f"{type.arraysize[i]}" for i in range(type.ndim)]
 *             result = f"({u','.join(extents)})".encode('ascii') + result
*/
    __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
    if (__pyx_t_1) {

      /* "BufferFormatFromTypeInfo":1479
 *         result = fmt.string
 *         if type.arraysize[0]:
 *             extents = [f"{type.arraysize[i]}" for i in range(type.ndim)]             # <<<<<<<<<<<<<<
 *             result = f"({u','.join(extents)})".encode('ascii') + result
 * 
*/
      { /* enter inner scope */
        __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __pyx_v_type->ndim;
        __pyx_t_8 = __pyx_t_7;
        for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
          __pyx_7genexpr__pyx_v_i = __pyx_t_9;
          __pyx_t_4 = __Pyx_PyUnicode_From_size_t((__pyx_v_type->arraysize[__pyx_7genexpr__pyx_v_i]), 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1479, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) __PYX_ERR(1, 1479, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      } /* exit inner scope */
      __pyx_v_extents = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "BufferFormatFromTypeInfo":1480
 *         if type.arraysize[0]:
 *             extents = [f"{type.arraysize[i]}" for i in range(type.ndim)]
 *             result = f"({u','.join(extents)})".encode('ascii') + result             # <<<<<<<<<<<<<<
 * 
 *     return result
*/
      __pyx_t_5 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__11, __pyx_v_extents); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u__10;
      __pyx_t_10[1] = __pyx_t_5;
      __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "BufferFormatFromTypeInfo":1478
 *         fmt = __Pyx_TypeInfoToFormat(type)
 *         result = fmt.string
 *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
 *             extents = [f"{type.arraysize[i]}" for i in range(type.ndim)]
 *             result = f"({u','.join(extents)})".encode('ascii') + result
*/
    }
  }
  __pyx_L3:;

  /* "BufferFormatFromTypeInfo":1482
 *             result = f"({u','.join(extents)})".encode('ascii') + result
 * 
 *     return result             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "BufferFormatFromTypeInfo":1450
 * 
 * 
 * @cname('__pyx_format_from_typeinfo')             # <<<<<<<<<<<<<<
 * cdef bytes format_from_typeinfo(const __Pyx_TypeInfo *type):
 *     cdef const __Pyx_StructField *field
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_part);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_alignment);
  __Pyx_XDECREF(__pyx_v_parts);
  __Pyx_XDECREF(__pyx_v_extents);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":23
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         # unavailable in limited API
*/
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":29
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
 *             return self.cval.imag             # <<<<<<<<<<<<<<
 * 
 *     # PyTypeObject PyComplex_Type
*/
  __pyx_r = __pyx_v_self->cval.imag;
  goto __pyx_L0;

  /* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":121
 *     or None if no such value or default was found.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":122
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)             # <<<<<<<<<<<<<<
 *     if value is NULL:
 *         # context variable does not have a default
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 122, __pyx_L1_error)

  /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
  __pyx_t_2 = (__pyx_v_value == NULL);
  if (__pyx_t_2) {

    /* "cpython/contextvars.pxd":125
 *     if value is NULL:
 *         # context variable does not have a default
 *         pyvalue = default_value             # <<<<<<<<<<<<<<
 *     else:
 *         # value or default value of context variable
*/
    __Pyx_INCREF(__pyx_v_default_value);
    __pyx_v_pyvalue = __pyx_v_default_value;

    /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
    goto __pyx_L3;
  }

  /* "cpython/contextvars.pxd":128
 *     else:
 *         # value or default value of context variable
 *         pyvalue = <object>value             # <<<<<<<<<<<<<<
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_value);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_pyvalue = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cpython/contextvars.pxd":129
 *         # value or default value of context variable
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
 * 
*/
    Py_XDECREF(__pyx_v_value);
  }
  __pyx_L3:;

  /* "cpython/contextvars.pxd":130
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_no_default", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":140
 *     Ignores the default value of the context variable, if any.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":141
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)             # <<<<<<<<<<<<<<
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 141, __pyx_L1_error)

  /* "cpython/contextvars.pxd":143
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value             # <<<<<<<<<<<<<<
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_value);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pyvalue = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cpython/contextvars.pxd":144
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
*/
  Py_XDECREF(__pyx_v_value);

  /* "cpython/contextvars.pxd":145
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "array.pxd":103
 *             arraydescr* ob_descr    # struct arraydescr *ob_descr;
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline __data_union data(self) noexcept nogil:
 *             return __Pyx_PyArray_Data(self)
*/

static CYTHON_INLINE __Pyx_data_union __pyx_f_7cpython_5array_5array_4data_data(arrayobject *__pyx_v_self) {
  __Pyx_data_union __pyx_r;

  /* "array.pxd":105
 *         @property
 *         cdef inline __data_union data(self) noexcept nogil:
 *             return __Pyx_PyArray_Data(self)             # <<<<<<<<<<<<<<
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):
*/
  __pyx_r = __Pyx_PyArray_Data(__pyx_v_self);
  goto __pyx_L0;

  /* "array.pxd":103
 *             arraydescr* ob_descr    # struct arraydescr *ob_descr;
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline __data_union data(self) noexcept nogil:
 *             return __Pyx_PyArray_Data(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "array.pxd":107
 *             return __Pyx_PyArray_Data(self)
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
  PyObject *__pyx_v_item_count = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  char __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (unlikely(__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);

  /* "array.pxd":112
 *             # In particular strided access is always provided regardless
 *             # of flags
 *             item_count = Py_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *             info.suboffsets = NULL
*/
  __pyx_t_1 = PyLong_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_item_count = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "array.pxd":114
 *             item_count = Py_SIZE(self)
 * 
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
*/
  __pyx_v_info->suboffsets = NULL;

  /* "array.pxd":115
 * 
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars             # <<<<<<<<<<<<<<
 *             info.readonly = 0
 *             info.ndim = 1
*/
  __pyx_t_2 = __pyx_f_7cpython_5array_5array_4data_data(__pyx_v_self).as_chars;
  __pyx_v_info->buf = __pyx_t_2;

  /* "array.pxd":116
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars
 *             info.readonly = 0             # <<<<<<<<<<<<<<
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
*/
  __pyx_v_info->readonly = 0;

  /* "array.pxd":117
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count
*/
  __pyx_v_info->ndim = 1;

  /* "array.pxd":118
 *             info.readonly = 0
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)             # <<<<<<<<<<<<<<
 *             info.len = info.itemsize * item_count
 * 
*/
  __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "array.pxd":119
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count             # <<<<<<<<<<<<<<
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
*/
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_info->len = __pyx_t_5;

  /* "array.pxd":121
 *             info.len = info.itemsize * item_count
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)             # <<<<<<<<<<<<<<
 *             if not info.shape:
 *                 raise MemoryError()
*/
  __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));

  /* "array.pxd":122
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
*/
  __pyx_t_6 = (!(__pyx_v_info->shape != 0));
  if (unlikely(__pyx_t_6)) {

    /* "array.pxd":123
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize
*/
    PyErr_NoMemory(); __PYX_ERR(3, 123, __pyx_L1_error)

    /* "array.pxd":122
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
*/
  }

  /* "array.pxd":124
 *             if not info.shape:
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing             # <<<<<<<<<<<<<<
 *             info.strides = &info.itemsize
 * 
*/
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 124, __pyx_L1_error)
  (__pyx_v_info->shape[0]) = __pyx_t_5;

  /* "array.pxd":125
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize             # <<<<<<<<<<<<<<
 * 
 *             info.format = <char*> (info.shape + 1)
*/
  __pyx_v_info->strides = (&__pyx_v_info->itemsize);

  /* "array.pxd":127
 *             info.strides = &info.itemsize
 * 
 *             info.format = <char*> (info.shape + 1)             # <<<<<<<<<<<<<<
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
*/
  __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));

  /* "array.pxd":128
 * 
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode             # <<<<<<<<<<<<<<
 *             info.format[1] = 0
 *             info.obj = self
*/
  __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
  (__pyx_v_info->format[0]) = __pyx_t_7;

  /* "array.pxd":129
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0             # <<<<<<<<<<<<<<
 *             info.obj = self
 * 
*/
  (__pyx_v_info->format[1]) = 0;

  /* "array.pxd":130
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
*/
  __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);

  /* "array.pxd":107
 *             return __Pyx_PyArray_Data(self)
 * 
 *         def __getbuffer__(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_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cpython.array.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_XDECREF(__pyx_v_item_count);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":132
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
*/

/* Python wrapper */
CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

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

static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {

  /* "array.pxd":133
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 *             PyObject_Free(info.shape)             # <<<<<<<<<<<<<<
 * 
 *     array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
*/
  PyObject_Free(__pyx_v_info->shape);

  /* "array.pxd":132
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
*/

  /* function exit code */
}

/* "array.pxd":145
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
*/

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "array.pxd":149
 *     type will be same as template.
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)             # <<<<<<<<<<<<<<
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
*/
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":150
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
*/
  if (__pyx_v_zero) {
  } else {
    __pyx_t_2 = __pyx_v_zero;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "array.pxd":151
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
*/
    (void)(memset(__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_op).as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));

    /* "array.pxd":150
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
*/
  }

  /* "array.pxd":152
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline array copy(array self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":145
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":154
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
*/

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "array.pxd":156
 * cdef inline array copy(array self):
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)             # <<<<<<<<<<<<<<
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op
*/
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":157
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
*/
  (void)(memcpy(__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_op).as_chars, __pyx_f_7cpython_5array_5array_4data_data(__pyx_v_self).as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));

  /* "array.pxd":158
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":154
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":160
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
*/

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_itemsize;
  Py_ssize_t __pyx_v_origsize;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "array.pxd":164
 *     (e.g. of same array type)
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
*/
  __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "array.pxd":165
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)             # <<<<<<<<<<<<<<
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
*/
  __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));

  /* "array.pxd":166
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)             # <<<<<<<<<<<<<<
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0
*/
  __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 166, __pyx_L1_error)

  /* "array.pxd":167
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_self).as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));

  /* "array.pxd":168
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend(array self, array other) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "array.pxd":160
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "array.pxd":170
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
*/

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "array.pxd":172
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
*/
  __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
  if (__pyx_t_1) {

    /* "array.pxd":173
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()             # <<<<<<<<<<<<<<
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
*/
    __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 173, __pyx_L1_error)

    /* "array.pxd":172
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
*/
  }

  /* "array.pxd":174
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))             # <<<<<<<<<<<<<<
 * 
 * cdef inline void zero(array self) noexcept:
*/
  __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_f_7cpython_5array_5array_4data_data(__pyx_v_other).as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(3, 174, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "array.pxd":170
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "array.pxd":176
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self) noexcept:             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
*/

static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {

  /* "array.pxd":178
 * cdef inline void zero(array self) noexcept:
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)             # <<<<<<<<<<<<<<
*/
  (void)(memset(__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_self).as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));

  /* "array.pxd":176
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self) noexcept:             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
*/

  /* function exit code */
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":242
 *         cdef int type_num
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":244
 *         @property
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyDataType_ELSIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":242
 *         cdef int type_num
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp itemsize(self) noexcept nogil:
 *             return PyDataType_ELSIZE(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":246
 *             return PyDataType_ELSIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":248
 *         @property
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)             # <<<<<<<<<<<<<<
 * 
 *         # Use fields/names with care as they may be NULL.  You must check
*/
  __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":246
 *             return PyDataType_ELSIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp alignment(self) noexcept nogil:
 *             return PyDataType_ALIGNMENT(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":252
 *         # Use fields/names with care as they may be NULL.  You must check
 *         # for this using PyDataType_HASFIELDS.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("fields", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":254
 *         @property
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = ((PyObject *)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":252
 *         # Use fields/names with care as they may be NULL.  You must check
 *         # for this using PyDataType_HASFIELDS.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline object fields(self):
 *             return <object>PyDataType_FIELDS(self)
*/

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

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":256
 *             return <object>PyDataType_FIELDS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1;
  __Pyx_RefNannySetupContext("names", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":258
 *         @property
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)             # <<<<<<<<<<<<<<
 * 
 *         # Use PyDataType_HASSUBARRAY to test whether this field is
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDataType_NAMES(__pyx_v_self);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = ((PyObject*)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":256
 *             return <object>PyDataType_FIELDS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline tuple names(self):
 *             return <tuple>PyDataType_NAMES(self)
*/

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

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":263
 *         # valid (the pointer can be NULL). Most users should access
 *         # this field via the inline helper method PyDataType_SHAPE.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)
*/

static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) {
  PyArray_ArrayDescr *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":265
 *         @property
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyDataType_SUBARRAY(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":263
 *         # valid (the pointer can be NULL). Most users should access
 *         # this field via the inline helper method PyDataType_SHAPE.
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
 *             return PyDataType_SUBARRAY(self)
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":267
 *             return PyDataType_SUBARRAY(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
*/

static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) {
  npy_uint64 __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":270
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
 *             return PyDataType_FLAGS(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyDataType_FLAGS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":267
 *             return PyDataType_SUBARRAY(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_uint64 flags(self) noexcept nogil:
 *             """The data types flags."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":279
 *     ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
*/

static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":282
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
 *             return PyArray_MultiIter_NUMITER(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":279
 *     ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int numiter(self) noexcept nogil:
 *             """The number of arrays that need to be broadcast to the same shape."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":284
 *             return PyArray_MultiIter_NUMITER(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":287
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
 *             return PyArray_MultiIter_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":284
 *             return PyArray_MultiIter_NUMITER(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """The total broadcasted size."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":289
 *             return PyArray_MultiIter_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":292
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
 *             return PyArray_MultiIter_INDEX(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":289
 *             return PyArray_MultiIter_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp index(self) noexcept nogil:
 *             """The current (1-d) index into the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":294
 *             return PyArray_MultiIter_INDEX(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
*/

static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":297
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
 *             return PyArray_MultiIter_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":294
 *             return PyArray_MultiIter_INDEX(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int nd(self) noexcept nogil:
 *             """The number of dimensions in the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":299
 *             return PyArray_MultiIter_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":302
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
 *             return PyArray_MultiIter_DIMS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":299
 *             return PyArray_MultiIter_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp* dimensions(self) noexcept nogil:
 *             """The shape of the broadcasted result."""
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":304
 *             return PyArray_MultiIter_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline void** iters(self) noexcept nogil:
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
*/

static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) {
  void **__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":308
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
 *             On return, the iterators are adjusted for broadcasting."""
 *             return PyArray_MultiIter_ITERS(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":304
 *             return PyArray_MultiIter_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline void** iters(self) noexcept nogil:
 *             """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":322
 *         # Instead, we use properties that map to the corresponding C-API functions.
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyObject* base(self) noexcept nogil:
 *             """Returns a borrowed reference to the object owning the data/memory.
*/

static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) {
  PyObject *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":326
 *             """Returns a borrowed reference to the object owning the data/memory.
 *             """
 *             return PyArray_BASE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_BASE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":322
 *         # Instead, we use properties that map to the corresponding C-API functions.
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline PyObject* base(self) noexcept nogil:
 *             """Returns a borrowed reference to the object owning the data/memory.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":328
 *             return PyArray_BASE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline dtype descr(self):
 *             """Returns an owned reference to the dtype of the array.
*/

static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) {
  PyArray_Descr *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArray_Descr *__pyx_t_1;
  __Pyx_RefNannySetupContext("descr", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":332
 *             """Returns an owned reference to the dtype of the array.
 *             """
 *             return <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_1 = PyArray_DESCR(__pyx_v_self);
  __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1));
  __pyx_r = ((PyArray_Descr *)__pyx_t_1);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":328
 *             return PyArray_BASE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline dtype descr(self):
 *             """Returns an owned reference to the dtype of the array.
*/

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":334
 *             return <dtype>PyArray_DESCR(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int ndim(self) noexcept nogil:
 *             """Returns the number of dimensions in the array.
*/

static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) {
  int __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":338
 *             """Returns the number of dimensions in the array.
 *             """
 *             return PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_NDIM(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":334
 *             return <dtype>PyArray_DESCR(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline int ndim(self) noexcept nogil:
 *             """Returns the number of dimensions in the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":340
 *             return PyArray_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *shape(self) noexcept nogil:
 *             """Returns a pointer to the dimensions/shape of the array.
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":346
 *             Can return NULL for 0-dimensional arrays.
 *             """
 *             return PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_DIMS(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":340
 *             return PyArray_NDIM(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *shape(self) noexcept nogil:
 *             """Returns a pointer to the dimensions/shape of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":348
 *             return PyArray_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *strides(self) noexcept nogil:
 *             """Returns a pointer to the strides of the array.
*/

static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) {
  npy_intp *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":353
 *             The number of elements matches the number of dimensions of the array (ndim).
 *             """
 *             return PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_STRIDES(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":348
 *             return PyArray_DIMS(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp *strides(self) noexcept nogil:
 *             """Returns a pointer to the strides of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":355
 *             return PyArray_STRIDES(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """Returns the total size (in number of elements) of the array.
*/

static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) {
  npy_intp __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":359
 *             """Returns the total size (in number of elements) of the array.
 *             """
 *             return PyArray_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *         @property
*/
  __pyx_r = PyArray_SIZE(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":355
 *             return PyArray_STRIDES(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline npy_intp size(self) noexcept nogil:
 *             """Returns the total size (in number of elements) of the array.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":361
 *             return PyArray_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline char* data(self) noexcept nogil:
 *             """The pointer to the data buffer as a char*.
*/

static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) {
  char *__pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":368
 *             of `PyArray_DATA()` instead, which returns a 'void*'.
 *             """
 *             return PyArray_BYTES(self)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyArray_BYTES(__pyx_v_self);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":361
 *             return PyArray_SIZE(self)
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         cdef inline char* data(self) noexcept nogil:
 *             """The pointer to the data buffer as a char*.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":776
 * ctypedef long double complex clongdouble_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":777
 * 
 * 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(4, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":776
 * ctypedef long double complex clongdouble_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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":779
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":780
 * 
 * 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(4, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":779
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":782
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":783
 * 
 * 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(4, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":782
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":785
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":786
 * 
 * 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(4, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":785
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":788
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":789
 * 
 * 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(4, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":788
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":791
 *     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;
  PyObject *__pyx_t_2;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":792
 * 
 * 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);
  if (__pyx_t_1) {

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":793
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape;
    __Pyx_INCREF(((PyObject*)__pyx_t_2));
    __pyx_r = ((PyObject*)__pyx_t_2);
    goto __pyx_L0;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":792
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
*/
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":795
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":791
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":994
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:             # <<<<<<<<<<<<<<
 *     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) {
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":995
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
*/
  Py_INCREF(__pyx_v_base);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":996
 * cdef inline void set_array_base(ndarray arr, object base) except *:
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
*/
  __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(4, 996, __pyx_L1_error)

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":994
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base) except *:             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":998
 *     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);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":999
 * 
 * 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);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1000
 * 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);
  if (__pyx_t_1) {

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1001
 *     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;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1000
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
*/
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1002
 *     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;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":998
 *     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;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1006
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_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;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1007
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_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:*/ {

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1008
 * cdef inline int import_array() except -1:
 *     try:
 *         __pyx_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(4, 1008, __pyx_L3_error)

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1007
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_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:;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1009
 *     try:
 *         __pyx_import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.multiarray failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    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(4, 1009, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1010
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy._core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1010, __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(4, 1010, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1007
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __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:;
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1006
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1012
 *         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;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1013
 * 
 * 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:*/ {

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1014
 * 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(4, 1014, __pyx_L3_error)

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1013
 * 
 * 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:;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1015
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.umath failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    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(4, 1015, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1016
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1016, __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(4, 1016, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1013
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __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:;
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1012
 *         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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1018
 *         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;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1019
 * 
 * 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:*/ {

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1020
 * 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(4, 1020, __pyx_L3_error)

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1019
 * 
 * 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:;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1021
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy._core.umath failed to import")
 * 
*/
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    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(4, 1021, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);

      /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1022
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy._core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_9 = NULL;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 1022, __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(4, 1022, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1019
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
*/
    __pyx_L5_except_error:;
    __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:;
  }

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1018
 *         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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1025
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
*/

static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1037
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1025
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1040
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
*/

static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1052
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1040
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj) noexcept:             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1055
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
*/

static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
  npy_datetime __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1062
 *     also needed.  That can be found using `get_datetime64_unit`.
 *     """
 *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1055
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1065
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
*/

static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
  npy_timedelta __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1069
 *     returns the int64 value underlying scalar numpy timedelta64 object
 *     """
 *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1065
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1072
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
*/

static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
  NPY_DATETIMEUNIT __pyx_r;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1076
 *     returns the unit part of the dtype for a numpy datetime64 object.
 *     """
 *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
  goto __pyx_L0;

  /* "../../../../tmp/build-env-mzt6dy0m/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd":1072
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":142
 *     Abstract base class for formatting progress display of optimizations.
 *     """
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def update(self, text):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7Printer_1update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_7Printer_update, "\n        Method called to update output each iteration. Accepts output of\n        print_funcion as only argument.\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_7Printer_1update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7Printer_1update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_7Printer_update};
static PyObject *__pyx_pw_6H2MM_C_7Printer_1update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 142, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 142, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 142, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(0, 142, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, i); __PYX_ERR(0, 142, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 142, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 142, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 142, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.Printer.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7Printer_update(__pyx_self, __pyx_v_self, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7Printer_update(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_text) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "H2MM_C.pyx":148
 *         print_funcion as only argument.
 *         """
 *         raise NotImplementedError("Must implement update")             # <<<<<<<<<<<<<<
 * 
 *     @abstractmethod
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Must_implement_update};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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, 148, __pyx_L1_error)

  /* "H2MM_C.pyx":142
 *     Abstract base class for formatting progress display of optimizations.
 *     """
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def update(self, text):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.Printer.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":150
 *         raise NotImplementedError("Must implement update")
 * 
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def close(self):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7Printer_3close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_7Printer_2close, "\n        Method called at end of :func:`H2MM_C.EM_H2MM_C`, used to terminate the\n        output, for instance adding a newline character to output.\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_7Printer_3close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7Printer_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_7Printer_2close};
static PyObject *__pyx_pw_6H2MM_C_7Printer_3close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 150, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 150, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "close", 0) < (0)) __PYX_ERR(0, 150, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, i); __PYX_ERR(0, 150, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 150, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 150, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.Printer.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7Printer_2close(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7Printer_2close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "H2MM_C.pyx":156
 *         output, for instance adding a newline character to output.
 *         """
 *         raise NotImplementedError("Must implement close")             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, *args, **kwargs):
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Must_implement_close};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __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, 156, __pyx_L1_error)

  /* "H2MM_C.pyx":150
 *         raise NotImplementedError("Must implement update")
 * 
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def close(self):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.Printer.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":158
 *         raise NotImplementedError("Must implement close")
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.update(*args, **kwargs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7Printer_5__call__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_7Printer_5__call__ = {"__call__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7Printer_5__call__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_7Printer_5__call__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
  if (unlikely(!__pyx_v_args)) {
    __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_v_args);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 158, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        default:
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, __pyx_kwds_len, "__call__", 1) < (0)) __PYX_ERR(0, 158, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, i); __PYX_ERR(0, 158, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs < 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 158, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 158, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("H2MM_C.Printer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7Printer_4__call__(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7Printer_4__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "H2MM_C.pyx":159
 * 
 *     def __call__(self, *args, **kwargs):
 *         return self.update(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __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;

  /* "H2MM_C.pyx":158
 *         raise NotImplementedError("Must implement close")
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.update(*args, **kwargs)
 * 
*/

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

/* "H2MM_C.pyx":161
 *         return self.update(*args, **kwargs)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7Printer_7__enter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_7Printer_7__enter__ = {"__enter__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7Printer_7__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_7Printer_7__enter__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 161, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 161, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__enter__", 0) < (0)) __PYX_ERR(0, 161, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__enter__", 1, 1, 1, i); __PYX_ERR(0, 161, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 161, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__enter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 161, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.Printer.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7Printer_6__enter__(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7Printer_6__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "H2MM_C.pyx":162
 * 
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "H2MM_C.pyx":161
 *         return self.update(*args, **kwargs)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

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

/* "H2MM_C.pyx":164
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if exc_type is None:
 *             self.close()
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7Printer_9__exit__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_7Printer_9__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7Printer_9__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_7Printer_9__exit__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_exc_type = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_exc_type,&__pyx_mstate_global->__pyx_n_u_exc_val,&__pyx_mstate_global->__pyx_n_u_exc_tb,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 164, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 164, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 164, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 164, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 164, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < (0)) __PYX_ERR(0, 164, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, i); __PYX_ERR(0, 164, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 164, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 164, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 164, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 164, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_exc_type = values[1];
    __pyx_v_exc_val = values[2];
    __pyx_v_exc_tb = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 164, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.Printer.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7Printer_8__exit__(__pyx_self, __pyx_v_self, __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7Printer_8__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "H2MM_C.pyx":165
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if exc_type is None:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
*/
  __pyx_t_1 = (__pyx_v_exc_type == Py_None);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":166
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if exc_type is None:
 *             self.close()             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __pyx_v_self;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H2MM_C.pyx":165
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):
 *         if exc_type is None:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
*/
  }

  /* "H2MM_C.pyx":164
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if exc_type is None:
 *             self.close()
*/

  /* 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_AddTraceback("H2MM_C.Printer.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":171
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):             # <<<<<<<<<<<<<<
 *         self.buffer = buffer
 *         self.width = 0
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10StdPrinter_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10StdPrinter_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_keep = 0;
  PyObject *__pyx_v_single_line = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_buffer,&__pyx_mstate_global->__pyx_n_u_keep,&__pyx_mstate_global->__pyx_n_u_single_line,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 171, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 171, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, i); __PYX_ERR(0, 171, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 171, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 171, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 171, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
    }
    __pyx_v_self = values[0];
    __pyx_v_buffer = values[1];
    __pyx_v_keep = values[2];
    __pyx_v_single_line = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 171, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.StdPrinter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10StdPrinter___init__(__pyx_self, __pyx_v_self, __pyx_v_buffer, __pyx_v_keep, __pyx_v_single_line);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10StdPrinter___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_keep, PyObject *__pyx_v_single_line) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "H2MM_C.pyx":172
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):
 *         self.buffer = buffer             # <<<<<<<<<<<<<<
 *         self.width = 0
 *         self.keep = bool(keep)
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer, __pyx_v_buffer) < (0)) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "H2MM_C.pyx":173
 *     def __init__(self, buffer, keep=False, single_line=True):
 *         self.buffer = buffer
 *         self.width = 0             # <<<<<<<<<<<<<<
 *         self.keep = bool(keep)
 *         self.single_line = bool(single_line)
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_width, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 173, __pyx_L1_error)

  /* "H2MM_C.pyx":174
 *         self.buffer = buffer
 *         self.width = 0
 *         self.keep = bool(keep)             # <<<<<<<<<<<<<<
 *         self.single_line = bool(single_line)
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_keep); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 174, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_keep, __pyx_t_2) < (0)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":175
 *         self.width = 0
 *         self.keep = bool(keep)
 *         self.single_line = bool(single_line)             # <<<<<<<<<<<<<<
 * 
 *     def update(self, text):
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_single_line); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_single_line, __pyx_t_2) < (0)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":171
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):             # <<<<<<<<<<<<<<
 *         self.buffer = buffer
 *         self.width = 0
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.StdPrinter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":177
 *         self.single_line = bool(single_line)
 * 
 *     def update(self, text):             # <<<<<<<<<<<<<<
 *         text = str(text)
 *         if self.single_line:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10StdPrinter_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10StdPrinter_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 177, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 177, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 177, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(0, 177, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, i); __PYX_ERR(0, 177, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 177, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 177, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 177, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.StdPrinter.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10StdPrinter_2update(__pyx_self, __pyx_v_self, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10StdPrinter_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text) {
  PyObject *__pyx_v_ln = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "H2MM_C.pyx":178
 * 
 *     def update(self, text):
 *         text = str(text)             # <<<<<<<<<<<<<<
 *         if self.single_line:
 *             text = text.replace('\n', ' ')
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":179
 *     def update(self, text):
 *         text = str(text)
 *         if self.single_line:             # <<<<<<<<<<<<<<
 *             text = text.replace('\n', ' ')
 *         if self.keep:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_single_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":180
 *         text = str(text)
 *         if self.single_line:
 *             text = text.replace('\n', ' ')             # <<<<<<<<<<<<<<
 *         if self.keep:
 *             text = text + '\n'
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_mstate_global->__pyx_n_u_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[2], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":179
 *     def update(self, text):
 *         text = str(text)
 *         if self.single_line:             # <<<<<<<<<<<<<<
 *             text = text.replace('\n', ' ')
 *         if self.keep:
*/
  }

  /* "H2MM_C.pyx":181
 *         if self.single_line:
 *             text = text.replace('\n', ' ')
 *         if self.keep:             # <<<<<<<<<<<<<<
 *             text = text + '\n'
 *         else:
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_keep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":182
 *             text = text.replace('\n', ' ')
 *         if self.keep:
 *             text = text + '\n'             # <<<<<<<<<<<<<<
 *         else:
 *             ln = len(text)
*/
    __pyx_t_3 = PyNumber_Add(__pyx_v_text, __pyx_mstate_global->__pyx_kp_u__12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":181
 *         if self.single_line:
 *             text = text.replace('\n', ' ')
 *         if self.keep:             # <<<<<<<<<<<<<<
 *             text = text + '\n'
 *         else:
*/
    goto __pyx_L4;
  }

  /* "H2MM_C.pyx":184
 *             text = text + '\n'
 *         else:
 *             ln = len(text)             # <<<<<<<<<<<<<<
 *             text = '\r' + text + ' '*(self.width - ln)
 *             if ln > self.width:
*/
  /*else*/ {
    __pyx_t_4 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 184, __pyx_L1_error)
    __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_ln = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":185
 *         else:
 *             ln = len(text)
 *             text = '\r' + text + ' '*(self.width - ln)             # <<<<<<<<<<<<<<
 *             if ln > self.width:
 *                 self.width = ln
*/
    __pyx_t_3 = PyNumber_Add(__pyx_mstate_global->__pyx_kp_u__14, __pyx_v_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_v_ln); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_mstate_global->__pyx_kp_u__13, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __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_DECREF_SET(__pyx_v_text, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "H2MM_C.pyx":186
 *             ln = len(text)
 *             text = '\r' + text + ' '*(self.width - ln)
 *             if ln > self.width:             # <<<<<<<<<<<<<<
 *                 self.width = ln
 *         self.buffer.write(text)
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_ln, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":187
 *             text = '\r' + text + ' '*(self.width - ln)
 *             if ln > self.width:
 *                 self.width = ln             # <<<<<<<<<<<<<<
 *         self.buffer.write(text)
 *         self.buffer.flush()
*/
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_width, __pyx_v_ln) < (0)) __PYX_ERR(0, 187, __pyx_L1_error)

      /* "H2MM_C.pyx":186
 *             ln = len(text)
 *             text = '\r' + text + ' '*(self.width - ln)
 *             if ln > self.width:             # <<<<<<<<<<<<<<
 *                 self.width = ln
 *         self.buffer.write(text)
*/
    }
  }
  __pyx_L4:;

  /* "H2MM_C.pyx":188
 *             if ln > self.width:
 *                 self.width = ln
 *         self.buffer.write(text)             # <<<<<<<<<<<<<<
 *         self.buffer.flush()
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_text};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H2MM_C.pyx":189
 *                 self.width = ln
 *         self.buffer.write(text)
 *         self.buffer.flush()             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H2MM_C.pyx":177
 *         self.single_line = bool(single_line)
 * 
 *     def update(self, text):             # <<<<<<<<<<<<<<
 *         text = str(text)
 *         if self.single_line:
*/

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("H2MM_C.StdPrinter.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ln);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":191
 *         self.buffer.flush()
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         self.buffer.write("\n")
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_5close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10StdPrinter_5close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10StdPrinter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10StdPrinter_5close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 191, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 191, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "close", 0) < (0)) __PYX_ERR(0, 191, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, i); __PYX_ERR(0, 191, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 191, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 191, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.StdPrinter.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10StdPrinter_4close(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10StdPrinter_4close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "H2MM_C.pyx":192
 * 
 *     def close(self):
 *         self.buffer.write("\n")             # <<<<<<<<<<<<<<
 * 
 * has_ipython = False
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__12};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H2MM_C.pyx":191
 *         self.buffer.flush()
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         self.buffer.write("\n")
 * 
*/

  /* 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("H2MM_C.StdPrinter.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":211
 *             Whether to keep old output or replace with new. The default is False
 *         """
 *         def __init__(self, buffer, keep=False):             # <<<<<<<<<<<<<<
 *             self.buffer = buffer
 *             self.keep = bool(keep)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10IPyPrinter_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10IPyPrinter_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_keep = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_buffer,&__pyx_mstate_global->__pyx_n_u_keep,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 211, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 211, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 211, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 211, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, i); __PYX_ERR(0, 211, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 211, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 211, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    }
    __pyx_v_self = values[0];
    __pyx_v_buffer = values[1];
    __pyx_v_keep = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 211, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPrinter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10IPyPrinter___init__(__pyx_self, __pyx_v_self, __pyx_v_buffer, __pyx_v_keep);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_keep) {
  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;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "H2MM_C.pyx":212
 *         """
 *         def __init__(self, buffer, keep=False):
 *             self.buffer = buffer             # <<<<<<<<<<<<<<
 *             self.keep = bool(keep)
 *             self.text = Pretty("")
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer, __pyx_v_buffer) < (0)) __PYX_ERR(0, 212, __pyx_L1_error)

  /* "H2MM_C.pyx":213
 *         def __init__(self, buffer, keep=False):
 *             self.buffer = buffer
 *             self.keep = bool(keep)             # <<<<<<<<<<<<<<
 *             self.text = Pretty("")
 *             self.buffer.display(self.text)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_keep); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_keep, __pyx_t_2) < (0)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":214
 *             self.buffer = buffer
 *             self.keep = bool(keep)
 *             self.text = Pretty("")             # <<<<<<<<<<<<<<
 *             self.buffer.display(self.text)
 * 
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Pretty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text, __pyx_t_2) < (0)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":215
 *             self.keep = bool(keep)
 *             self.text = Pretty("")
 *             self.buffer.display(self.text)             # <<<<<<<<<<<<<<
 * 
 *         def update(self, text):
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_display, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":211
 *             Whether to keep old output or replace with new. The default is False
 *         """
 *         def __init__(self, buffer, keep=False):             # <<<<<<<<<<<<<<
 *             self.buffer = buffer
 *             self.keep = bool(keep)
*/

  /* 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_6);
  __Pyx_AddTraceback("H2MM_C.IPyPrinter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":217
 *             self.buffer.display(self.text)
 * 
 *         def update(self, text):             # <<<<<<<<<<<<<<
 *             """
 *             Update display with text in text
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10IPyPrinter_2update, "\n            Update display with text in text\n            \n            Parameters\n            ----------\n            text: str\n                Text to display\n            \n            Returns\n            -------\n            None\n            \n            ");
static PyMethodDef __pyx_mdef_6H2MM_C_10IPyPrinter_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10IPyPrinter_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10IPyPrinter_2update};
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_text = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_text,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 217, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 217, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 217, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(0, 217, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, i); __PYX_ERR(0, 217, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 217, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 217, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_text = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 217, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPrinter.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10IPyPrinter_2update(__pyx_self, __pyx_v_self, __pyx_v_text);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_text) {
  CYTHON_UNUSED PyObject *__pyx_v_test = NULL;
  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;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "H2MM_C.pyx":231
 * 
 *             """
 *             test = str(text)             # <<<<<<<<<<<<<<
 *             if self.keep:
 *                 self.text.data =self.text.data + '\n' + text if self.text.data else text
*/
  __pyx_t_1 = __Pyx_PyObject_Unicode(__pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_test = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":232
 *             """
 *             test = str(text)
 *             if self.keep:             # <<<<<<<<<<<<<<
 *                 self.text.data =self.text.data + '\n' + text if self.text.data else text
 *             else:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_keep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":233
 *             test = str(text)
 *             if self.keep:
 *                 self.text.data =self.text.data + '\n' + text if self.text.data else text             # <<<<<<<<<<<<<<
 *             else:
 *                 self.text.data = text
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __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, 233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __Pyx_INCREF(__pyx_v_text);
      __pyx_t_1 = __pyx_v_text;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_1) < (0)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":232
 *             """
 *             test = str(text)
 *             if self.keep:             # <<<<<<<<<<<<<<
 *                 self.text.data =self.text.data + '\n' + text if self.text.data else text
 *             else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":235
 *                 self.text.data =self.text.data + '\n' + text if self.text.data else text
 *             else:
 *                 self.text.data = text             # <<<<<<<<<<<<<<
 *             self.buffer.update(self.text)
 * 
*/
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_data, __pyx_v_text) < (0)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":236
 *             else:
 *                 self.text.data = text
 *             self.buffer.update(self.text)             # <<<<<<<<<<<<<<
 * 
 *         def close(self):
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "H2MM_C.pyx":217
 *             self.buffer.display(self.text)
 * 
 *         def update(self, text):             # <<<<<<<<<<<<<<
 *             """
 *             Update display with text in text
*/

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("H2MM_C.IPyPrinter.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_test);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":238
 *             self.buffer.update(self.text)
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             pass
 *     try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_5close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10IPyPrinter_5close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10IPyPrinter_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10IPyPrinter_5close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 238, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 238, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "close", 0) < (0)) __PYX_ERR(0, 238, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, i); __PYX_ERR(0, 238, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 238, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 238, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPrinter.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10IPyPrinter_4close(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10IPyPrinter_4close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_7IPyPlot_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7IPyPlot_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_stream = 0;
  PyObject *__pyx_v_nrows = 0;
  PyObject *__pyx_v_ncols = 0;
  PyObject *__pyx_v_xlim = 0;
  PyObject *__pyx_v_ylim = 0;
  PyObject *__pyx_v_plot_kwargs = 0;
  PyObject *__pyx_v_plot_type = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_stream,&__pyx_mstate_global->__pyx_n_u_nrows,&__pyx_mstate_global->__pyx_n_u_ncols,&__pyx_mstate_global->__pyx_n_u_xlim,&__pyx_mstate_global->__pyx_n_u_ylim,&__pyx_mstate_global->__pyx_n_u_plot_kwargs,&__pyx_mstate_global->__pyx_n_u_plot_type,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 280, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(0, 280, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));

      /* "H2MM_C.pyx":281
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),             # <<<<<<<<<<<<<<
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
 *                 if len(xlim) != nrows or len(ylim) != nrows:
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[5])));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[5])));

      /* "H2MM_C.pyx":282
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):             # <<<<<<<<<<<<<<
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[7])));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 8, i); __PYX_ERR(0, 280, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 280, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 280, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 280, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[5])));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[5])));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_tuple[7])));
    }
    __pyx_v_self = values[0];
    __pyx_v_stream = values[1];
    __pyx_v_nrows = values[2];
    __pyx_v_ncols = values[3];
    __pyx_v_xlim = values[4];
    __pyx_v_ylim = values[5];
    __pyx_v_plot_kwargs = values[6];
    __pyx_v_plot_type = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 8, __pyx_nargs); __PYX_ERR(0, 280, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("H2MM_C.IPyPlot.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7IPyPlot___init__(__pyx_self, __pyx_v_self, __pyx_v_stream, __pyx_v_nrows, __pyx_v_ncols, __pyx_v_xlim, __pyx_v_ylim, __pyx_v_plot_kwargs, __pyx_v_plot_type, __pyx_v_kwargs);

  /* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":285
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
*/

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 285, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_7IPyPlot_8__init___2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_IPyPlot___init___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.IPyPlot.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 285, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 285, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 285, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    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, 285, __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_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __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_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_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_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 285, __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, 285, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_y, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_10 = PyObject_Length(__pyx_cur_scope->__pyx_v_x); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 285, __pyx_L1_error)
    __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_ncols)) { __Pyx_RaiseClosureNameError("ncols"); __PYX_ERR(0, 285, __pyx_L1_error) }
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_ncols, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_11) {
    } else {
      __pyx_t_9 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_10 = PyObject_Length(__pyx_cur_scope->__pyx_v_y); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 285, __pyx_L1_error)
    __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_ncols)) { __Pyx_RaiseClosureNameError("ncols"); __PYX_ERR(0, 285, __pyx_L1_error) }
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_ncols, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_9) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  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_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":287
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream
*/

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 287, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_7IPyPlot_8__init___5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_IPyPlot___init___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.IPyPlot.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 287, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 287, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 287, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    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, 287, __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_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 287, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 287, __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_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_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_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 287, __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, 287, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_y, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_10 = PyObject_Length(__pyx_cur_scope->__pyx_v_x); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
    __pyx_t_11 = (__pyx_t_10 != 2);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_9 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_10 = PyObject_Length(__pyx_cur_scope->__pyx_v_y); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
    __pyx_t_11 = (__pyx_t_10 != 2);
    __pyx_t_9 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_9) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  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_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_8__init___6genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 287, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_7IPyPlot_8__init___8generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_IPyPlot___init___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.IPyPlot.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___8generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 287, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 287, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 287, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    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, 287, __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_INCREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_6);
      } else {
        __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 287, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
      }
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 287, __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_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_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_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 287, __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, 287, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xx);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xx, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_yy);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_yy, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_xx, __pyx_cur_scope->__pyx_v_yy};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L8_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 287, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* 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_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_nrows, PyObject *__pyx_v_ncols, PyObject *__pyx_v_xlim, PyObject *__pyx_v_ylim, PyObject *__pyx_v_plot_kwargs, PyObject *__pyx_v_plot_type, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *__pyx_cur_scope;
  PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___2generator = 0;
  PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___5generator1 = 0;
  PyObject *__pyx_gb_6H2MM_C_7IPyPlot_8__init___8generator2 = 0;
  CYTHON_UNUSED PyObject *__pyx_8genexpr3__pyx_v_i = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr4__pyx_v_j = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  size_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)__pyx_tp_new_6H2MM_C___pyx_scope_struct____init__(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 280, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_ncols = __pyx_v_ncols;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ncols);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ncols);

  /* "H2MM_C.pyx":283
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
 *                 if len(xlim) != nrows or len(ylim) != nrows:             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_xlim); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 283, __pyx_L1_error)
  __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_nrows, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_Length(__pyx_v_ylim); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 283, __pyx_L1_error)
  __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_v_nrows, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":284
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")             # <<<<<<<<<<<<<<
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_xlim_and_ylim_must_be_nrow_x_nco};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __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(0, 284, __pyx_L1_error)

    /* "H2MM_C.pyx":283
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
 *                 if len(xlim) != nrows or len(ylim) != nrows:             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
*/
  }

  /* "H2MM_C.pyx":285
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
*/
  __pyx_t_4 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_xlim, __pyx_v_ylim};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_4 = __pyx_pf_6H2MM_C_7IPyPlot_8__init___genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":286
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")             # <<<<<<<<<<<<<<
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_xlim_and_ylim_must_be_nrow_x_nco_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __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(0, 286, __pyx_L1_error)

    /* "H2MM_C.pyx":285
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
*/
  }

  /* "H2MM_C.pyx":287
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_chain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_from_iterable); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_v_xlim, __pyx_v_ylim};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_9 = __pyx_pf_6H2MM_C_7IPyPlot_8__init___6genexpr(NULL, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_8 = __pyx_pf_6H2MM_C_7IPyPlot_8__init___3genexpr(NULL, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":288
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")             # <<<<<<<<<<<<<<
 *                 self.stream = stream
 *                 self.nrows = nrows
*/
    __pyx_t_8 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_xlim_and_ylim_must_be_nrow_x_nco_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __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(0, 288, __pyx_L1_error)

    /* "H2MM_C.pyx":287
 *                 if any(len(x) != ncols or len(y) != ncols for x, y in zip(xlim, ylim)):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):             # <<<<<<<<<<<<<<
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream
*/
  }

  /* "H2MM_C.pyx":289
 *                 if any(len(x) != 2 or len(y) != 2 for x, y in chain.from_iterable(zip(xx,yy) for xx, yy in zip(xlim, ylim))):
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream             # <<<<<<<<<<<<<<
 *                 self.nrows = nrows
 *                 self.ncols = ncols
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_stream, __pyx_v_stream) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)

  /* "H2MM_C.pyx":290
 *                     raise ValueError("xlim and ylim must be nrow x ncol x 2 array")
 *                 self.stream = stream
 *                 self.nrows = nrows             # <<<<<<<<<<<<<<
 *                 self.ncols = ncols
 *                 self.data = False
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows, __pyx_v_nrows) < (0)) __PYX_ERR(0, 290, __pyx_L1_error)

  /* "H2MM_C.pyx":291
 *                 self.stream = stream
 *                 self.nrows = nrows
 *                 self.ncols = ncols             # <<<<<<<<<<<<<<
 *                 self.data = False
 *                 self.xlim = xlim
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols, __pyx_cur_scope->__pyx_v_ncols) < (0)) __PYX_ERR(0, 291, __pyx_L1_error)

  /* "H2MM_C.pyx":292
 *                 self.nrows = nrows
 *                 self.ncols = ncols
 *                 self.data = False             # <<<<<<<<<<<<<<
 *                 self.xlim = xlim
 *                 self.ylim = ylim
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data, Py_False) < (0)) __PYX_ERR(0, 292, __pyx_L1_error)

  /* "H2MM_C.pyx":293
 *                 self.ncols = ncols
 *                 self.data = False
 *                 self.xlim = xlim             # <<<<<<<<<<<<<<
 *                 self.ylim = ylim
 *                 self.kwargs = kwargs
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_xlim, __pyx_v_xlim) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)

  /* "H2MM_C.pyx":294
 *                 self.data = False
 *                 self.xlim = xlim
 *                 self.ylim = ylim             # <<<<<<<<<<<<<<
 *                 self.kwargs = kwargs
 *                 self.plot_type = plot_type
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ylim, __pyx_v_ylim) < (0)) __PYX_ERR(0, 294, __pyx_L1_error)

  /* "H2MM_C.pyx":295
 *                 self.xlim = xlim
 *                 self.ylim = ylim
 *                 self.kwargs = kwargs             # <<<<<<<<<<<<<<
 *                 self.plot_type = plot_type
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_kwargs, __pyx_v_kwargs) < (0)) __PYX_ERR(0, 295, __pyx_L1_error)

  /* "H2MM_C.pyx":296
 *                 self.ylim = ylim
 *                 self.kwargs = kwargs
 *                 self.plot_type = plot_type             # <<<<<<<<<<<<<<
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_plot_type, __pyx_v_plot_type) < (0)) __PYX_ERR(0, 296, __pyx_L1_error)

  /* "H2MM_C.pyx":297
 *                 self.kwargs = kwargs
 *                 self.plot_type = plot_type
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]             # <<<<<<<<<<<<<<
 * 
 *             def update(self, data):
*/
  __pyx_t_1 = (__pyx_v_plot_kwargs != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_plot_kwargs);
    __pyx_t_3 = __pyx_v_plot_kwargs;
  } else {
    { /* enter inner scope */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_nrows};
        __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_t_4 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 297, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      for (;;) {
        {
          __pyx_t_9 = __pyx_t_10(__pyx_t_4);
          if (unlikely(!__pyx_t_9)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 297, __pyx_L10_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_i, __pyx_t_9);
        __pyx_t_9 = 0;
        { /* enter inner scope */
          __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = NULL;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_cur_scope->__pyx_v_ncols};
            __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 297, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 297, __pyx_L15_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          for (;;) {
            {
              __pyx_t_7 = __pyx_t_12(__pyx_t_11);
              if (unlikely(!__pyx_t_7)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 297, __pyx_L15_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_j, __pyx_t_7);
            __pyx_t_7 = 0;
            __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_13 = PyList_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 297, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_7);
            if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 297, __pyx_L15_error);
            __pyx_t_7 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 297, __pyx_L15_error)
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_j); __pyx_8genexpr4__pyx_v_j = 0;
          goto __pyx_L19_exit_scope;
          __pyx_L15_error:;
          __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_j); __pyx_8genexpr4__pyx_v_j = 0;
          goto __pyx_L10_error;
          __pyx_L19_exit_scope:;
        } /* exit inner scope */
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 297, __pyx_L10_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_i); __pyx_8genexpr3__pyx_v_i = 0;
      goto __pyx_L21_exit_scope;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_i); __pyx_8genexpr3__pyx_v_i = 0;
      goto __pyx_L1_error;
      __pyx_L21_exit_scope:;
    } /* exit inner scope */
    __pyx_t_3 = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_plot_kwargs, __pyx_t_3) < (0)) __PYX_ERR(0, 297, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("H2MM_C.IPyPlot.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_7IPyPlot_8__init___2generator);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_7IPyPlot_8__init___5generator1);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_7IPyPlot_8__init___8generator2);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_j);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":299
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]
 * 
 *             def update(self, data):             # <<<<<<<<<<<<<<
 *                 """
 *                 Update plot with new data points
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_7IPyPlot_2update, "\n                Update plot with new data points\n\n                Parameters\n                ----------\n                data : list[list[np.ndarray]]\n                    An array-like nrow x ncol object, with each pair of elements\n                    being an x-y value pair to plot.\n\n                Returns\n                -------\n                None.\n\n                ");
static PyMethodDef __pyx_mdef_6H2MM_C_7IPyPlot_3update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7IPyPlot_3update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_7IPyPlot_2update};
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_3update(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_data,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 299, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 299, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 299, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "update", 0) < (0)) __PYX_ERR(0, 299, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, i); __PYX_ERR(0, 299, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 299, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 299, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 299, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPlot.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7IPyPlot_2update(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_fig = NULL;
  PyObject *__pyx_v_ax = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_xlim = NULL;
  PyObject *__pyx_v_ylim = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "H2MM_C.pyx":314
 * 
 *                 """
 *                 if isinstance(data, str):             # <<<<<<<<<<<<<<
 *                     return
 *                 if self.data is False:
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_data); 
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":315
 *                 """
 *                 if isinstance(data, str):
 *                     return             # <<<<<<<<<<<<<<
 *                 if self.data is False:
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "H2MM_C.pyx":314
 * 
 *                 """
 *                 if isinstance(data, str):             # <<<<<<<<<<<<<<
 *                     return
 *                 if self.data is False:
*/
  }

  /* "H2MM_C.pyx":316
 *                 if isinstance(data, str):
 *                     return
 *                 if self.data is False:             # <<<<<<<<<<<<<<
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_t_2 == Py_False);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":317
 *                     return
 *                 if self.data is False:
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)             # <<<<<<<<<<<<<<
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
 *                         self.data[i,j] = data[i][j][np.newaxis]
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 317, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 317, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_7};
      __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_4, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 317, __pyx_L1_error)
      __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_2) < (0)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H2MM_C.pyx":318
 *                 if self.data is False:
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
 *                     for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                         self.data[i,j] = data[i][j][np.newaxis]
 *                 else:
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_product); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = NULL;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 318, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 318, __pyx_L1_error)
            #endif
            if (__pyx_t_10 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_10;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 318, __pyx_L1_error)
            #endif
            if (__pyx_t_10 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_10);
          #endif
          ++__pyx_t_10;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_11(__pyx_t_6);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 318, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __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, 318, __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_INCREF(__pyx_t_3);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_4);
        } else {
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_4);
        }
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 318, __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, 318, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
        index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_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_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 318, __pyx_L1_error)
        __pyx_t_12 = 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_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 318, __pyx_L1_error)
        __pyx_L8_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":319
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
 *                         self.data[i,j] = data[i][j][np.newaxis]             # <<<<<<<<<<<<<<
 *                 else:
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
*/
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_newaxis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __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_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 319, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 319, __pyx_L1_error);
      if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_t_4, __pyx_t_2) < 0))) __PYX_ERR(0, 319, __pyx_L1_error)
      __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;

      /* "H2MM_C.pyx":318
 *                 if self.data is False:
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
 *                     for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                         self.data[i,j] = data[i][j][np.newaxis]
 *                 else:
*/
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "H2MM_C.pyx":316
 *                 if isinstance(data, str):
 *                     return
 *                 if self.data is False:             # <<<<<<<<<<<<<<
 *                     self.data = np.empty((self.nrows, self.ncols), dtype=np.object_)
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
*/
    goto __pyx_L4;
  }

  /* "H2MM_C.pyx":321
 *                         self.data[i,j] = data[i][j][np.newaxis]
 *                 else:
 *                     for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                         self.data[i,j] = np.concatenate([self.data[i,j], data[i][j][np.newaxis]])
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
*/
  /*else*/ {
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_product); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = NULL;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 321, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 321, __pyx_L1_error)
            #endif
            if (__pyx_t_10 >= __pyx_temp) break;
          }
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_10;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 321, __pyx_L1_error)
            #endif
            if (__pyx_t_10 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10));
          #else
          __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10);
          #endif
          ++__pyx_t_10;
        }
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error)
      } else {
        __pyx_t_6 = __pyx_t_11(__pyx_t_4);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 321, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_6);
      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, 321, __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_INCREF(__pyx_t_9);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_3);
        } else {
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_3);
        }
        #else
        __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
        index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_3 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 321, __pyx_L1_error)
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 321, __pyx_L1_error)
        __pyx_L13_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":322
 *                 else:
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
 *                         self.data[i,j] = np.concatenate([self.data[i,j], data[i][j][np.newaxis]])             # <<<<<<<<<<<<<<
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
 *                 ax = np.atleast_2d(ax)
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_data, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_j); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_newaxis); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyList_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_8 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_13};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 322, __pyx_L1_error);
      if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_13, __pyx_t_6) < 0))) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "H2MM_C.pyx":321
 *                         self.data[i,j] = data[i][j][np.newaxis]
 *                 else:
 *                     for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                         self.data[i,j] = np.concatenate([self.data[i,j], data[i][j][np.newaxis]])
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
*/
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "H2MM_C.pyx":323
 *                     for i, j in product(range(self.nrows), range(self.ncols)):
 *                         self.data[i,j] = np.concatenate([self.data[i,j], data[i][j][np.newaxis]])
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)             # <<<<<<<<<<<<<<
 *                 ax = np.atleast_2d(ax)
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_plt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_subplots); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 323, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_t_5))) {
    #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API
    if (__Pyx_IS_UNIQUELY_REFERENCED(__pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference)) {
      __pyx_t_7 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyDict_Copy(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  } else {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_13, __pyx_t_3};
    __pyx_t_4 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  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, 323, __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_INCREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_7);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 323, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_7);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #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, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
    index = 0; __pyx_t_2 = __pyx_t_12(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_12(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 323, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L16_unpacking_done;
    __pyx_L15_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 323, __pyx_L1_error)
    __pyx_L16_unpacking_done:;
  }
  __pyx_v_fig = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ax = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":324
 *                         self.data[i,j] = np.concatenate([self.data[i,j], data[i][j][np.newaxis]])
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
 *                 ax = np.atleast_2d(ax)             # <<<<<<<<<<<<<<
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
 *                     for k in range(self.data[i,j].shape[1]//2):
*/
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_atleast_2d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_ax};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF_SET(__pyx_v_ax, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":325
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
 *                 ax = np.atleast_2d(ax)
 *                 for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                     for k in range(self.data[i,j].shape[1]//2):
 *                         if self.plot_type[i][j] == 'plot':
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_product); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_13 = NULL;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nrows); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_13 = NULL;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ncols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_5};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_8 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_8 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_6};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_7 = __pyx_t_4; __Pyx_INCREF(__pyx_t_7);
    __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 325, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_7))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 325, __pyx_L1_error)
          #endif
          if (__pyx_t_10 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_10;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 325, __pyx_L1_error)
          #endif
          if (__pyx_t_10 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_10);
        #endif
        ++__pyx_t_10;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_11(__pyx_t_7);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 325, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    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, 325, __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_INCREF(__pyx_t_6);
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_2);
      } else {
        __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_6);
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_2);
      }
      #else
      __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __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_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
      index = 0; __pyx_t_6 = __pyx_t_12(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L19_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_2 = __pyx_t_12(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L19_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 325, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L20_unpacking_done;
      __pyx_L19_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 325, __pyx_L1_error)
      __pyx_L20_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":326
 *                 ax = np.atleast_2d(ax)
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
 *                     for k in range(self.data[i,j].shape[1]//2):             # <<<<<<<<<<<<<<
 *                         if self.plot_type[i][j] == 'plot':
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])
*/
    __pyx_t_2 = NULL;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 326, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 326, __pyx_L1_error);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyLong_FloorDivideObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 326, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      {
        __pyx_t_4 = __pyx_t_14(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 326, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":327
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
 *                     for k in range(self.data[i,j].shape[1]//2):
 *                         if self.plot_type[i][j] == 'plot':             # <<<<<<<<<<<<<<
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])
 *                         else:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_plot_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_plot, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {

        /* "H2MM_C.pyx":328
 *                     for k in range(self.data[i,j].shape[1]//2):
 *                         if self.plot_type[i][j] == 'plot':
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])             # <<<<<<<<<<<<<<
 *                         else:
 *                             ax[i,j].scatter(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1], **self.plot_kwargs[i][j][k])
*/
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_ax, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_2 = __pyx_t_6;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_i, 2, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_13);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_13) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_i, 2, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_5);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
        __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_8 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_13, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_plot, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "H2MM_C.pyx":327
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
 *                     for k in range(self.data[i,j].shape[1]//2):
 *                         if self.plot_type[i][j] == 'plot':             # <<<<<<<<<<<<<<
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])
 *                         else:
*/
        goto __pyx_L23;
      }

      /* "H2MM_C.pyx":330
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])
 *                         else:
 *                             ax[i,j].scatter(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1], **self.plot_kwargs[i][j][k])             # <<<<<<<<<<<<<<
 *                         xlim, ylim = self._get_xylim(i,j)
 *                         ax[i,j].set_xlim(xlim)
*/
      /*else*/ {
        __pyx_t_6 = NULL;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_ax, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_scatter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_13, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_i, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_j);
        __Pyx_GIVEREF(__pyx_v_j);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_i, 2, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_13);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_13) != (0)) __PYX_ERR(0, 330, __pyx_L1_error);
        __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_plot_kwargs); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_v_j); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(__pyx_t_16 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 330, __pyx_L1_error)
        }
        if (likely(PyDict_CheckExact(__pyx_t_16))) {
          #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API
          if (__Pyx_IS_UNIQUELY_REFERENCED(__pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference)) {
            __pyx_t_9 = __pyx_t_16;
            __pyx_t_16 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyDict_Copy(__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          }
        } else {
          __pyx_t_9 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 330, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __pyx_t_8 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_8 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_13};
          __pyx_t_4 = __Pyx_PyObject_FastCallDict((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L23:;

      /* "H2MM_C.pyx":331
 *                         else:
 *                             ax[i,j].scatter(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1], **self.plot_kwargs[i][j][k])
 *                         xlim, ylim = self._get_xylim(i,j)             # <<<<<<<<<<<<<<
 *                         ax[i,j].set_xlim(xlim)
 *                         ax[i,j].set_ylim(ylim)
*/
      __pyx_t_5 = __pyx_v_self;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_i, __pyx_v_j};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_xylim, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      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, 331, __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_INCREF(__pyx_t_5);
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 331, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_9);
        }
        #else
        __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13);
        index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 331, __pyx_L1_error)
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L25_unpacking_done;
        __pyx_L24_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 331, __pyx_L1_error)
        __pyx_L25_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_xlim, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ylim, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "H2MM_C.pyx":332
 *                             ax[i,j].scatter(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1], **self.plot_kwargs[i][j][k])
 *                         xlim, ylim = self._get_xylim(i,j)
 *                         ax[i,j].set_xlim(xlim)             # <<<<<<<<<<<<<<
 *                         ax[i,j].set_ylim(ylim)
 *                 if self.data.shape[0] == 1:
*/
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 332, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 332, __pyx_L1_error);
      __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_ax, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __pyx_t_13;
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_xlim};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_xlim, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":333
 *                         xlim, ylim = self._get_xylim(i,j)
 *                         ax[i,j].set_xlim(xlim)
 *                         ax[i,j].set_ylim(ylim)             # <<<<<<<<<<<<<<
 *                 if self.data.shape[0] == 1:
 *                     self.stream.display(fig)
*/
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 333, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 333, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_ax, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_13 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_ylim};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_ylim, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":326
 *                 ax = np.atleast_2d(ax)
 *                 for i, j in product(range(self.nrows), range(self.ncols)):
 *                     for k in range(self.data[i,j].shape[1]//2):             # <<<<<<<<<<<<<<
 *                         if self.plot_type[i][j] == 'plot':
 *                             ax[i,j].plot(self.data[i,j][:,2*i], self.data[i,j][:,2*i+1])
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":325
 *                 fig, ax = plt.subplots(self.nrows, self.ncols, **self.kwargs)
 *                 ax = np.atleast_2d(ax)
 *                 for i, j in product(range(self.nrows), range(self.ncols)):             # <<<<<<<<<<<<<<
 *                     for k in range(self.data[i,j].shape[1]//2):
 *                         if self.plot_type[i][j] == 'plot':
*/
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "H2MM_C.pyx":334
 *                         ax[i,j].set_xlim(xlim)
 *                         ax[i,j].set_ylim(ylim)
 *                 if self.data.shape[0] == 1:             # <<<<<<<<<<<<<<
 *                     self.stream.display(fig)
 *                 else:
*/
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_7, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":335
 *                         ax[i,j].set_ylim(ylim)
 *                 if self.data.shape[0] == 1:
 *                     self.stream.display(fig)             # <<<<<<<<<<<<<<
 *                 else:
 *                     clear_output()
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_stream); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_fig};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_display, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":334
 *                         ax[i,j].set_xlim(xlim)
 *                         ax[i,j].set_ylim(ylim)
 *                 if self.data.shape[0] == 1:             # <<<<<<<<<<<<<<
 *                     self.stream.display(fig)
 *                 else:
*/
    goto __pyx_L28;
  }

  /* "H2MM_C.pyx":337
 *                     self.stream.display(fig)
 *                 else:
 *                     clear_output()             # <<<<<<<<<<<<<<
 *                     self.stream.update(fig)
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_clear_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":338
 *                 else:
 *                     clear_output()
 *                     self.stream.update(fig)             # <<<<<<<<<<<<<<
 * 
 *             def _get_xylim(self, i, j):
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_stream); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_fig};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_L28:;

  /* "H2MM_C.pyx":299
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]
 * 
 *             def update(self, data):             # <<<<<<<<<<<<<<
 *                 """
 *                 Update plot with new data points
*/

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("H2MM_C.IPyPlot.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_fig);
  __Pyx_XDECREF(__pyx_v_ax);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_xlim);
  __Pyx_XDECREF(__pyx_v_ylim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":340
 *                     self.stream.update(fig)
 * 
 *             def _get_xylim(self, i, j):             # <<<<<<<<<<<<<<
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_5_get_xylim(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_7IPyPlot_5_get_xylim = {"_get_xylim", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7IPyPlot_5_get_xylim, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_5_get_xylim(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_i = 0;
  PyObject *__pyx_v_j = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_xylim (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_i,&__pyx_mstate_global->__pyx_n_u_j,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 340, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 340, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 340, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 340, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_xylim", 0) < (0)) __PYX_ERR(0, 340, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_xylim", 1, 3, 3, i); __PYX_ERR(0, 340, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 340, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 340, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 340, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_i = values[1];
    __pyx_v_j = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_xylim", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 340, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPlot._get_xylim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7IPyPlot_4_get_xylim(__pyx_self, __pyx_v_self, __pyx_v_i, __pyx_v_j);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_4_get_xylim(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
  PyObject *__pyx_v_xmin = NULL;
  PyObject *__pyx_v_xmax = NULL;
  PyObject *__pyx_v_ymin = NULL;
  PyObject *__pyx_v_ymax = 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 *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_xylim", 0);

  /* "H2MM_C.pyx":341
 * 
 *             def _get_xylim(self, i, j):
 *                 xmin, xmax = self.xlim[i][j]             # <<<<<<<<<<<<<<
 *                 if xmin == 'min':
 *                     xmin = np.min(self.data[i,j][:,::2])
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_xlim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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, 341, __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_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
    }
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __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, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    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, 341, __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, 341, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_xmin = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_xmax = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":342
 *             def _get_xylim(self, i, j):
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':             # <<<<<<<<<<<<<<
 *                     xmin = np.min(self.data[i,j][:,::2])
 *                 if xmax == 'max':
*/
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_xmin, __pyx_mstate_global->__pyx_n_u_min, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 342, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":343
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':
 *                     xmin = np.min(self.data[i,j][:,::2])             # <<<<<<<<<<<<<<
 *                 if xmax == 'max':
 *                     xmax = np.max(self.data[i,j][:,::2])
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_xmin, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":342
 *             def _get_xylim(self, i, j):
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':             # <<<<<<<<<<<<<<
 *                     xmin = np.min(self.data[i,j][:,::2])
 *                 if xmax == 'max':
*/
  }

  /* "H2MM_C.pyx":344
 *                 if xmin == 'min':
 *                     xmin = np.min(self.data[i,j][:,::2])
 *                 if xmax == 'max':             # <<<<<<<<<<<<<<
 *                     xmax = np.max(self.data[i,j][:,::2])
 *                 ymin, ymax = self.ylim[i][j]
*/
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_xmax, __pyx_mstate_global->__pyx_n_u_max, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 344, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":345
 *                     xmin = np.min(self.data[i,j][:,::2])
 *                 if xmax == 'max':
 *                     xmax = np.max(self.data[i,j][:,::2])             # <<<<<<<<<<<<<<
 *                 ymin, ymax = self.ylim[i][j]
 *                 if ymin == 'min':
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 345, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 345, __pyx_L1_error);
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __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_t_8 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[8]); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_xmax, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":344
 *                 if xmin == 'min':
 *                     xmin = np.min(self.data[i,j][:,::2])
 *                 if xmax == 'max':             # <<<<<<<<<<<<<<
 *                     xmax = np.max(self.data[i,j][:,::2])
 *                 ymin, ymax = self.ylim[i][j]
*/
  }

  /* "H2MM_C.pyx":346
 *                 if xmax == 'max':
 *                     xmax = np.max(self.data[i,j][:,::2])
 *                 ymin, ymax = self.ylim[i][j]             # <<<<<<<<<<<<<<
 *                 if ymin == 'min':
 *                     ymin = np.min(self.data[i,j][:,1::2])
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ylim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __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, 346, __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_INCREF(__pyx_t_3);
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_8);
    } else {
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_8);
    }
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __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_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_8 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_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, 346, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_ymin = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_ymax = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "H2MM_C.pyx":347
 *                     xmax = np.max(self.data[i,j][:,::2])
 *                 ymin, ymax = self.ylim[i][j]
 *                 if ymin == 'min':             # <<<<<<<<<<<<<<
 *                     ymin = np.min(self.data[i,j][:,1::2])
 *                 if ymax == 'max':
*/
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_ymin, __pyx_mstate_global->__pyx_n_u_min, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 347, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":348
 *                 ymin, ymax = self.ylim[i][j]
 *                 if ymin == 'min':
 *                     ymin = np.min(self.data[i,j][:,1::2])             # <<<<<<<<<<<<<<
 *                 if ymax == 'max':
 *                     ymax = np.max(self.data[i,j][:,1::2])
*/
    __pyx_t_8 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 348, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 348, __pyx_L1_error);
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[9]); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_ymin, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":347
 *                     xmax = np.max(self.data[i,j][:,::2])
 *                 ymin, ymax = self.ylim[i][j]
 *                 if ymin == 'min':             # <<<<<<<<<<<<<<
 *                     ymin = np.min(self.data[i,j][:,1::2])
 *                 if ymax == 'max':
*/
  }

  /* "H2MM_C.pyx":349
 *                 if ymin == 'min':
 *                     ymin = np.min(self.data[i,j][:,1::2])
 *                 if ymax == 'max':             # <<<<<<<<<<<<<<
 *                     ymax = np.max(self.data[i,j][:,1::2])
 *                 if xmin == xmax:
*/
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_ymax, __pyx_mstate_global->__pyx_n_u_max, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 349, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":350
 *                     ymin = np.min(self.data[i,j][:,1::2])
 *                 if ymax == 'max':
 *                     ymax = np.max(self.data[i,j][:,1::2])             # <<<<<<<<<<<<<<
 *                 if xmin == xmax:
 *                     xmin -= 1.0
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 350, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_GIVEREF(__pyx_v_j);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 350, __pyx_L1_error);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[9]); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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 (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_ymax, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":349
 *                 if ymin == 'min':
 *                     ymin = np.min(self.data[i,j][:,1::2])
 *                 if ymax == 'max':             # <<<<<<<<<<<<<<
 *                     ymax = np.max(self.data[i,j][:,1::2])
 *                 if xmin == xmax:
*/
  }

  /* "H2MM_C.pyx":351
 *                 if ymax == 'max':
 *                     ymax = np.max(self.data[i,j][:,1::2])
 *                 if xmin == xmax:             # <<<<<<<<<<<<<<
 *                     xmin -= 1.0
 *                     xmax += 1.0
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_xmin, __pyx_v_xmax, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":352
 *                     ymax = np.max(self.data[i,j][:,1::2])
 *                 if xmin == xmax:
 *                     xmin -= 1.0             # <<<<<<<<<<<<<<
 *                     xmax += 1.0
 *                 if ymin == ymax:
*/
    __pyx_t_1 = __Pyx_PyFloat_SubtractObjC(__pyx_v_xmin, __pyx_mstate_global->__pyx_float_1_0, 1.0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_xmin, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":353
 *                 if xmin == xmax:
 *                     xmin -= 1.0
 *                     xmax += 1.0             # <<<<<<<<<<<<<<
 *                 if ymin == ymax:
 *                     ymin -= 1.0
*/
    __pyx_t_1 = __Pyx_PyFloat_AddObjC(__pyx_v_xmax, __pyx_mstate_global->__pyx_float_1_0, 1.0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_xmax, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":351
 *                 if ymax == 'max':
 *                     ymax = np.max(self.data[i,j][:,1::2])
 *                 if xmin == xmax:             # <<<<<<<<<<<<<<
 *                     xmin -= 1.0
 *                     xmax += 1.0
*/
  }

  /* "H2MM_C.pyx":354
 *                     xmin -= 1.0
 *                     xmax += 1.0
 *                 if ymin == ymax:             # <<<<<<<<<<<<<<
 *                     ymin -= 1.0
 *                     ymax += 1.0
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_ymin, __pyx_v_ymax, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":355
 *                     xmax += 1.0
 *                 if ymin == ymax:
 *                     ymin -= 1.0             # <<<<<<<<<<<<<<
 *                     ymax += 1.0
 *                 return (xmin, xmax), (ymin, ymax)
*/
    __pyx_t_1 = __Pyx_PyFloat_SubtractObjC(__pyx_v_ymin, __pyx_mstate_global->__pyx_float_1_0, 1.0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ymin, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":356
 *                 if ymin == ymax:
 *                     ymin -= 1.0
 *                     ymax += 1.0             # <<<<<<<<<<<<<<
 *                 return (xmin, xmax), (ymin, ymax)
 * 
*/
    __pyx_t_1 = __Pyx_PyFloat_AddObjC(__pyx_v_ymax, __pyx_mstate_global->__pyx_float_1_0, 1.0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ymax, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":354
 *                     xmin -= 1.0
 *                     xmax += 1.0
 *                 if ymin == ymax:             # <<<<<<<<<<<<<<
 *                     ymin -= 1.0
 *                     ymax += 1.0
*/
  }

  /* "H2MM_C.pyx":357
 *                     ymin -= 1.0
 *                     ymax += 1.0
 *                 return (xmin, xmax), (ymin, ymax)             # <<<<<<<<<<<<<<
 * 
 *             def close(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_xmin);
  __Pyx_GIVEREF(__pyx_v_xmin);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xmin) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_xmax);
  __Pyx_GIVEREF(__pyx_v_xmax);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_xmax) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_ymin);
  __Pyx_GIVEREF(__pyx_v_ymin);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ymin) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ymax);
  __Pyx_GIVEREF(__pyx_v_ymax);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_ymax) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 357, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_8 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":340
 *                     self.stream.update(fig)
 * 
 *             def _get_xylim(self, i, j):             # <<<<<<<<<<<<<<
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':
*/

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("H2MM_C.IPyPlot._get_xylim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xmin);
  __Pyx_XDECREF(__pyx_v_xmax);
  __Pyx_XDECREF(__pyx_v_ymin);
  __Pyx_XDECREF(__pyx_v_ymax);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":359
 *                 return (xmin, xmax), (ymin, ymax)
 * 
 *             def close(self):             # <<<<<<<<<<<<<<
 *                 """
 *                 Clear the display handle.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_7close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_7IPyPlot_6close, "\n                Clear the display handle.\n\n                Returns\n                -------\n                None.\n\n                ");
static PyMethodDef __pyx_mdef_6H2MM_C_7IPyPlot_7close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_7IPyPlot_7close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_7IPyPlot_6close};
static PyObject *__pyx_pw_6H2MM_C_7IPyPlot_7close(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 359, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 359, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "close", 0) < (0)) __PYX_ERR(0, 359, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, i); __PYX_ERR(0, 359, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 359, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 359, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.IPyPlot.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_7IPyPlot_6close(__pyx_self, __pyx_v_self);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_7IPyPlot_6close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "H2MM_C.pyx":368
 * 
 *                 """
 *                 clear_output()             # <<<<<<<<<<<<<<
 * 
 *         def plot_bic(niter, new, current, old, iter_time, total_time):
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_clear_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H2MM_C.pyx":359
 *                 return (xmin, xmax), (ymin, ymax)
 * 
 *             def close(self):             # <<<<<<<<<<<<<<
 *                 """
 *                 Clear the display handle.
*/

  /* 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("H2MM_C.IPyPlot.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":370
 *                 clear_output()
 * 
 *         def plot_bic(niter, new, current, old, iter_time, total_time):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots BIC in single plot
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_1plot_bic(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_plot_bic, "\n            Printing function for :class:`IPyPlot`, plots BIC in single plot\n            \n            .. note::\n                \n                This class is subject to rapid iteration and/or removal in\n                future minor version increments.\n            ");
static PyMethodDef __pyx_mdef_6H2MM_C_1plot_bic = {"plot_bic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_1plot_bic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_plot_bic};
static PyObject *__pyx_pw_6H2MM_C_1plot_bic(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_niter = 0;
  CYTHON_UNUSED PyObject *__pyx_v_new = 0;
  PyObject *__pyx_v_current = 0;
  CYTHON_UNUSED PyObject *__pyx_v_old = 0;
  CYTHON_UNUSED PyObject *__pyx_v_iter_time = 0;
  CYTHON_UNUSED PyObject *__pyx_v_total_time = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_bic (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_niter,&__pyx_mstate_global->__pyx_n_u_new_2,&__pyx_mstate_global->__pyx_n_u_current,&__pyx_mstate_global->__pyx_n_u_old,&__pyx_mstate_global->__pyx_n_u_iter_time,&__pyx_mstate_global->__pyx_n_u_total_time,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 370, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 370, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "plot_bic", 0) < (0)) __PYX_ERR(0, 370, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("plot_bic", 1, 6, 6, i); __PYX_ERR(0, 370, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 6)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 370, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 370, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 370, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 370, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 370, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 370, __pyx_L3_error)
    }
    __pyx_v_niter = values[0];
    __pyx_v_new = values[1];
    __pyx_v_current = values[2];
    __pyx_v_old = values[3];
    __pyx_v_iter_time = values[4];
    __pyx_v_total_time = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plot_bic", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 370, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.plot_bic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_plot_bic(__pyx_self, __pyx_v_niter, __pyx_v_new, __pyx_v_current, __pyx_v_old, __pyx_v_iter_time, __pyx_v_total_time);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_plot_bic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time) {
  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;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plot_bic", 0);

  /* "H2MM_C.pyx":379
 *                 future minor version increments.
 *             """
 *             return [[np.array([niter, current.bic])]]             # <<<<<<<<<<<<<<
 * 
 *         def plot_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_bic); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_niter);
  __Pyx_GIVEREF(__pyx_v_niter);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_niter) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":370
 *                 clear_output()
 * 
 *         def plot_bic(niter, new, current, old, iter_time, total_time):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots BIC in single plot
*/

  /* 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("H2MM_C.plot_bic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":381
 *             return [[np.array([niter, current.bic])]]
 * 
 *         def plot_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots obs values in single plot.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_3plot_obs(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_2plot_obs, "\n            Printing function for :class:`IPyPlot`, plots obs values in single plot.\n            Takes 2 keyword arguments, dx, dy specifing index of det to plot\n            on x and y axis for each state.\n            \n            .. note::\n                \n                This function is subject to rapid iteration and/or removal in\n                future minor version increments.\n            \n            ");
static PyMethodDef __pyx_mdef_6H2MM_C_3plot_obs = {"plot_obs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_3plot_obs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_2plot_obs};
static PyObject *__pyx_pw_6H2MM_C_3plot_obs(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v_niter = 0;
  CYTHON_UNUSED PyObject *__pyx_v_new = 0;
  PyObject *__pyx_v_current = 0;
  CYTHON_UNUSED PyObject *__pyx_v_old = 0;
  CYTHON_UNUSED PyObject *__pyx_v_iter_time = 0;
  CYTHON_UNUSED PyObject *__pyx_v_total_time = 0;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_obs (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_niter,&__pyx_mstate_global->__pyx_n_u_new_2,&__pyx_mstate_global->__pyx_n_u_current,&__pyx_mstate_global->__pyx_n_u_old,&__pyx_mstate_global->__pyx_n_u_iter_time,&__pyx_mstate_global->__pyx_n_u_total_time,&__pyx_mstate_global->__pyx_n_u_dx,&__pyx_mstate_global->__pyx_n_u_dy,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 381, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "plot_obs", 0) < (0)) __PYX_ERR(0, 381, __pyx_L3_error)
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("plot_obs", 0, 6, 8, i); __PYX_ERR(0, 381, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 381, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 381, __pyx_L3_error)
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 381, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 381, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 381, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 381, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 381, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
    }
    __pyx_v_niter = values[0];
    __pyx_v_new = values[1];
    __pyx_v_current = values[2];
    __pyx_v_old = values[3];
    __pyx_v_iter_time = values[4];
    __pyx_v_total_time = values[5];
    __pyx_v_dx = values[6];
    __pyx_v_dy = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plot_obs", 0, 6, 8, __pyx_nargs); __PYX_ERR(0, 381, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.plot_obs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_2plot_obs(__pyx_self, __pyx_v_niter, __pyx_v_new, __pyx_v_current, __pyx_v_old, __pyx_v_iter_time, __pyx_v_total_time, __pyx_v_dx, __pyx_v_dy);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_2plot_obs(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) {
  PyObject *__pyx_8genexpr5__pyx_v_i = 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;
  size_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plot_obs", 0);

  /* "H2MM_C.pyx":393
 * 
 *             """
 *             return [[np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]             # <<<<<<<<<<<<<<
 * 
 *         def plot_bic_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 393, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_9 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 393, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 393, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      {
        __pyx_t_7 = __pyx_t_11(__pyx_t_9);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 393, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_i, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_8genexpr5__pyx_v_i);
      __Pyx_GIVEREF(__pyx_8genexpr5__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_8genexpr5__pyx_v_i) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __Pyx_INCREF(__pyx_v_dx);
      __Pyx_GIVEREF(__pyx_v_dx);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_dx) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_8genexpr5__pyx_v_i);
      __Pyx_GIVEREF(__pyx_8genexpr5__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_8genexpr5__pyx_v_i) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __Pyx_INCREF(__pyx_v_dy);
      __Pyx_GIVEREF(__pyx_v_dy);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_dy) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_12);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_12) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __Pyx_GIVEREF(__pyx_t_13);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_13) != (0)) __PYX_ERR(0, 393, __pyx_L5_error);
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 393, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_10 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_10 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_10 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_int_neg_1};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 393, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 393, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":381
 *             return [[np.array([niter, current.bic])]]
 * 
 *         def plot_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots obs values in single plot.
*/

  /* 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_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("H2MM_C.plot_obs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":395
 *             return [[np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]
 * 
 *         def plot_bic_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots plot_bic in first plot
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_5plot_bic_obs(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_4plot_bic_obs, "\n            Printing function for :class:`IPyPlot`, plots plot_bic in first plot\n            plot_obs values in second plot.\n            Takes 2 keyword arguments, dx, dy specifing index of det to plot\n            on x and y axis for each state.\n            \n            .. note::\n                \n                This function is subject to rapid iteration and/or removal in\n                future minor version increments.\n            \n            ");
static PyMethodDef __pyx_mdef_6H2MM_C_5plot_bic_obs = {"plot_bic_obs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_5plot_bic_obs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_4plot_bic_obs};
static PyObject *__pyx_pw_6H2MM_C_5plot_bic_obs(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_niter = 0;
  CYTHON_UNUSED PyObject *__pyx_v_new = 0;
  PyObject *__pyx_v_current = 0;
  CYTHON_UNUSED PyObject *__pyx_v_old = 0;
  CYTHON_UNUSED PyObject *__pyx_v_iter_time = 0;
  CYTHON_UNUSED PyObject *__pyx_v_total_time = 0;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plot_bic_obs (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_niter,&__pyx_mstate_global->__pyx_n_u_new_2,&__pyx_mstate_global->__pyx_n_u_current,&__pyx_mstate_global->__pyx_n_u_old,&__pyx_mstate_global->__pyx_n_u_iter_time,&__pyx_mstate_global->__pyx_n_u_total_time,&__pyx_mstate_global->__pyx_n_u_dx,&__pyx_mstate_global->__pyx_n_u_dy,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 395, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "plot_bic_obs", 0) < (0)) __PYX_ERR(0, 395, __pyx_L3_error)
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
      for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("plot_bic_obs", 0, 6, 8, i); __PYX_ERR(0, 395, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 395, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 395, __pyx_L3_error)
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 395, __pyx_L3_error)
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 395, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 395, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 395, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 395, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));
    }
    __pyx_v_niter = values[0];
    __pyx_v_new = values[1];
    __pyx_v_current = values[2];
    __pyx_v_old = values[3];
    __pyx_v_iter_time = values[4];
    __pyx_v_total_time = values[5];
    __pyx_v_dx = values[6];
    __pyx_v_dy = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plot_bic_obs", 0, 6, 8, __pyx_nargs); __PYX_ERR(0, 395, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.plot_bic_obs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_4plot_bic_obs(__pyx_self, __pyx_v_niter, __pyx_v_new, __pyx_v_current, __pyx_v_old, __pyx_v_iter_time, __pyx_v_total_time, __pyx_v_dx, __pyx_v_dy);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_4plot_bic_obs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_niter, CYTHON_UNUSED PyObject *__pyx_v_new, PyObject *__pyx_v_current, CYTHON_UNUSED PyObject *__pyx_v_old, CYTHON_UNUSED PyObject *__pyx_v_iter_time, CYTHON_UNUSED PyObject *__pyx_v_total_time, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) {
  PyObject *__pyx_8genexpr6__pyx_v_i = 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;
  size_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)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("plot_bic_obs", 0);

  /* "H2MM_C.pyx":408
 * 
 *             """
 *             return [[np.array([niter, current.bic]), np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]             # <<<<<<<<<<<<<<
 * 
 *     except:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_bic); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_niter);
  __Pyx_GIVEREF(__pyx_v_niter);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_niter) != (0)) __PYX_ERR(0, 408, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 408, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  { /* enter inner scope */
    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 408, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = NULL;
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 408, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_11};
      __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_11 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 408, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 408, __pyx_L5_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    for (;;) {
      {
        __pyx_t_9 = __pyx_t_12(__pyx_t_11);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 408, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_i, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_8genexpr6__pyx_v_i);
      __Pyx_GIVEREF(__pyx_8genexpr6__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_8genexpr6__pyx_v_i) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __Pyx_INCREF(__pyx_v_dx);
      __Pyx_GIVEREF(__pyx_v_dx);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_dx) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_current, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_8genexpr6__pyx_v_i);
      __Pyx_GIVEREF(__pyx_8genexpr6__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_8genexpr6__pyx_v_i) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __Pyx_INCREF(__pyx_v_dy);
      __Pyx_GIVEREF(__pyx_v_dy);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dy) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_13);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_13) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __Pyx_GIVEREF(__pyx_t_14);
      if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_14) != (0)) __PYX_ERR(0, 408, __pyx_L5_error);
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 408, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = __pyx_t_2;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_int_neg_1};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 408, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 408, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 408, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":395
 *             return [[np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]
 * 
 *         def plot_bic_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots plot_bic in first plot
*/

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("H2MM_C.plot_bic_obs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":435
 *         object _formatter
 *         object _outstream
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,             # <<<<<<<<<<<<<<
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_max_iter = 0;
  PyObject *__pyx_v_max_time = 0;
  PyObject *__pyx_v_converged_min = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_formatter = 0;
  PyObject *__pyx_v_outstream = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[6] = {0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_iter,&__pyx_mstate_global->__pyx_n_u_max_time,&__pyx_mstate_global->__pyx_n_u_converged_min,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_formatter,&__pyx_mstate_global->__pyx_n_u_outstream,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 435, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 435, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_2046));
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__15);
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_1eneg_14));
      if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__16);
      if (!values[4]) values[4] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__17);
      if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__18);
    } else {
      switch (__pyx_nargs) {
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 435, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_2046));
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__15);
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_1eneg_14));
      if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__16);
      if (!values[4]) values[4] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__17);
      if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__18);
    }
    __pyx_v_max_iter = values[0];
    __pyx_v_max_time = values[1];
    __pyx_v_converged_min = values[2];
    __pyx_v_num_cores = values[3];
    __pyx_v_formatter = values[4];
    __pyx_v_outstream = values[5];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 435, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const___cinit__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_max_iter, __pyx_v_max_time, __pyx_v_converged_min, __pyx_v_num_cores, __pyx_v_formatter, __pyx_v_outstream);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6H2MM_C_13opt_lim_const___cinit__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_formatter, PyObject *__pyx_v_outstream) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int64_t __pyx_t_9;
  double __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "H2MM_C.pyx":438
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")             # <<<<<<<<<<<<<<
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float greater than 0")
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_iter, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_max_iter)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 438, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_max_iter_must_be_integer_greater};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 438, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 438, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":439
 *                   outstream=lambda: sys.stdout):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")             # <<<<<<<<<<<<<<
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float greater than 0")
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be integer greater than 0")
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_time, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_max_time)), __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_4 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_max_time_must_be_float_and_great};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 439, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 439, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":440
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float greater than 0")             # <<<<<<<<<<<<<<
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be integer greater than 0")
 *         self._max_iter = <int64_t> max_iter
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_converged_min, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_converged_min)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 440, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L7_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_converged_min_must_be_float_grea};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 440, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 440, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":441
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float greater than 0")
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be integer greater than 0")             # <<<<<<<<<<<<<<
 *         self._max_iter = <int64_t> max_iter
 *         self._max_time = <double> max_time
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_num_cores, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_num_cores)), __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_4 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_num_cores_must_be_integer_greate};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 441, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 441, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":442
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float greater than 0")
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be integer greater than 0")
 *         self._max_iter = <int64_t> max_iter             # <<<<<<<<<<<<<<
 *         self._max_time = <double> max_time
 *         self._converged_min = <double> converged_min
*/
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_v_max_iter); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error)
  __pyx_v_self->_max_iter = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":443
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be integer greater than 0")
 *         self._max_iter = <int64_t> max_iter
 *         self._max_time = <double> max_time             # <<<<<<<<<<<<<<
 *         self._converged_min = <double> converged_min
 *         self._num_cores = <int64_t> num_cores
*/
  __pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_v_max_time); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
  __pyx_v_self->_max_time = ((double)__pyx_t_10);

  /* "H2MM_C.pyx":444
 *         self._max_iter = <int64_t> max_iter
 *         self._max_time = <double> max_time
 *         self._converged_min = <double> converged_min             # <<<<<<<<<<<<<<
 *         self._num_cores = <int64_t> num_cores
 *         self._formatter = formatter
*/
  __pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_v_converged_min); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error)
  __pyx_v_self->_converged_min = ((double)__pyx_t_10);

  /* "H2MM_C.pyx":445
 *         self._max_time = <double> max_time
 *         self._converged_min = <double> converged_min
 *         self._num_cores = <int64_t> num_cores             # <<<<<<<<<<<<<<
 *         self._formatter = formatter
 *         self._outstream = outstream
*/
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_v_num_cores); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 445, __pyx_L1_error)
  __pyx_v_self->_num_cores = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":446
 *         self._converged_min = <double> converged_min
 *         self._num_cores = <int64_t> num_cores
 *         self._formatter = formatter             # <<<<<<<<<<<<<<
 *         self._outstream = outstream
 * 
*/
  __Pyx_INCREF(__pyx_v_formatter);
  __Pyx_GIVEREF(__pyx_v_formatter);
  __Pyx_GOTREF(__pyx_v_self->_formatter);
  __Pyx_DECREF(__pyx_v_self->_formatter);
  __pyx_v_self->_formatter = __pyx_v_formatter;

  /* "H2MM_C.pyx":447
 *         self._num_cores = <int64_t> num_cores
 *         self._formatter = formatter
 *         self._outstream = outstream             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_INCREF(__pyx_v_outstream);
  __Pyx_GIVEREF(__pyx_v_outstream);
  __Pyx_GOTREF(__pyx_v_self->_outstream);
  __Pyx_DECREF(__pyx_v_self->_outstream);
  __pyx_v_self->_outstream = __pyx_v_outstream;

  /* "H2MM_C.pyx":435
 *         object _formatter
 *         object _outstream
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,             # <<<<<<<<<<<<<<
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":449
 *         self._outstream = outstream
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def max_iter(self):
 *         """Maximum number of iterations before ending optimization"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_8max_iter___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8max_iter___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":452
 *     def max_iter(self):
 *         """Maximum number of iterations before ending optimization"""
 *         return self._max_iter             # <<<<<<<<<<<<<<
 *     @max_iter.setter
 *     def max_iter(self, max_iter):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->_max_iter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":449
 *         self._outstream = outstream
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def max_iter(self):
 *         """Maximum number of iterations before ending optimization"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.max_iter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":453
 *         """Maximum number of iterations before ending optimization"""
 *         return self._max_iter
 *     @max_iter.setter             # <<<<<<<<<<<<<<
 *     def max_iter(self, max_iter):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_max_iter); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_max_iter) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_8max_iter_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_max_iter));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_8max_iter_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int64_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":455
 *     @max_iter.setter
 *     def max_iter(self, max_iter):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")             # <<<<<<<<<<<<<<
 *         self._max_iter = <int64_t> max_iter
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_iter, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_max_iter)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_max_iter_must_be_integer_greater};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 455, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 455, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":456
 *     def max_iter(self, max_iter):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
 *         self._max_iter = <int64_t> max_iter             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_v_max_iter); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 456, __pyx_L1_error)
  __pyx_v_self->_max_iter = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":453
 *         """Maximum number of iterations before ending optimization"""
 *         return self._max_iter
 *     @max_iter.setter             # <<<<<<<<<<<<<<
 *     def max_iter(self, max_iter):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.max_iter.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":458
 *         self._max_iter = <int64_t> max_iter
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def max_time(self):
 *         """Maximum time of optimization.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_8max_time_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_8max_time_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_8max_time___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8max_time___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":468
 * 
 *         """
 *         return self._max_time             # <<<<<<<<<<<<<<
 *     @max_time.setter
 *     def max_time(self, max_time):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_max_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":458
 *         self._max_iter = <int64_t> max_iter
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def max_time(self):
 *         """Maximum time of optimization.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.max_time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":469
 *         """
 *         return self._max_time
 *     @max_time.setter             # <<<<<<<<<<<<<<
 *     def max_time(self, max_time):
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_8max_time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_max_time); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_8max_time_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_max_time) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_8max_time_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_max_time));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_8max_time_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_time) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":471
 *     @max_time.setter
 *     def max_time(self, max_time):
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")             # <<<<<<<<<<<<<<
 *         self._max_time = <double> max_time
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_time, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_max_time)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_max_time_must_be_float_and_great};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 471, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 471, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":472
 *     def max_time(self, max_time):
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
 *         self._max_time = <double> max_time             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_v_max_time); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 472, __pyx_L1_error)
  __pyx_v_self->_max_time = ((double)__pyx_t_9);

  /* "H2MM_C.pyx":469
 *         """
 *         return self._max_time
 *     @max_time.setter             # <<<<<<<<<<<<<<
 *     def max_time(self, max_time):
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.max_time.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":474
 *         self._max_time = <double> max_time
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def converged_min(self):
 *         """Minimum difference between loglik of succesive iterations for a model to be considered converged"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_13converged_min___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_13converged_min___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":477
 *     def converged_min(self):
 *         """Minimum difference between loglik of succesive iterations for a model to be considered converged"""
 *         return self._converged_min             # <<<<<<<<<<<<<<
 *     @converged_min.setter
 *     def converged_min(self, converged_min):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_converged_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":474
 *         self._max_time = <double> max_time
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def converged_min(self):
 *         """Minimum difference between loglik of succesive iterations for a model to be considered converged"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.converged_min.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":478
 *         """Minimum difference between loglik of succesive iterations for a model to be considered converged"""
 *         return self._converged_min
 *     @converged_min.setter             # <<<<<<<<<<<<<<
 *     def converged_min(self, converged_min):
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float and greater than 0")
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_converged_min); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_converged_min) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_13converged_min_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_converged_min));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_13converged_min_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_converged_min) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":480
 *     @converged_min.setter
 *     def converged_min(self, converged_min):
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float and greater than 0")             # <<<<<<<<<<<<<<
 *         self._converged_min = <double> converged_min
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_converged_min, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_converged_min)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_converged_min_must_be_float_and};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 480, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 480, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":481
 *     def converged_min(self, converged_min):
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float and greater than 0")
 *         self._converged_min = <double> converged_min             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_v_converged_min); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error)
  __pyx_v_self->_converged_min = ((double)__pyx_t_9);

  /* "H2MM_C.pyx":478
 *         """Minimum difference between loglik of succesive iterations for a model to be considered converged"""
 *         return self._converged_min
 *     @converged_min.setter             # <<<<<<<<<<<<<<
 *     def converged_min(self, converged_min):
 *         assert converged_min > 0 and np.issubdtype(type(converged_min), np.floating), ValueError("converged_min must be float and greater than 0")
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.converged_min.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":483
 *         self._converged_min = <double> converged_min
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def num_cores(self):
 *         """Number of cores to use in optimization
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9num_cores___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9num_cores___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":492
 *             used in optimization
 *         """
 *         return self._num_cores             # <<<<<<<<<<<<<<
 *     @num_cores.setter
 *     def num_cores(self, num_cores):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->_num_cores); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":483
 *         self._converged_min = <double> converged_min
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def num_cores(self):
 *         """Number of cores to use in optimization
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.num_cores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":493
 *         """
 *         return self._num_cores
 *     @num_cores.setter             # <<<<<<<<<<<<<<
 *     def num_cores(self, num_cores):
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be int and greater than 0")
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_num_cores); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_num_cores) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9num_cores_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_num_cores));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_9num_cores_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_num_cores) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int64_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":495
 *     @num_cores.setter
 *     def num_cores(self, num_cores):
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be int and greater than 0")             # <<<<<<<<<<<<<<
 *         self._num_cores = <int64_t> num_cores
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_num_cores, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_8 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_num_cores)), __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_6 = NULL;
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_num_cores_must_be_int_and_greate};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 495, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 495, __pyx_L1_error)
  #endif

  /* "H2MM_C.pyx":496
 *     def num_cores(self, num_cores):
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be int and greater than 0")
 *         self._num_cores = <int64_t> num_cores             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_v_num_cores); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error)
  __pyx_v_self->_num_cores = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":493
 *         """
 *         return self._num_cores
 *     @num_cores.setter             # <<<<<<<<<<<<<<
 *     def num_cores(self, num_cores):
 *         assert num_cores > 0 and np.issubdtype(type(num_cores), np.integer), ValueError("num_cores must be int and greater than 0")
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.num_cores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":498
 *         self._num_cores = <int64_t> num_cores
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def formatter(self):
 *         """A :class:`Printer` subclass, used to format result of print_func for display of optimiation progress"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9formatter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9formatter_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9formatter___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9formatter___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":501
 *     def formatter(self):
 *         """A :class:`Printer` subclass, used to format result of print_func for display of optimiation progress"""
 *         return self._formatter             # <<<<<<<<<<<<<<
 * 
 *     @formatter.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_formatter);
  __pyx_r = __pyx_v_self->_formatter;
  goto __pyx_L0;

  /* "H2MM_C.pyx":498
 *         self._num_cores = <int64_t> num_cores
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def formatter(self):
 *         """A :class:`Printer` subclass, used to format result of print_func for display of optimiation progress"""
*/

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

/* "H2MM_C.pyx":503
 *         return self._formatter
 * 
 *     @formatter.setter             # <<<<<<<<<<<<<<
 *     def formatter(self, formatter):
 *         self._formatter = formatter
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_9formatter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_formatter); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_9formatter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_formatter) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9formatter_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_formatter));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_9formatter_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_formatter) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":505
 *     @formatter.setter
 *     def formatter(self, formatter):
 *         self._formatter = formatter             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_INCREF(__pyx_v_formatter);
  __Pyx_GIVEREF(__pyx_v_formatter);
  __Pyx_GOTREF(__pyx_v_self->_formatter);
  __Pyx_DECREF(__pyx_v_self->_formatter);
  __pyx_v_self->_formatter = __pyx_v_formatter;

  /* "H2MM_C.pyx":503
 *         return self._formatter
 * 
 *     @formatter.setter             # <<<<<<<<<<<<<<
 *     def formatter(self, formatter):
 *         self._formatter = formatter
*/

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

/* "H2MM_C.pyx":507
 *         self._formatter = formatter
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def outstream(self):
 *         """Callable, when called, generates an output stream for where to print displayed progress"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9outstream_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9outstream_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9outstream___get__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_9outstream___get__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":510
 *     def outstream(self):
 *         """Callable, when called, generates an output stream for where to print displayed progress"""
 *         return self._outstream             # <<<<<<<<<<<<<<
 * 
 *     @outstream.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_outstream);
  __pyx_r = __pyx_v_self->_outstream;
  goto __pyx_L0;

  /* "H2MM_C.pyx":507
 *         self._formatter = formatter
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def outstream(self):
 *         """Callable, when called, generates an output stream for where to print displayed progress"""
*/

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

/* "H2MM_C.pyx":512
 *         return self._outstream
 * 
 *     @outstream.setter             # <<<<<<<<<<<<<<
 *     def outstream(self, outstream):
 *         self._outstream = outstream
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_9outstream_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_outstream); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_9outstream_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_outstream) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_9outstream_2__set__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_outstream));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_9outstream_2__set__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_outstream) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":514
 *     @outstream.setter
 *     def outstream(self, outstream):
 *         self._outstream = outstream             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __Pyx_INCREF(__pyx_v_outstream);
  __Pyx_GIVEREF(__pyx_v_outstream);
  __Pyx_GOTREF(__pyx_v_self->_outstream);
  __Pyx_DECREF(__pyx_v_self->_outstream);
  __pyx_v_self->_outstream = __pyx_v_outstream;

  /* "H2MM_C.pyx":512
 *         return self._outstream
 * 
 *     @outstream.setter             # <<<<<<<<<<<<<<
 *     def outstream(self, outstream):
 *         self._outstream = outstream
*/

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

/* "H2MM_C.pyx":516
 *         self._outstream = outstream
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return getattr(self, key)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_2__getitem__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_2__getitem__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "H2MM_C.pyx":517
 * 
 *     def __getitem__(self, key):
 *         return getattr(self, key)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetAttr(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":516
 *         self._outstream = outstream
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return getattr(self, key)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":519
 *         return getattr(self, key)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         setattr(self, key, value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_13opt_lim_const_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6H2MM_C_13opt_lim_const_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_4__setitem__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6H2MM_C_13opt_lim_const_4__setitem__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":520
 * 
 *     def __setitem__(self, key, value):
 *         setattr(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __pyx_t_1 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_v_key, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 520, __pyx_L1_error)

  /* "H2MM_C.pyx":519
 *         return getattr(self, key)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         setattr(self, key, value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":522
 *         setattr(self, key, value)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_7__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_7__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_6__repr__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_6__repr__(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  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[12];
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "H2MM_C.pyx":523
 * 
 *     def __repr__(self):
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '             # <<<<<<<<<<<<<<
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->_num_cores, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->_max_iter, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "H2MM_C.pyx":524
 *     def __repr__(self):
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'             # <<<<<<<<<<<<<<
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
 * 
*/
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->_converged_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->_max_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "H2MM_C.pyx":525
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')             # <<<<<<<<<<<<<<
 * 
 *     def _get_max_iter(self, max_iter):
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_formatter, __pyx_mstate_global->__pyx_n_u_qualname); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_self->_outstream, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Optimization_limits_num_cores;
  __pyx_t_7[1] = __pyx_t_1;
  __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_max_iter_2;
  __pyx_t_7[3] = __pyx_t_2;
  __pyx_t_7[4] = __pyx_mstate_global->__pyx_kp_u_converged_min_2;
  __pyx_t_7[5] = __pyx_t_4;
  __pyx_t_7[6] = __pyx_mstate_global->__pyx_kp_u_max_time_2;
  __pyx_t_7[7] = __pyx_t_5;
  __pyx_t_7[8] = __pyx_mstate_global->__pyx_kp_u_formatter_2;
  __pyx_t_7[9] = __pyx_t_6;
  __pyx_t_7[10] = __pyx_mstate_global->__pyx_kp_u_outstream_2;
  __pyx_t_7[11] = __pyx_t_3;

  /* "H2MM_C.pyx":523
 * 
 *     def __repr__(self):
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '             # <<<<<<<<<<<<<<
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
*/
  __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 12, 33 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 12 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":522
 *         setattr(self, key, value)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return (f'Optimization limits:: num_cores: {self._num_cores}, max_iter: {self._max_iter}, '
 *                 f'converged_min: {self._converged_min}, max_time: {self._max_time},\n'
*/

  /* 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_8);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":527
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
 * 
 *     def _get_max_iter(self, max_iter):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9_get_max_iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_8_get_max_iter, "\n        Process the max_iter keyword argument value.\n\n        Parameters\n        ----------\n        max_iter : int or None\n            Maximum number of iterations during optimization, the value passed to\n            the max_iter keyword argument.\n\n        Returns\n        -------\n        max_iter : int\n            Maximum number of iterations, if keyword argument is None, the value\n            stored in the default argument.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_9_get_max_iter = {"_get_max_iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_9_get_max_iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_8_get_max_iter};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_9_get_max_iter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_iter = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_max_iter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_iter,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 527, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 527, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_max_iter", 0) < (0)) __PYX_ERR(0, 527, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_max_iter", 1, 1, 1, i); __PYX_ERR(0, 527, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 527, __pyx_L3_error)
    }
    __pyx_v_max_iter = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_max_iter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 527, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_max_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_8_get_max_iter(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_max_iter);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_8_get_max_iter(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_iter) {
  PyObject *__pyx_v_m_iter = 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;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_max_iter", 0);

  /* "H2MM_C.pyx":544
 * 
 *         """
 *         if max_iter is not None and np.issubdtype(type(max_iter),int):             # <<<<<<<<<<<<<<
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")
 *             m_iter = max_iter
*/
  __pyx_t_2 = (__pyx_v_max_iter != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_max_iter)), ((PyObject *)(&PyLong_Type))};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":545
 *         """
 *         if max_iter is not None and np.issubdtype(type(max_iter),int):
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")             # <<<<<<<<<<<<<<
 *             m_iter = max_iter
 *         elif max_iter is None:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_max_iter, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) {
        __pyx_t_6 = NULL;
        __pyx_t_7 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_max_iter_must_be_greater_than_0};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(0, 545, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 545, __pyx_L1_error)
    #endif

    /* "H2MM_C.pyx":546
 *         if max_iter is not None and np.issubdtype(type(max_iter),int):
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")
 *             m_iter = max_iter             # <<<<<<<<<<<<<<
 *         elif max_iter is None:
 *             m_iter = self._max_iter
*/
    __Pyx_INCREF(__pyx_v_max_iter);
    __pyx_v_m_iter = __pyx_v_max_iter;

    /* "H2MM_C.pyx":544
 * 
 *         """
 *         if max_iter is not None and np.issubdtype(type(max_iter),int):             # <<<<<<<<<<<<<<
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")
 *             m_iter = max_iter
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":547
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")
 *             m_iter = max_iter
 *         elif max_iter is None:             # <<<<<<<<<<<<<<
 *             m_iter = self._max_iter
 *         else:
*/
  __pyx_t_1 = (__pyx_v_max_iter == Py_None);
  if (likely(__pyx_t_1)) {

    /* "H2MM_C.pyx":548
 *             m_iter = max_iter
 *         elif max_iter is None:
 *             m_iter = self._max_iter             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"max_iter must be int, got {type(max_iter)}")
*/
    __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_self->_max_iter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_m_iter = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":547
 *             assert max_iter > 0, ValueError("max_iter must be greater than 0")
 *             m_iter = max_iter
 *         elif max_iter is None:             # <<<<<<<<<<<<<<
 *             m_iter = self._max_iter
 *         else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":550
 *             m_iter = self._max_iter
 *         else:
 *             raise ValueError(f"max_iter must be int, got {type(max_iter)}")             # <<<<<<<<<<<<<<
 *         return m_iter
 * 
*/
  /*else*/ {
    __pyx_t_6 = NULL;
    __pyx_t_4 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_max_iter)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_max_iter_must_be_int_got, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 550, __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(0, 550, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":551
 *         else:
 *             raise ValueError(f"max_iter must be int, got {type(max_iter)}")
 *         return m_iter             # <<<<<<<<<<<<<<
 * 
 *     def _get_max_time(self, max_time):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_m_iter);
  __pyx_r = __pyx_v_m_iter;
  goto __pyx_L0;

  /* "H2MM_C.pyx":527
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
 * 
 *     def _get_max_iter(self, max_iter):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/

  /* 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("H2MM_C.opt_lim_const._get_max_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m_iter);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":553
 *         return m_iter
 * 
 *     def _get_max_time(self, max_time):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_11_get_max_time(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_10_get_max_time, "\n        Process the max_iter keyword argument value.\n\n        Parameters\n        ----------\n        max_time : float or None\n            Maximum duration of optimization, the value passed to the max_time\n            keyword argument\n\n        Returns\n        -------\n        max_iter : float\n            Maximum time of optimization, if keyword argument is None, the\n            value stored in the default argument.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_11_get_max_time = {"_get_max_time", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_11_get_max_time, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_10_get_max_time};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_11_get_max_time(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_max_time = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_max_time (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_time,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 553, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 553, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_max_time", 0) < (0)) __PYX_ERR(0, 553, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_max_time", 1, 1, 1, i); __PYX_ERR(0, 553, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 553, __pyx_L3_error)
    }
    __pyx_v_max_time = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_max_time", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 553, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_max_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_10_get_max_time(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_max_time);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_10_get_max_time(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_max_time) {
  PyObject *__pyx_v_m_time = 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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_max_time", 0);

  /* "H2MM_C.pyx":570
 * 
 *         """
 *         if np.issubdtype(type(max_time), np.floating):             # <<<<<<<<<<<<<<
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")
 *             m_time = max_time
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_max_time)), __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":571
 *         """
 *         if np.issubdtype(type(max_time), np.floating):
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")             # <<<<<<<<<<<<<<
 *             m_time = max_time
 *         elif max_time is None:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_time, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) {
        __pyx_t_4 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_converged_min_must_be_greater_th};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 571, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 571, __pyx_L1_error)
    #endif

    /* "H2MM_C.pyx":572
 *         if np.issubdtype(type(max_time), np.floating):
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")
 *             m_time = max_time             # <<<<<<<<<<<<<<
 *         elif max_time is None:
 *             m_time = self._max_time
*/
    __Pyx_INCREF(__pyx_v_max_time);
    __pyx_v_m_time = __pyx_v_max_time;

    /* "H2MM_C.pyx":570
 * 
 *         """
 *         if np.issubdtype(type(max_time), np.floating):             # <<<<<<<<<<<<<<
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")
 *             m_time = max_time
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":573
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")
 *             m_time = max_time
 *         elif max_time is None:             # <<<<<<<<<<<<<<
 *             m_time = self._max_time
 *         else:
*/
  __pyx_t_7 = (__pyx_v_max_time == Py_None);
  if (likely(__pyx_t_7)) {

    /* "H2MM_C.pyx":574
 *             m_time = max_time
 *         elif max_time is None:
 *             m_time = self._max_time             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"max_time must be float, got {type(max_time)}")
*/
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_max_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_m_time = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":573
 *             assert max_time > 0, ValueError("converged_min must be greater than 0")
 *             m_time = max_time
 *         elif max_time is None:             # <<<<<<<<<<<<<<
 *             m_time = self._max_time
 *         else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":576
 *             m_time = self._max_time
 *         else:
 *             raise ValueError(f"max_time must be float, got {type(max_time)}")             # <<<<<<<<<<<<<<
 *         return m_time
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_max_time)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_max_time_must_be_float_got, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 576, __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, 576, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":577
 *         else:
 *             raise ValueError(f"max_time must be float, got {type(max_time)}")
 *         return m_time             # <<<<<<<<<<<<<<
 * 
 *     def _get_converged_min(self, converged_min):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_m_time);
  __pyx_r = __pyx_v_m_time;
  goto __pyx_L0;

  /* "H2MM_C.pyx":553
 *         return m_iter
 * 
 *     def _get_max_time(self, max_time):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/

  /* 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("H2MM_C.opt_lim_const._get_max_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m_time);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":579
 *         return m_time
 * 
 *     def _get_converged_min(self, converged_min):             # <<<<<<<<<<<<<<
 *         """
 *         Process the converged_min keyword argument value.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_13_get_converged_min(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_12_get_converged_min, "\n        Process the converged_min keyword argument value.\n\n        Parameters\n        ----------\n        converged_min : float or None\n            Minimum difference between successive iteration for optimization to be\n            considered converged, the value passed to\n            the max_iter keyword argument.\n\n        Returns\n        -------\n        converged_min : float\n            Minimum difference between successive iteration for optimization to be\n            considered converged, if keyword argument is None, the value stored \n            in the default argument.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_13_get_converged_min = {"_get_converged_min", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_13_get_converged_min, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_12_get_converged_min};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_13_get_converged_min(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_converged_min = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_converged_min (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_converged_min,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 579, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_converged_min", 0) < (0)) __PYX_ERR(0, 579, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_converged_min", 1, 1, 1, i); __PYX_ERR(0, 579, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error)
    }
    __pyx_v_converged_min = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_converged_min", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 579, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_converged_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_12_get_converged_min(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_converged_min);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_12_get_converged_min(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_converged_min) {
  PyObject *__pyx_v_c_min = 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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_converged_min", 0);

  /* "H2MM_C.pyx":598
 * 
 *         """
 *         if np.issubdtype(type(converged_min), np.floating):             # <<<<<<<<<<<<<<
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")
 *             c_min = converged_min
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_floating); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_converged_min)), __pyx_t_5};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":599
 *         """
 *         if np.issubdtype(type(converged_min), np.floating):
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")             # <<<<<<<<<<<<<<
 *             c_min = converged_min
 *         elif converged_min is None:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_converged_min, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 599, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) {
        __pyx_t_4 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_converged_min_must_be_greater_th};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_1, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 599, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 599, __pyx_L1_error)
    #endif

    /* "H2MM_C.pyx":600
 *         if np.issubdtype(type(converged_min), np.floating):
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")
 *             c_min = converged_min             # <<<<<<<<<<<<<<
 *         elif converged_min is None:
 *             c_min = self._converged_min
*/
    __Pyx_INCREF(__pyx_v_converged_min);
    __pyx_v_c_min = __pyx_v_converged_min;

    /* "H2MM_C.pyx":598
 * 
 *         """
 *         if np.issubdtype(type(converged_min), np.floating):             # <<<<<<<<<<<<<<
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")
 *             c_min = converged_min
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":601
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")
 *             c_min = converged_min
 *         elif converged_min is None:             # <<<<<<<<<<<<<<
 *             c_min = self._converged_min
 *         else:
*/
  __pyx_t_7 = (__pyx_v_converged_min == Py_None);
  if (likely(__pyx_t_7)) {

    /* "H2MM_C.pyx":602
 *             c_min = converged_min
 *         elif converged_min is None:
 *             c_min = self._converged_min             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"converged_min must be float, got {type(converged_min)}")
*/
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_converged_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_c_min = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":601
 *             assert converged_min > 0, ValueError("converged_min must be greater than 0")
 *             c_min = converged_min
 *         elif converged_min is None:             # <<<<<<<<<<<<<<
 *             c_min = self._converged_min
 *         else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":604
 *             c_min = self._converged_min
 *         else:
 *             raise ValueError(f"converged_min must be float, got {type(converged_min)}")             # <<<<<<<<<<<<<<
 *         return c_min
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_converged_min)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_converged_min_must_be_float_got, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 604, __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, 604, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":605
 *         else:
 *             raise ValueError(f"converged_min must be float, got {type(converged_min)}")
 *         return c_min             # <<<<<<<<<<<<<<
 * 
 *     def _get_num_cores(self, num_cores):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_c_min);
  __pyx_r = __pyx_v_c_min;
  goto __pyx_L0;

  /* "H2MM_C.pyx":579
 *         return m_time
 * 
 *     def _get_converged_min(self, converged_min):             # <<<<<<<<<<<<<<
 *         """
 *         Process the converged_min keyword argument value.
*/

  /* 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("H2MM_C.opt_lim_const._get_converged_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c_min);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":607
 *         return c_min
 * 
 *     def _get_num_cores(self, num_cores):             # <<<<<<<<<<<<<<
 *         """
 *         Process the num_cores keyword argument value.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_15_get_num_cores(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_14_get_num_cores, "\n        Process the num_cores keyword argument value.\n\n        Parameters\n        ----------\n        max_iter : int or None\n            Maximum number of iterations during optimization, the value passed to\n            the max_iter keyword argument.\n\n        Returns\n        -------\n        max_iter : int\n            Maximum number of iterations, if keyword argument is None, the value\n            stored in the default argument.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_15_get_num_cores = {"_get_num_cores", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_15_get_num_cores, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_14_get_num_cores};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_15_get_num_cores(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_num_cores = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_num_cores (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_num_cores,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 607, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 607, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_num_cores", 0) < (0)) __PYX_ERR(0, 607, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_num_cores", 1, 1, 1, i); __PYX_ERR(0, 607, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 607, __pyx_L3_error)
    }
    __pyx_v_num_cores = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_num_cores", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 607, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_num_cores", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_14_get_num_cores(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_num_cores);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_14_get_num_cores(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_num_cores) {
  int64_t __pyx_v_n_core;
  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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_num_cores", 0);
  __Pyx_INCREF(__pyx_v_num_cores);

  /* "H2MM_C.pyx":624
 * 
 *         """
 *         if type(num_cores) == str:             # <<<<<<<<<<<<<<
 *             if 'multi' in num_cores:
 *                 num_cores = os.cpu_count()//2
*/
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_num_cores)), ((PyObject *)(&PyUnicode_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":625
 *         """
 *         if type(num_cores) == str:
 *             if 'multi' in num_cores:             # <<<<<<<<<<<<<<
 *                 num_cores = os.cpu_count()//2
 *             elif 'single' in num_cores:
*/
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_multi, __pyx_v_num_cores, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 625, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":626
 *         if type(num_cores) == str:
 *             if 'multi' in num_cores:
 *                 num_cores = os.cpu_count()//2             # <<<<<<<<<<<<<<
 *             elif 'single' in num_cores:
 *                 num_cores = os.cpu_count()
*/
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __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, 626, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_5 = __Pyx_PyLong_FloorDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_num_cores, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "H2MM_C.pyx":625
 *         """
 *         if type(num_cores) == str:
 *             if 'multi' in num_cores:             # <<<<<<<<<<<<<<
 *                 num_cores = os.cpu_count()//2
 *             elif 'single' in num_cores:
*/
      goto __pyx_L4;
    }

    /* "H2MM_C.pyx":627
 *             if 'multi' in num_cores:
 *                 num_cores = os.cpu_count()//2
 *             elif 'single' in num_cores:             # <<<<<<<<<<<<<<
 *                 num_cores = os.cpu_count()
 *             else:
*/
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_single, __pyx_v_num_cores, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
    if (likely(__pyx_t_2)) {

      /* "H2MM_C.pyx":628
 *                 num_cores = os.cpu_count()//2
 *             elif 'single' in num_cores:
 *                 num_cores = os.cpu_count()             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
*/
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cpu_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF_SET(__pyx_v_num_cores, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "H2MM_C.pyx":627
 *             if 'multi' in num_cores:
 *                 num_cores = os.cpu_count()//2
 *             elif 'single' in num_cores:             # <<<<<<<<<<<<<<
 *                 num_cores = os.cpu_count()
 *             else:
*/
      goto __pyx_L4;
    }

    /* "H2MM_C.pyx":630
 *                 num_cores = os.cpu_count()
 *             else:
 *                 raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")             # <<<<<<<<<<<<<<
 *         elif num_cores is not None and np.issubdtype(type(num_cores), int):
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
*/
    /*else*/ {
      __pyx_t_4 = NULL;
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_num_cores, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Non_int_options_for_num_cores_ar, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __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(0, 630, __pyx_L1_error)
    }
    __pyx_L4:;

    /* "H2MM_C.pyx":624
 * 
 *         """
 *         if type(num_cores) == str:             # <<<<<<<<<<<<<<
 *             if 'multi' in num_cores:
 *                 num_cores = os.cpu_count()//2
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":631
 *             else:
 *                 raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
 *         elif num_cores is not None and np.issubdtype(type(num_cores), int):             # <<<<<<<<<<<<<<
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
 *             n_core = <int64_t> num_cores
*/
  __pyx_t_7 = (__pyx_v_num_cores != Py_None);
  if (__pyx_t_7) {
  } else {
    __pyx_t_2 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)Py_TYPE(__pyx_v_num_cores)), ((PyObject *)(&PyLong_Type))};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 631, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":632
 *                 raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
 *         elif num_cores is not None and np.issubdtype(type(num_cores), int):
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")             # <<<<<<<<<<<<<<
 *             n_core = <int64_t> num_cores
 *         elif num_cores is None:
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_num_cores, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 632, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) {
        __pyx_t_1 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_num_cores_must_be_greater_than_0};
          __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 632, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(0, 632, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 632, __pyx_L1_error)
    #endif

    /* "H2MM_C.pyx":633
 *         elif num_cores is not None and np.issubdtype(type(num_cores), int):
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
 *             n_core = <int64_t> num_cores             # <<<<<<<<<<<<<<
 *         elif num_cores is None:
 *             n_core = self._num_cores
*/
    __pyx_t_8 = __Pyx_PyLong_As_int64_t(__pyx_v_num_cores); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 633, __pyx_L1_error)
    __pyx_v_n_core = ((int64_t)__pyx_t_8);

    /* "H2MM_C.pyx":631
 *             else:
 *                 raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
 *         elif num_cores is not None and np.issubdtype(type(num_cores), int):             # <<<<<<<<<<<<<<
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
 *             n_core = <int64_t> num_cores
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":634
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
 *             n_core = <int64_t> num_cores
 *         elif num_cores is None:             # <<<<<<<<<<<<<<
 *             n_core = self._num_cores
 *         else:
*/
  __pyx_t_2 = (__pyx_v_num_cores == Py_None);
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":635
 *             n_core = <int64_t> num_cores
 *         elif num_cores is None:
 *             n_core = self._num_cores             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
*/
    __pyx_t_8 = __pyx_v_self->_num_cores;
    __pyx_v_n_core = __pyx_t_8;

    /* "H2MM_C.pyx":634
 *             assert num_cores > 0, ValueError("num_cores must be greater than 0")
 *             n_core = <int64_t> num_cores
 *         elif num_cores is None:             # <<<<<<<<<<<<<<
 *             n_core = self._num_cores
 *         else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":637
 *             n_core = self._num_cores
 *         else:
 *             raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")             # <<<<<<<<<<<<<<
 *         return n_core
 * 
*/
  /*else*/ {
    __pyx_t_1 = NULL;
    __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_num_cores, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Non_int_options_for_num_cores_ar, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __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(0, 637, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":638
 *         else:
 *             raise ValueError(f"Non-int options for num_cores are 'single' or 'multi', cannot process {num_cores}")
 *         return n_core             # <<<<<<<<<<<<<<
 * 
 *     def _get_formatter(self, formatter):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_n_core); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":607
 *         return c_min
 * 
 *     def _get_num_cores(self, num_cores):             # <<<<<<<<<<<<<<
 *         """
 *         Process the num_cores keyword argument value.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_num_cores", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_num_cores);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":640
 *         return n_core
 * 
 *     def _get_formatter(self, formatter):             # <<<<<<<<<<<<<<
 *         """
 *         Get the formatter based on the value form kwargs.
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_17_get_formatter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_16_get_formatter, "\n        Get the formatter based on the value form kwargs.\n\n        Parameters\n        ----------\n        formatter : type | None\n            Value given in keword argument for print_formatter.\n\n        Returns\n        -------\n        type\n            The class of :class:`Printer` to be used for display of output.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_17_get_formatter = {"_get_formatter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_17_get_formatter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_16_get_formatter};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_17_get_formatter(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_formatter = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_formatter (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_formatter,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 640, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 640, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_formatter", 0) < (0)) __PYX_ERR(0, 640, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_formatter", 1, 1, 1, i); __PYX_ERR(0, 640, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 640, __pyx_L3_error)
    }
    __pyx_v_formatter = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_formatter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 640, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_formatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_16_get_formatter(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_formatter);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_16_get_formatter(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_formatter) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_get_formatter", 0);

  /* "H2MM_C.pyx":655
 * 
 *         """
 *         if formatter is None:             # <<<<<<<<<<<<<<
 *             return self._formatter
 *         return formatter
*/
  __pyx_t_1 = (__pyx_v_formatter == Py_None);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":656
 *         """
 *         if formatter is None:
 *             return self._formatter             # <<<<<<<<<<<<<<
 *         return formatter
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_formatter);
    __pyx_r = __pyx_v_self->_formatter;
    goto __pyx_L0;

    /* "H2MM_C.pyx":655
 * 
 *         """
 *         if formatter is None:             # <<<<<<<<<<<<<<
 *             return self._formatter
 *         return formatter
*/
  }

  /* "H2MM_C.pyx":657
 *         if formatter is None:
 *             return self._formatter
 *         return formatter             # <<<<<<<<<<<<<<
 * 
 *     def _get_outstream(self, outstream):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_formatter);
  __pyx_r = __pyx_v_formatter;
  goto __pyx_L0;

  /* "H2MM_C.pyx":640
 *         return n_core
 * 
 *     def _get_formatter(self, formatter):             # <<<<<<<<<<<<<<
 *         """
 *         Get the formatter based on the value form kwargs.
*/

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

/* "H2MM_C.pyx":659
 *         return formatter
 * 
 *     def _get_outstream(self, outstream):             # <<<<<<<<<<<<<<
 *         """
 *         Ge the output stream based on keyword argument to print_stream
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_19_get_outstream(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_13opt_lim_const_18_get_outstream, "\n        Ge the output stream based on keyword argument to print_stream\n\n        Parameters\n        ----------\n        outstream : Output Stream\n            Stream .\n\n        Returns\n        -------\n        OutputStream\n            DESCRIPTION.\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_19_get_outstream = {"_get_outstream", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_19_get_outstream, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_18_get_outstream};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_19_get_outstream(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_outstream = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_outstream (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outstream,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 659, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 659, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_outstream", 0) < (0)) __PYX_ERR(0, 659, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_outstream", 1, 1, 1, i); __PYX_ERR(0, 659, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 659, __pyx_L3_error)
    }
    __pyx_v_outstream = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_outstream", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 659, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_outstream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_18_get_outstream(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v_outstream);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_18_get_outstream(struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, PyObject *__pyx_v_outstream) {
  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;
  size_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_outstream", 0);

  /* "H2MM_C.pyx":674
 * 
 *         """
 *         if outstream is None:             # <<<<<<<<<<<<<<
 *             return self._outstream()
 *         return outstream
*/
  __pyx_t_1 = (__pyx_v_outstream == Py_None);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":675
 *         """
 *         if outstream is None:
 *             return self._outstream()             # <<<<<<<<<<<<<<
 *         return outstream
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self->_outstream);
    __pyx_t_4 = __pyx_v_self->_outstream; 
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 675, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":674
 * 
 *         """
 *         if outstream is None:             # <<<<<<<<<<<<<<
 *             return self._outstream()
 *         return outstream
*/
  }

  /* "H2MM_C.pyx":676
 *         if outstream is None:
 *             return self._outstream()
 *         return outstream             # <<<<<<<<<<<<<<
 * 
 * def get_stdout():
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_outstream);
  __pyx_r = __pyx_v_outstream;
  goto __pyx_L0;

  /* "H2MM_C.pyx":659
 *         return formatter
 * 
 *     def _get_outstream(self, outstream):             # <<<<<<<<<<<<<<
 *         """
 *         Ge the output stream based on keyword argument to print_stream
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("H2MM_C.opt_lim_const._get_outstream", __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_6H2MM_C_13opt_lim_const_21__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_21__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_21__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_21__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_20__reduce_cython__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C.opt_lim_const.__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_6H2MM_C_13opt_lim_const_23__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_13opt_lim_const_23__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_23__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_13opt_lim_const_23__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.opt_lim_const.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_13opt_lim_const_22__setstate_cython__(((struct __pyx_obj_6H2MM_C_opt_lim_const *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_13opt_lim_const_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_opt_lim_const *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C.opt_lim_const.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":678
 *         return outstream
 * 
 * def get_stdout():             # <<<<<<<<<<<<<<
 *     """Simple callable returns sys.stdout"""
 *     return sys.stdout
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_7get_stdout(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_6get_stdout, "Simple callable returns sys.stdout");
static PyMethodDef __pyx_mdef_6H2MM_C_7get_stdout = {"get_stdout", (PyCFunction)__pyx_pw_6H2MM_C_7get_stdout, METH_NOARGS, __pyx_doc_6H2MM_C_6get_stdout};
static PyObject *__pyx_pw_6H2MM_C_7get_stdout(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_stdout (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_6get_stdout(__pyx_self);

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

static PyObject *__pyx_pf_6H2MM_C_6get_stdout(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_stdout", 0);

  /* "H2MM_C.pyx":680
 * def get_stdout():
 *     """Simple callable returns sys.stdout"""
 *     return sys.stdout             # <<<<<<<<<<<<<<
 * 
 * #: Like rcParams, a place to set defaults for optimization limits
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_stdout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __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;

  /* "H2MM_C.pyx":678
 *         return outstream
 * 
 * def get_stdout():             # <<<<<<<<<<<<<<
 *     """Simple callable returns sys.stdout"""
 *     return sys.stdout
*/

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

/* "H2MM_C.pyx":689
 * cdef class ConvCodes:
 *     """Bitmask for conv_code flags"""
 *     @property             # <<<<<<<<<<<<<<
 *     def ll_computed(self):
 *         """Model has had loglik computed against some data (either during optimization or singly"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_11ll_computed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_11ll_computed_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_11ll_computed___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_11ll_computed___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":692
 *     def ll_computed(self):
 *         """Model has had loglik computed against some data (either during optimization or singly"""
 *         return CONVCODE_LLCOMPUTED             # <<<<<<<<<<<<<<
 *     @property
 *     def from_opt(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_LLCOMPUTED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":689
 * cdef class ConvCodes:
 *     """Bitmask for conv_code flags"""
 *     @property             # <<<<<<<<<<<<<<
 *     def ll_computed(self):
 *         """Model has had loglik computed against some data (either during optimization or singly"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.ll_computed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":693
 *         """Model has had loglik computed against some data (either during optimization or singly"""
 *         return CONVCODE_LLCOMPUTED
 *     @property             # <<<<<<<<<<<<<<
 *     def from_opt(self):
 *         """Model was created during optimization"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8from_opt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8from_opt_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_8from_opt___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8from_opt___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":696
 *     def from_opt(self):
 *         """Model was created during optimization"""
 *         return CONVCODE_FROMOPT             # <<<<<<<<<<<<<<
 *     @property
 *     def output(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_FROMOPT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":693
 *         """Model has had loglik computed against some data (either during optimization or singly"""
 *         return CONVCODE_LLCOMPUTED
 *     @property             # <<<<<<<<<<<<<<
 *     def from_opt(self):
 *         """Model was created during optimization"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.from_opt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":697
 *         """Model was created during optimization"""
 *         return CONVCODE_FROMOPT
 *     @property             # <<<<<<<<<<<<<<
 *     def output(self):
 *         """Model is best model during optimization, by some criterion marked by other flags"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_6output_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_6output_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_6output___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_6output___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":700
 *     def output(self):
 *         """Model is best model during optimization, by some criterion marked by other flags"""
 *         return CONVCODE_OUTPUT             # <<<<<<<<<<<<<<
 *     @property
 *     def converged(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_OUTPUT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":697
 *         """Model was created during optimization"""
 *         return CONVCODE_FROMOPT
 *     @property             # <<<<<<<<<<<<<<
 *     def output(self):
 *         """Model is best model during optimization, by some criterion marked by other flags"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.output.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":701
 *         """Model is best model during optimization, by some criterion marked by other flags"""
 *         return CONVCODE_OUTPUT
 *     @property             # <<<<<<<<<<<<<<
 *     def converged(self):
 *         """Model has best logliklihood within converged_min threshold"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_9converged_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_9converged_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_9converged___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_9converged___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":704
 *     def converged(self):
 *         """Model has best logliklihood within converged_min threshold"""
 *         return CONVCODE_CONVERGED             # <<<<<<<<<<<<<<
 *     @property
 *     def max_iter(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_CONVERGED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":701
 *         """Model is best model during optimization, by some criterion marked by other flags"""
 *         return CONVCODE_OUTPUT
 *     @property             # <<<<<<<<<<<<<<
 *     def converged(self):
 *         """Model has best logliklihood within converged_min threshold"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.converged.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":705
 *         """Model has best logliklihood within converged_min threshold"""
 *         return CONVCODE_CONVERGED
 *     @property             # <<<<<<<<<<<<<<
 *     def max_iter(self):
 *         """Optimization reached maximum number of iterations"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8max_iter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8max_iter_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_8max_iter___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8max_iter___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":708
 *     def max_iter(self):
 *         """Optimization reached maximum number of iterations"""
 *         return CONVCODE_MAXITER             # <<<<<<<<<<<<<<
 *     @property
 *     def max_time(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_MAXITER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":705
 *         """Model has best logliklihood within converged_min threshold"""
 *         return CONVCODE_CONVERGED
 *     @property             # <<<<<<<<<<<<<<
 *     def max_iter(self):
 *         """Optimization reached maximum number of iterations"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.max_iter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":709
 *         """Optimization reached maximum number of iterations"""
 *         return CONVCODE_MAXITER
 *     @property             # <<<<<<<<<<<<<<
 *     def max_time(self):
 *         """Optimization reach maximum time"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8max_time_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8max_time_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_8max_time___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8max_time___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":712
 *     def max_time(self):
 *         """Optimization reach maximum time"""
 *         return CONVCODE_MAXTIME             # <<<<<<<<<<<<<<
 *     @property
 *     def error(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_MAXTIME); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":709
 *         """Optimization reached maximum number of iterations"""
 *         return CONVCODE_MAXITER
 *     @property             # <<<<<<<<<<<<<<
 *     def max_time(self):
 *         """Optimization reach maximum time"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.max_time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":713
 *         """Optimization reach maximum time"""
 *         return CONVCODE_MAXTIME
 *     @property             # <<<<<<<<<<<<<<
 *     def error(self):
 *         """Error occured during optimization"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_5error_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_5error_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_5error___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_5error___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":716
 *     def error(self):
 *         """Error occured during optimization"""
 *         return CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *     @property
 *     def post_opt(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_ERROR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":713
 *         """Optimization reach maximum time"""
 *         return CONVCODE_MAXTIME
 *     @property             # <<<<<<<<<<<<<<
 *     def error(self):
 *         """Error occured during optimization"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":717
 *         """Error occured during optimization"""
 *         return CONVCODE_ERROR
 *     @property             # <<<<<<<<<<<<<<
 *     def post_opt(self):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8post_opt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_8post_opt_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_8post_opt___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_8post_opt___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":723
 *         and old, or is new and loglik is not calculated
 *         """
 *         return CONVCODE_POSTMODEL             # <<<<<<<<<<<<<<
 *     @property
 *     def frozen(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_POSTMODEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":717
 *         """Error occured during optimization"""
 *         return CONVCODE_ERROR
 *     @property             # <<<<<<<<<<<<<<
 *     def post_opt(self):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.post_opt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":724
 *         """
 *         return CONVCODE_POSTMODEL
 *     @property             # <<<<<<<<<<<<<<
 *     def frozen(self):
 *         """Model cannot be modified in place"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_6frozen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_6frozen_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_6frozen___get__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_6frozen___get__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":727
 *     def frozen(self):
 *         """Model cannot be modified in place"""
 *         return CONVCODE_FIXEDMODEL             # <<<<<<<<<<<<<<
 * 
 * convcode = ConvCodes()
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_FIXEDMODEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":724
 *         """
 *         return CONVCODE_POSTMODEL
 *     @property             # <<<<<<<<<<<<<<
 *     def frozen(self):
 *         """Model cannot be modified in place"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.frozen.__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_6H2MM_C_9ConvCodes_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_9ConvCodes_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_9ConvCodes_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_1__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes___reduce_cython__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes___reduce_cython__(struct __pyx_obj_6H2MM_C_ConvCodes *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None and _dict:
 *         state += (_dict,)
*/
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_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 = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:
 *         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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error);
    __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 and _dict:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = ('False',)
*/
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None and _dict:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = ('False',)             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state
*/
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[10]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error)
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = ('False',)
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = ('False',)
 *     if use_setstate:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ConvCodes); 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))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error);
    __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 = ('False',)
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state
 *     else:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ConvCodes__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ConvCodes); 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))));
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __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);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error);
    __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("H2MM_C.ConvCodes.__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_ConvCodes, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ConvCodes__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_9ConvCodes_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_9ConvCodes_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_9ConvCodes_3__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.ConvCodes.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_9ConvCodes_2__setstate_cython__(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_9ConvCodes_2__setstate_cython__(struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_ConvCodes__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __pyx_v___pyx_state;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error)
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
    __PYX_ERR(1, 17, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_f_6H2MM_C___pyx_unpickle_ConvCodes__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __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;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ConvCodes__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_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.ConvCodes.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":735
 * ######################## Alloc/Free utility functions  ########################
 * ###############################################################################
 * cdef int Py_free_model_fields(h2mm_mod *model):             # <<<<<<<<<<<<<<
 *     if model is NULL:
 *         return 0
*/

static int __pyx_f_6H2MM_C_Py_free_model_fields(h2mm_mod *__pyx_v_model) {
  int __pyx_r;
  int __pyx_t_1;

  /* "H2MM_C.pyx":736
 * ###############################################################################
 * cdef int Py_free_model_fields(h2mm_mod *model):
 *     if model is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if model.prior is not NULL:
*/
  __pyx_t_1 = (__pyx_v_model == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":737
 * cdef int Py_free_model_fields(h2mm_mod *model):
 *     if model is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     if model.prior is not NULL:
 *         PyMem_Free(model.prior)
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":736
 * ###############################################################################
 * cdef int Py_free_model_fields(h2mm_mod *model):
 *     if model is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     if model.prior is not NULL:
*/
  }

  /* "H2MM_C.pyx":738
 *     if model is NULL:
 *         return 0
 *     if model.prior is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.prior)
 *         model.prior = NULL
*/
  __pyx_t_1 = (__pyx_v_model->prior != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":739
 *         return 0
 *     if model.prior is not NULL:
 *         PyMem_Free(model.prior)             # <<<<<<<<<<<<<<
 *         model.prior = NULL
 *     if model.trans is not NULL:
*/
    PyMem_Free(__pyx_v_model->prior);

    /* "H2MM_C.pyx":740
 *     if model.prior is not NULL:
 *         PyMem_Free(model.prior)
 *         model.prior = NULL             # <<<<<<<<<<<<<<
 *     if model.trans is not NULL:
 *         PyMem_Free(model.trans)
*/
    __pyx_v_model->prior = NULL;

    /* "H2MM_C.pyx":738
 *     if model is NULL:
 *         return 0
 *     if model.prior is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.prior)
 *         model.prior = NULL
*/
  }

  /* "H2MM_C.pyx":741
 *         PyMem_Free(model.prior)
 *         model.prior = NULL
 *     if model.trans is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.trans)
 *         model.trans = NULL
*/
  __pyx_t_1 = (__pyx_v_model->trans != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":742
 *         model.prior = NULL
 *     if model.trans is not NULL:
 *         PyMem_Free(model.trans)             # <<<<<<<<<<<<<<
 *         model.trans = NULL
 *     if model.obs is not NULL:
*/
    PyMem_Free(__pyx_v_model->trans);

    /* "H2MM_C.pyx":743
 *     if model.trans is not NULL:
 *         PyMem_Free(model.trans)
 *         model.trans = NULL             # <<<<<<<<<<<<<<
 *     if model.obs is not NULL:
 *         PyMem_Free(model.obs)
*/
    __pyx_v_model->trans = NULL;

    /* "H2MM_C.pyx":741
 *         PyMem_Free(model.prior)
 *         model.prior = NULL
 *     if model.trans is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.trans)
 *         model.trans = NULL
*/
  }

  /* "H2MM_C.pyx":744
 *         PyMem_Free(model.trans)
 *         model.trans = NULL
 *     if model.obs is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.obs)
 *         model.obs = NULL
*/
  __pyx_t_1 = (__pyx_v_model->obs != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":745
 *         model.trans = NULL
 *     if model.obs is not NULL:
 *         PyMem_Free(model.obs)             # <<<<<<<<<<<<<<
 *         model.obs = NULL
 *     model.ndet = 0
*/
    PyMem_Free(__pyx_v_model->obs);

    /* "H2MM_C.pyx":746
 *     if model.obs is not NULL:
 *         PyMem_Free(model.obs)
 *         model.obs = NULL             # <<<<<<<<<<<<<<
 *     model.ndet = 0
 *     model.nstate = 0
*/
    __pyx_v_model->obs = NULL;

    /* "H2MM_C.pyx":744
 *         PyMem_Free(model.trans)
 *         model.trans = NULL
 *     if model.obs is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(model.obs)
 *         model.obs = NULL
*/
  }

  /* "H2MM_C.pyx":747
 *         PyMem_Free(model.obs)
 *         model.obs = NULL
 *     model.ndet = 0             # <<<<<<<<<<<<<<
 *     model.nstate = 0
 *     model.nphot = 0
*/
  __pyx_v_model->ndet = 0;

  /* "H2MM_C.pyx":748
 *         model.obs = NULL
 *     model.ndet = 0
 *     model.nstate = 0             # <<<<<<<<<<<<<<
 *     model.nphot = 0
 *     model.loglik = 0.0
*/
  __pyx_v_model->nstate = 0;

  /* "H2MM_C.pyx":749
 *     model.ndet = 0
 *     model.nstate = 0
 *     model.nphot = 0             # <<<<<<<<<<<<<<
 *     model.loglik = 0.0
 *     model.conv = 0
*/
  __pyx_v_model->nphot = 0;

  /* "H2MM_C.pyx":750
 *     model.nstate = 0
 *     model.nphot = 0
 *     model.loglik = 0.0             # <<<<<<<<<<<<<<
 *     model.conv = 0
 *     return 0
*/
  __pyx_v_model->loglik = 0.0;

  /* "H2MM_C.pyx":751
 *     model.nphot = 0
 *     model.loglik = 0.0
 *     model.conv = 0             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  __pyx_v_model->conv = 0;

  /* "H2MM_C.pyx":752
 *     model.loglik = 0.0
 *     model.conv = 0
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":735
 * ######################## Alloc/Free utility functions  ########################
 * ###############################################################################
 * cdef int Py_free_model_fields(h2mm_mod *model):             # <<<<<<<<<<<<<<
 *     if model is NULL:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":755
 * 
 * 
 * cdef int Py_free_models(const int64_t nmodels, h2mm_mod *models):             # <<<<<<<<<<<<<<
 *     if models is NULL:
 *         return 0
*/

static int __pyx_f_6H2MM_C_Py_free_models(int64_t const __pyx_v_nmodels, h2mm_mod *__pyx_v_models) {
  int64_t __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  int64_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":756
 * 
 * cdef int Py_free_models(const int64_t nmodels, h2mm_mod *models):
 *     if models is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i
*/
  __pyx_t_1 = (__pyx_v_models == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":757
 * cdef int Py_free_models(const int64_t nmodels, h2mm_mod *models):
 *     if models is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     for i in range(nmodels):
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":756
 * 
 * cdef int Py_free_models(const int64_t nmodels, h2mm_mod *models):
 *     if models is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i
*/
  }

  /* "H2MM_C.pyx":759
 *         return 0
 *     cdef int64_t i
 *     for i in range(nmodels):             # <<<<<<<<<<<<<<
 *         Py_free_model_fields(&models[i])
 *     PyMem_Free(models)
*/
  __pyx_t_2 = __pyx_v_nmodels;
  __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;

    /* "H2MM_C.pyx":760
 *     cdef int64_t i
 *     for i in range(nmodels):
 *         Py_free_model_fields(&models[i])             # <<<<<<<<<<<<<<
 *     PyMem_Free(models)
 *     return 0
*/
    __pyx_t_5 = __pyx_f_6H2MM_C_Py_free_model_fields((&(__pyx_v_models[__pyx_v_i]))); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error)
  }

  /* "H2MM_C.pyx":761
 *     for i in range(nmodels):
 *         Py_free_model_fields(&models[i])
 *     PyMem_Free(models)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  PyMem_Free(__pyx_v_models);

  /* "H2MM_C.pyx":762
 *         Py_free_model_fields(&models[i])
 *     PyMem_Free(models)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":755
 * 
 * 
 * cdef int Py_free_models(const int64_t nmodels, h2mm_mod *models):             # <<<<<<<<<<<<<<
 *     if models is NULL:
 *         return 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.Py_free_models", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":765
 * 
 * 
 * cdef h2mm_mod* Py_allocate_models(const int64_t nmodel, const int64_t nstate, const int64_t ndet, const int64_t nphot):             # <<<<<<<<<<<<<<
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if out is NULL:
*/

static h2mm_mod *__pyx_f_6H2MM_C_Py_allocate_models(int64_t const __pyx_v_nmodel, int64_t const __pyx_v_nstate, int64_t const __pyx_v_ndet, int64_t const __pyx_v_nphot) {
  h2mm_mod *__pyx_v_out;
  int64_t __pyx_v_i;
  h2mm_mod *__pyx_r;
  int __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  int64_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":766
 * 
 * cdef h2mm_mod* Py_allocate_models(const int64_t nmodel, const int64_t nstate, const int64_t ndet, const int64_t nphot):
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))             # <<<<<<<<<<<<<<
 *     if out is NULL:
 *         return out
*/
  __pyx_v_out = ((h2mm_mod *)PyMem_Malloc((__pyx_v_nmodel * (sizeof(h2mm_mod)))));

  /* "H2MM_C.pyx":767
 * cdef h2mm_mod* Py_allocate_models(const int64_t nmodel, const int64_t nstate, const int64_t ndet, const int64_t nphot):
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if out is NULL:             # <<<<<<<<<<<<<<
 *         return out
 *     cdef int64_t i
*/
  __pyx_t_1 = (__pyx_v_out == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":768
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if out is NULL:
 *         return out             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     for i in range(nmodel):
*/
    __pyx_r = __pyx_v_out;
    goto __pyx_L0;

    /* "H2MM_C.pyx":767
 * cdef h2mm_mod* Py_allocate_models(const int64_t nmodel, const int64_t nstate, const int64_t ndet, const int64_t nphot):
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if out is NULL:             # <<<<<<<<<<<<<<
 *         return out
 *     cdef int64_t i
*/
  }

  /* "H2MM_C.pyx":770
 *         return out
 *     cdef int64_t i
 *     for i in range(nmodel):             # <<<<<<<<<<<<<<
 *         out[i].loglik = 0.0
 *         out[i].niter = 0
*/
  __pyx_t_2 = __pyx_v_nmodel;
  __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;

    /* "H2MM_C.pyx":771
 *     cdef int64_t i
 *     for i in range(nmodel):
 *         out[i].loglik = 0.0             # <<<<<<<<<<<<<<
 *         out[i].niter = 0
 *         out[i].conv = 0
*/
    (__pyx_v_out[__pyx_v_i]).loglik = 0.0;

    /* "H2MM_C.pyx":772
 *     for i in range(nmodel):
 *         out[i].loglik = 0.0
 *         out[i].niter = 0             # <<<<<<<<<<<<<<
 *         out[i].conv = 0
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))
*/
    (__pyx_v_out[__pyx_v_i]).niter = 0;

    /* "H2MM_C.pyx":773
 *         out[i].loglik = 0.0
 *         out[i].niter = 0
 *         out[i].conv = 0             # <<<<<<<<<<<<<<
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         if out[i].prior is NULL:
*/
    (__pyx_v_out[__pyx_v_i]).conv = 0;

    /* "H2MM_C.pyx":774
 *         out[i].niter = 0
 *         out[i].conv = 0
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         if out[i].prior is NULL:
 *             Py_free_models(i, out)
*/
    (__pyx_v_out[__pyx_v_i]).prior = ((double *)PyMem_Malloc((__pyx_v_nstate * (sizeof(double)))));

    /* "H2MM_C.pyx":775
 *         out[i].conv = 0
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         if out[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(i, out)
 *             out = NULL
*/
    __pyx_t_1 = ((__pyx_v_out[__pyx_v_i]).prior == NULL);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":776
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         if out[i].prior is NULL:
 *             Py_free_models(i, out)             # <<<<<<<<<<<<<<
 *             out = NULL
 *             return out
*/
      __pyx_t_5 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_out); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L1_error)

      /* "H2MM_C.pyx":777
 *         if out[i].prior is NULL:
 *             Py_free_models(i, out)
 *             out = NULL             # <<<<<<<<<<<<<<
 *             return out
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
*/
      __pyx_v_out = NULL;

      /* "H2MM_C.pyx":778
 *             Py_free_models(i, out)
 *             out = NULL
 *             return out             # <<<<<<<<<<<<<<
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         if out[i].trans is NULL:
*/
      __pyx_r = __pyx_v_out;
      goto __pyx_L0;

      /* "H2MM_C.pyx":775
 *         out[i].conv = 0
 *         out[i].prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         if out[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(i, out)
 *             out = NULL
*/
    }

    /* "H2MM_C.pyx":779
 *             out = NULL
 *             return out
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         if out[i].trans is NULL:
 *             PyMem_Free(out[i].prior)
*/
    (__pyx_v_out[__pyx_v_i]).trans = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_nstate) * (sizeof(double)))));

    /* "H2MM_C.pyx":780
 *             return out
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         if out[i].trans is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
*/
    __pyx_t_1 = ((__pyx_v_out[__pyx_v_i]).trans == NULL);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":781
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         if out[i].trans is NULL:
 *             PyMem_Free(out[i].prior)             # <<<<<<<<<<<<<<
 *             out[i].prior = NULL
 *             Py_free_models(i, out)
*/
      PyMem_Free((__pyx_v_out[__pyx_v_i]).prior);

      /* "H2MM_C.pyx":782
 *         if out[i].trans is NULL:
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL             # <<<<<<<<<<<<<<
 *             Py_free_models(i, out)
 *             out = NULL
*/
      (__pyx_v_out[__pyx_v_i]).prior = NULL;

      /* "H2MM_C.pyx":783
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
 *             Py_free_models(i, out)             # <<<<<<<<<<<<<<
 *             out = NULL
 *             return out
*/
      __pyx_t_5 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_out); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L1_error)

      /* "H2MM_C.pyx":784
 *             out[i].prior = NULL
 *             Py_free_models(i, out)
 *             out = NULL             # <<<<<<<<<<<<<<
 *             return out
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
*/
      __pyx_v_out = NULL;

      /* "H2MM_C.pyx":785
 *             Py_free_models(i, out)
 *             out = NULL
 *             return out             # <<<<<<<<<<<<<<
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         if out[i].prior is NULL:
*/
      __pyx_r = __pyx_v_out;
      goto __pyx_L0;

      /* "H2MM_C.pyx":780
 *             return out
 *         out[i].trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         if out[i].trans is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
*/
    }

    /* "H2MM_C.pyx":786
 *             out = NULL
 *             return out
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))             # <<<<<<<<<<<<<<
 *         if out[i].prior is NULL:
 *             PyMem_Free(out[i].prior)
*/
    (__pyx_v_out[__pyx_v_i]).obs = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_ndet) * (sizeof(double)))));

    /* "H2MM_C.pyx":787
 *             return out
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         if out[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
*/
    __pyx_t_1 = ((__pyx_v_out[__pyx_v_i]).prior == NULL);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":788
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         if out[i].prior is NULL:
 *             PyMem_Free(out[i].prior)             # <<<<<<<<<<<<<<
 *             out[i].prior = NULL
 *             PyMem_Free(out[i].trans)
*/
      PyMem_Free((__pyx_v_out[__pyx_v_i]).prior);

      /* "H2MM_C.pyx":789
 *         if out[i].prior is NULL:
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL             # <<<<<<<<<<<<<<
 *             PyMem_Free(out[i].trans)
 *             out[i].trans = NULL
*/
      (__pyx_v_out[__pyx_v_i]).prior = NULL;

      /* "H2MM_C.pyx":790
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
 *             PyMem_Free(out[i].trans)             # <<<<<<<<<<<<<<
 *             out[i].trans = NULL
 *             Py_free_models(i, out)
*/
      PyMem_Free((__pyx_v_out[__pyx_v_i]).trans);

      /* "H2MM_C.pyx":791
 *             out[i].prior = NULL
 *             PyMem_Free(out[i].trans)
 *             out[i].trans = NULL             # <<<<<<<<<<<<<<
 *             Py_free_models(i, out)
 *             out = NULL
*/
      (__pyx_v_out[__pyx_v_i]).trans = NULL;

      /* "H2MM_C.pyx":792
 *             PyMem_Free(out[i].trans)
 *             out[i].trans = NULL
 *             Py_free_models(i, out)             # <<<<<<<<<<<<<<
 *             out = NULL
 *             return out
*/
      __pyx_t_5 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_out); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L1_error)

      /* "H2MM_C.pyx":793
 *             out[i].trans = NULL
 *             Py_free_models(i, out)
 *             out = NULL             # <<<<<<<<<<<<<<
 *             return out
 *         out[i].nstate = nstate
*/
      __pyx_v_out = NULL;

      /* "H2MM_C.pyx":794
 *             Py_free_models(i, out)
 *             out = NULL
 *             return out             # <<<<<<<<<<<<<<
 *         out[i].nstate = nstate
 *         out[i].ndet = ndet
*/
      __pyx_r = __pyx_v_out;
      goto __pyx_L0;

      /* "H2MM_C.pyx":787
 *             return out
 *         out[i].obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         if out[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(out[i].prior)
 *             out[i].prior = NULL
*/
    }

    /* "H2MM_C.pyx":795
 *             out = NULL
 *             return out
 *         out[i].nstate = nstate             # <<<<<<<<<<<<<<
 *         out[i].ndet = ndet
 *         out[i].nphot = nphot
*/
    (__pyx_v_out[__pyx_v_i]).nstate = __pyx_v_nstate;

    /* "H2MM_C.pyx":796
 *             return out
 *         out[i].nstate = nstate
 *         out[i].ndet = ndet             # <<<<<<<<<<<<<<
 *         out[i].nphot = nphot
 *         out[i].niter = 0
*/
    (__pyx_v_out[__pyx_v_i]).ndet = __pyx_v_ndet;

    /* "H2MM_C.pyx":797
 *         out[i].nstate = nstate
 *         out[i].ndet = ndet
 *         out[i].nphot = nphot             # <<<<<<<<<<<<<<
 *         out[i].niter = 0
 *         out[i].loglik = 0.0
*/
    (__pyx_v_out[__pyx_v_i]).nphot = __pyx_v_nphot;

    /* "H2MM_C.pyx":798
 *         out[i].ndet = ndet
 *         out[i].nphot = nphot
 *         out[i].niter = 0             # <<<<<<<<<<<<<<
 *         out[i].loglik = 0.0
 *         out[i].conv = 0
*/
    (__pyx_v_out[__pyx_v_i]).niter = 0;

    /* "H2MM_C.pyx":799
 *         out[i].nphot = nphot
 *         out[i].niter = 0
 *         out[i].loglik = 0.0             # <<<<<<<<<<<<<<
 *         out[i].conv = 0
 *     return out
*/
    (__pyx_v_out[__pyx_v_i]).loglik = 0.0;

    /* "H2MM_C.pyx":800
 *         out[i].niter = 0
 *         out[i].loglik = 0.0
 *         out[i].conv = 0             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
    (__pyx_v_out[__pyx_v_i]).conv = 0;
  }

  /* "H2MM_C.pyx":801
 *         out[i].loglik = 0.0
 *         out[i].conv = 0
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":765
 * 
 * 
 * cdef h2mm_mod* Py_allocate_models(const int64_t nmodel, const int64_t nstate, const int64_t ndet, const int64_t nphot):             # <<<<<<<<<<<<<<
 *     cdef h2mm_mod *out = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if out is NULL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.Py_allocate_models", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":804
 * 
 * 
 * cdef str get_conv_convtype(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = str()
 *     if conv & CONVCODE_CONVERGED:
*/

static PyObject *__pyx_f_6H2MM_C_get_conv_convtype(int64_t __pyx_v_conv) {
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_conv_convtype", 0);

  /* "H2MM_C.pyx":805
 * 
 * cdef str get_conv_convtype(int64_t conv):
 *     cdef str out = str()             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_CONVERGED:
 *         out += ' converged'
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__7);
  __pyx_v_out = __pyx_mstate_global->__pyx_kp_u__7;

  /* "H2MM_C.pyx":806
 * cdef str get_conv_convtype(int64_t conv):
 *     cdef str out = str()
 *     if conv & CONVCODE_CONVERGED:             # <<<<<<<<<<<<<<
 *         out += ' converged'
 *     if conv & CONVCODE_MAXITER:
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_CONVERGED) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":807
 *     cdef str out = str()
 *     if conv & CONVCODE_CONVERGED:
 *         out += ' converged'             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_MAXITER:
 *         out += ' maximum iterations'
*/
    __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_converged); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":806
 * cdef str get_conv_convtype(int64_t conv):
 *     cdef str out = str()
 *     if conv & CONVCODE_CONVERGED:             # <<<<<<<<<<<<<<
 *         out += ' converged'
 *     if conv & CONVCODE_MAXITER:
*/
  }

  /* "H2MM_C.pyx":808
 *     if conv & CONVCODE_CONVERGED:
 *         out += ' converged'
 *     if conv & CONVCODE_MAXITER:             # <<<<<<<<<<<<<<
 *         out += ' maximum iterations'
 *     if conv & CONVCODE_MAXTIME:
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_MAXITER) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":809
 *         out += ' converged'
 *     if conv & CONVCODE_MAXITER:
 *         out += ' maximum iterations'             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_MAXTIME:
 *         out += ' maximum time'
*/
    __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_maximum_iterations); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":808
 *     if conv & CONVCODE_CONVERGED:
 *         out += ' converged'
 *     if conv & CONVCODE_MAXITER:             # <<<<<<<<<<<<<<
 *         out += ' maximum iterations'
 *     if conv & CONVCODE_MAXTIME:
*/
  }

  /* "H2MM_C.pyx":810
 *     if conv & CONVCODE_MAXITER:
 *         out += ' maximum iterations'
 *     if conv & CONVCODE_MAXTIME:             # <<<<<<<<<<<<<<
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_MAXTIME) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":811
 *         out += ' maximum iterations'
 *     if conv & CONVCODE_MAXTIME:
 *         out += ' maximum time'             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_ERROR:
 *         if conv & CONVCODE_OUTPUT:
*/
    __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_maximum_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":810
 *     if conv & CONVCODE_MAXITER:
 *         out += ' maximum iterations'
 *     if conv & CONVCODE_MAXTIME:             # <<<<<<<<<<<<<<
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:
*/
  }

  /* "H2MM_C.pyx":812
 *     if conv & CONVCODE_MAXTIME:
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_OUTPUT:
 *             out += ' error in next iteration'
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_ERROR) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":813
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:
 *         if conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             out += ' error in next iteration'
 *         else:
*/
    __pyx_t_1 = ((__pyx_v_conv & CONVCODE_OUTPUT) != 0);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":814
 *     if conv & CONVCODE_ERROR:
 *         if conv & CONVCODE_OUTPUT:
 *             out += ' error in next iteration'             # <<<<<<<<<<<<<<
 *         else:
 *             out += ' error in current calculation'
*/
      __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_error_in_next_iteration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 814, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "H2MM_C.pyx":813
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:
 *         if conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             out += ' error in next iteration'
 *         else:
*/
      goto __pyx_L7;
    }

    /* "H2MM_C.pyx":816
 *             out += ' error in next iteration'
 *         else:
 *             out += ' error in current calculation'             # <<<<<<<<<<<<<<
 *     return out.strip(' ')
 * 
*/
    /*else*/ {
      __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_error_in_current_calculation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;
    }
    __pyx_L7:;

    /* "H2MM_C.pyx":812
 *     if conv & CONVCODE_MAXTIME:
 *         out += ' maximum time'
 *     if conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_OUTPUT:
 *             out += ' error in next iteration'
*/
  }

  /* "H2MM_C.pyx":817
 *         else:
 *             out += ' error in current calculation'
 *     return out.strip(' ')             # <<<<<<<<<<<<<<
 * 
 * cdef str get_conv_str(int64_t conv):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__strip, __pyx_v_out, __pyx_mstate_global->__pyx_kp_u__13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":804
 * 
 * 
 * cdef str get_conv_convtype(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = str()
 *     if conv & CONVCODE_CONVERGED:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.get_conv_convtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":819
 *     return out.strip(' ')
 * 
 * cdef str get_conv_str(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:
*/

static PyObject *__pyx_f_6H2MM_C_get_conv_str(int64_t __pyx_v_conv) {
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_conv_str", 0);

  /* "H2MM_C.pyx":820
 * 
 * cdef str get_conv_str(int64_t conv):
 *     cdef str out = str()             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_FROMOPT:
 *         if conv & CONVCODE_OUTPUT:
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__7);
  __pyx_v_out = __pyx_mstate_global->__pyx_kp_u__7;

  /* "H2MM_C.pyx":821
 * cdef str get_conv_str(int64_t conv):
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_OUTPUT:
 *             return 'final optimized model by ' + get_conv_convtype(conv)
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_FROMOPT) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":822
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:
 *         if conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             return 'final optimized model by ' + get_conv_convtype(conv)
 *         if conv & CONVCODE_POSTMODEL:
*/
    __pyx_t_1 = ((__pyx_v_conv & CONVCODE_OUTPUT) != 0);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":823
 *     if conv & CONVCODE_FROMOPT:
 *         if conv & CONVCODE_OUTPUT:
 *             return 'final optimized model by ' + get_conv_convtype(conv)             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_POSTMODEL:
 *             out = 'post-optimization LL'
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_6H2MM_C_get_conv_convtype(__pyx_v_conv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_ConcatSafe(__pyx_mstate_global->__pyx_kp_u_final_optimized_model_by, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":822
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:
 *         if conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             return 'final optimized model by ' + get_conv_convtype(conv)
 *         if conv & CONVCODE_POSTMODEL:
*/
    }

    /* "H2MM_C.pyx":824
 *         if conv & CONVCODE_OUTPUT:
 *             return 'final optimized model by ' + get_conv_convtype(conv)
 *         if conv & CONVCODE_POSTMODEL:             # <<<<<<<<<<<<<<
 *             out = 'post-optimization LL'
 *             if not (conv & CONVCODE_LLCOMPUTED):
*/
    __pyx_t_1 = ((__pyx_v_conv & CONVCODE_POSTMODEL) != 0);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":825
 *             return 'final optimized model by ' + get_conv_convtype(conv)
 *         if conv & CONVCODE_POSTMODEL:
 *             out = 'post-optimization LL'             # <<<<<<<<<<<<<<
 *             if not (conv & CONVCODE_LLCOMPUTED):
 *                 out += 'un-'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_post_optimization_LL);
      __Pyx_DECREF_SET(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_post_optimization_LL);

      /* "H2MM_C.pyx":826
 *         if conv & CONVCODE_POSTMODEL:
 *             out = 'post-optimization LL'
 *             if not (conv & CONVCODE_LLCOMPUTED):             # <<<<<<<<<<<<<<
 *                 out += 'un-'
 *             out += 'copmuted model by ' + get_conv_convtype(conv)
*/
      __pyx_t_1 = (!((__pyx_v_conv & CONVCODE_LLCOMPUTED) != 0));
      if (__pyx_t_1) {

        /* "H2MM_C.pyx":827
 *             out = 'post-optimization LL'
 *             if not (conv & CONVCODE_LLCOMPUTED):
 *                 out += 'un-'             # <<<<<<<<<<<<<<
 *             out += 'copmuted model by ' + get_conv_convtype(conv)
 *             return out
*/
        __pyx_t_3 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_un); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "H2MM_C.pyx":826
 *         if conv & CONVCODE_POSTMODEL:
 *             out = 'post-optimization LL'
 *             if not (conv & CONVCODE_LLCOMPUTED):             # <<<<<<<<<<<<<<
 *                 out += 'un-'
 *             out += 'copmuted model by ' + get_conv_convtype(conv)
*/
      }

      /* "H2MM_C.pyx":828
 *             if not (conv & CONVCODE_LLCOMPUTED):
 *                 out += 'un-'
 *             out += 'copmuted model by ' + get_conv_convtype(conv)             # <<<<<<<<<<<<<<
 *             return out
 *         out = 'mid-optimization '
*/
      __pyx_t_3 = __pyx_f_6H2MM_C_get_conv_convtype(__pyx_v_conv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_mstate_global->__pyx_kp_u_copmuted_model_by, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":829
 *                 out += 'un-'
 *             out += 'copmuted model by ' + get_conv_convtype(conv)
 *             return out             # <<<<<<<<<<<<<<
 *         out = 'mid-optimization '
 *         if not (conv & CONVCODE_LLCOMPUTED):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_out);
      __pyx_r = __pyx_v_out;
      goto __pyx_L0;

      /* "H2MM_C.pyx":824
 *         if conv & CONVCODE_OUTPUT:
 *             return 'final optimized model by ' + get_conv_convtype(conv)
 *         if conv & CONVCODE_POSTMODEL:             # <<<<<<<<<<<<<<
 *             out = 'post-optimization LL'
 *             if not (conv & CONVCODE_LLCOMPUTED):
*/
    }

    /* "H2MM_C.pyx":830
 *             out += 'copmuted model by ' + get_conv_convtype(conv)
 *             return out
 *         out = 'mid-optimization '             # <<<<<<<<<<<<<<
 *         if not (conv & CONVCODE_LLCOMPUTED):
 *             out += 'un-'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_mid_optimization);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_mid_optimization);

    /* "H2MM_C.pyx":831
 *             return out
 *         out = 'mid-optimization '
 *         if not (conv & CONVCODE_LLCOMPUTED):             # <<<<<<<<<<<<<<
 *             out += 'un-'
 *         out += 'computed mode'
*/
    __pyx_t_1 = (!((__pyx_v_conv & CONVCODE_LLCOMPUTED) != 0));
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":832
 *         out = 'mid-optimization '
 *         if not (conv & CONVCODE_LLCOMPUTED):
 *             out += 'un-'             # <<<<<<<<<<<<<<
 *         out += 'computed mode'
 *         return out
*/
      __pyx_t_3 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_un); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":831
 *             return out
 *         out = 'mid-optimization '
 *         if not (conv & CONVCODE_LLCOMPUTED):             # <<<<<<<<<<<<<<
 *             out += 'un-'
 *         out += 'computed mode'
*/
    }

    /* "H2MM_C.pyx":833
 *         if not (conv & CONVCODE_LLCOMPUTED):
 *             out += 'un-'
 *         out += 'computed mode'             # <<<<<<<<<<<<<<
 *         return out
 *     if conv & CONVCODE_LLCOMPUTED:
*/
    __pyx_t_3 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_computed_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":834
 *             out += 'un-'
 *         out += 'computed mode'
 *         return out             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_LLCOMPUTED:
 *         out = 'singly-computed'
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_out);
    __pyx_r = __pyx_v_out;
    goto __pyx_L0;

    /* "H2MM_C.pyx":821
 * cdef str get_conv_str(int64_t conv):
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_OUTPUT:
 *             return 'final optimized model by ' + get_conv_convtype(conv)
*/
  }

  /* "H2MM_C.pyx":835
 *         out += 'computed mode'
 *         return out
 *     if conv & CONVCODE_LLCOMPUTED:             # <<<<<<<<<<<<<<
 *         out = 'singly-computed'
 *         if conv & CONVCODE_ERROR:
*/
  __pyx_t_1 = ((__pyx_v_conv & CONVCODE_LLCOMPUTED) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":836
 *         return out
 *     if conv & CONVCODE_LLCOMPUTED:
 *         out = 'singly-computed'             # <<<<<<<<<<<<<<
 *         if conv & CONVCODE_ERROR:
 *             out += ' with error'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_singly_computed);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_singly_computed);

    /* "H2MM_C.pyx":837
 *     if conv & CONVCODE_LLCOMPUTED:
 *         out = 'singly-computed'
 *         if conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *             out += ' with error'
 *         return out
*/
    __pyx_t_1 = ((__pyx_v_conv & CONVCODE_ERROR) != 0);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":838
 *         out = 'singly-computed'
 *         if conv & CONVCODE_ERROR:
 *             out += ' with error'             # <<<<<<<<<<<<<<
 *         return out
 *     return 'newly created model'
*/
      __pyx_t_3 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_mstate_global->__pyx_kp_u_with_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":837
 *     if conv & CONVCODE_LLCOMPUTED:
 *         out = 'singly-computed'
 *         if conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *             out += ' with error'
 *         return out
*/
    }

    /* "H2MM_C.pyx":839
 *         if conv & CONVCODE_ERROR:
 *             out += ' with error'
 *         return out             # <<<<<<<<<<<<<<
 *     return 'newly created model'
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_out);
    __pyx_r = __pyx_v_out;
    goto __pyx_L0;

    /* "H2MM_C.pyx":835
 *         out += 'computed mode'
 *         return out
 *     if conv & CONVCODE_LLCOMPUTED:             # <<<<<<<<<<<<<<
 *         out = 'singly-computed'
 *         if conv & CONVCODE_ERROR:
*/
  }

  /* "H2MM_C.pyx":840
 *             out += ' with error'
 *         return out
 *     return 'newly created model'             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_newly_created_model);
  __pyx_r = __pyx_mstate_global->__pyx_kp_u_newly_created_model;
  goto __pyx_L0;

  /* "H2MM_C.pyx":819
 *     return out.strip(' ')
 * 
 * cdef str get_conv_str(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = str()
 *     if conv & CONVCODE_FROMOPT:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("H2MM_C.get_conv_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":843
 * 
 * 
 * cdef str get_conv_descr(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:
*/

static PyObject *__pyx_f_6H2MM_C_get_conv_descr(int64_t __pyx_v_conv) {
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_conv_descr", 0);

  /* "H2MM_C.pyx":844
 * 
 * cdef str get_conv_descr(int64_t conv):
 *     cdef str out = get_conv_str(conv)             # <<<<<<<<<<<<<<
 *     if conv & CONVCODE_FIXEDMODEL:
 *         if conv & ~(CONVCODE_FIXEDMODEL):
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_get_conv_str(__pyx_v_conv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":845
 * cdef str get_conv_descr(int64_t conv):
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *         if conv & ~(CONVCODE_FIXEDMODEL):
 *             return 'hashed ' + out
*/
  __pyx_t_2 = ((__pyx_v_conv & CONVCODE_FIXEDMODEL) != 0);
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":846
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:
 *         if conv & ~(CONVCODE_FIXEDMODEL):             # <<<<<<<<<<<<<<
 *             return 'hashed ' + out
 *         return 'hashed model'
*/
    __pyx_t_2 = ((__pyx_v_conv & (~CONVCODE_FIXEDMODEL)) != 0);
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":847
 *     if conv & CONVCODE_FIXEDMODEL:
 *         if conv & ~(CONVCODE_FIXEDMODEL):
 *             return 'hashed ' + out             # <<<<<<<<<<<<<<
 *         return 'hashed model'
 *     return out
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyUnicode_ConcatSafe(__pyx_mstate_global->__pyx_kp_u_hashed, __pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":846
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:
 *         if conv & ~(CONVCODE_FIXEDMODEL):             # <<<<<<<<<<<<<<
 *             return 'hashed ' + out
 *         return 'hashed model'
*/
    }

    /* "H2MM_C.pyx":848
 *         if conv & ~(CONVCODE_FIXEDMODEL):
 *             return 'hashed ' + out
 *         return 'hashed model'             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_hashed_model);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u_hashed_model;
    goto __pyx_L0;

    /* "H2MM_C.pyx":845
 * cdef str get_conv_descr(int64_t conv):
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *         if conv & ~(CONVCODE_FIXEDMODEL):
 *             return 'hashed ' + out
*/
  }

  /* "H2MM_C.pyx":849
 *             return 'hashed ' + out
 *         return 'hashed model'
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":843
 * 
 * 
 * cdef str get_conv_descr(int64_t conv):             # <<<<<<<<<<<<<<
 *     cdef str out = get_conv_str(conv)
 *     if conv & CONVCODE_FIXEDMODEL:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.get_conv_descr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":893
 *         h2mm_mod *model
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.model = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return -1;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("__cinit__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model___cinit__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_6H2MM_C_10h2mm_model___cinit__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;

  /* "H2MM_C.pyx":894
 * 
 *     def __cinit__(self, *args, **kwargs):
 *         self.model = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, prior, trans, obs, loglik=-np.inf, niter=0, nphot = 0, is_conv=False):
*/
  __pyx_v_self->model = NULL;

  /* "H2MM_C.pyx":893
 *         h2mm_mod *model
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.model = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "H2MM_C.pyx":896
 *         self.model = NULL
 * 
 *     def __init__(self, prior, trans, obs, loglik=-np.inf, niter=0, nphot = 0, is_conv=False):             # <<<<<<<<<<<<<<
 *         # if statements check to confirm first the correct dimensinality of input matrices, then that their shapes match
 *         cdef int64_t i, j
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_prior = 0;
  PyObject *__pyx_v_trans = 0;
  PyObject *__pyx_v_obs = 0;
  PyObject *__pyx_v_loglik = 0;
  PyObject *__pyx_v_niter = 0;
  PyObject *__pyx_v_nphot = 0;
  PyObject *__pyx_v_is_conv = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_prior,&__pyx_mstate_global->__pyx_n_u_trans,&__pyx_mstate_global->__pyx_n_u_obs,&__pyx_mstate_global->__pyx_n_u_loglik,&__pyx_mstate_global->__pyx_n_u_niter,&__pyx_mstate_global->__pyx_n_u_nphot,&__pyx_mstate_global->__pyx_n_u_is_conv,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 896, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 896, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__19);
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, i); __PYX_ERR(0, 896, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 896, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 896, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 896, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 896, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__19);
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_prior = values[0];
    __pyx_v_trans = values[1];
    __pyx_v_obs = values[2];
    __pyx_v_loglik = values[3];
    __pyx_v_niter = values[4];
    __pyx_v_nphot = values[5];
    __pyx_v_is_conv = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, __pyx_nargs); __PYX_ERR(0, 896, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_2__init__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v_prior, __pyx_v_trans, __pyx_v_obs, __pyx_v_loglik, __pyx_v_niter, __pyx_v_nphot, __pyx_v_is_conv);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6H2MM_C_10h2mm_model_2__init__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_prior, PyObject *__pyx_v_trans, PyObject *__pyx_v_obs, PyObject *__pyx_v_loglik, PyObject *__pyx_v_niter, PyObject *__pyx_v_nphot, PyObject *__pyx_v_is_conv) {
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int64_t __pyx_t_9;
  int64_t __pyx_t_10;
  int64_t __pyx_t_11;
  h2mm_mod *__pyx_t_12;
  double __pyx_t_13;
  int64_t __pyx_t_14;
  int64_t __pyx_t_15;
  int64_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_prior);
  __Pyx_INCREF(__pyx_v_trans);
  __Pyx_INCREF(__pyx_v_obs);
  __Pyx_INCREF(__pyx_v_is_conv);

  /* "H2MM_C.pyx":899
 *         # if statements check to confirm first the correct dimensinality of input matrices, then that their shapes match
 *         cdef int64_t i, j
 *         if prior.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")
 *         if trans.ndim != 2:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":900
 *         cdef int64_t i, j
 *         if prior.ndim != 1:
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")             # <<<<<<<<<<<<<<
 *         if trans.ndim != 2:
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Prior_matrix_must_have_ndim_1_to};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __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, 900, __pyx_L1_error)

    /* "H2MM_C.pyx":899
 *         # if statements check to confirm first the correct dimensinality of input matrices, then that their shapes match
 *         cdef int64_t i, j
 *         if prior.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")
 *         if trans.ndim != 2:
*/
  }

  /* "H2MM_C.pyx":901
 *         if prior.ndim != 1:
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")
 *         if trans.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
 *         if obs.ndim != 2:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":902
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")
 *         if trans.ndim != 2:
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")             # <<<<<<<<<<<<<<
 *         if obs.ndim != 2:
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Trans_matrix_must_have_ndim_2_wr};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __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, 902, __pyx_L1_error)

    /* "H2MM_C.pyx":901
 *         if prior.ndim != 1:
 *             raise ValueError("Prior matrix must have ndim=1, too many dimensions in prior")
 *         if trans.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
 *         if obs.ndim != 2:
*/
  }

  /* "H2MM_C.pyx":903
 *         if trans.ndim != 2:
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
 *         if obs.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":904
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
 *         if obs.ndim != 2:
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")             # <<<<<<<<<<<<<<
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Obs_matrix_must_have_ndim_2_wron};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __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, 904, __pyx_L1_error)

    /* "H2MM_C.pyx":903
 *         if trans.ndim != 2:
 *             raise ValueError("Trans matrix must have ndim=2, wrong dimensionallity of trans matrix")
 *         if obs.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
*/
  }

  /* "H2MM_C.pyx":905
 *         if obs.ndim != 2:
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):             # <<<<<<<<<<<<<<
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
 *         if trans.shape[0] != trans.shape[1]:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (!__pyx_t_2);
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":906
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")             # <<<<<<<<<<<<<<
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
*/
    __pyx_t_5 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Dim_0_of_one_of_the_matrices_doe};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __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, 906, __pyx_L1_error)

    /* "H2MM_C.pyx":905
 *         if obs.ndim != 2:
 *             raise ValueError("Obs matrix must have ndim=2, wrong dimensionallity of obs matrix")
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):             # <<<<<<<<<<<<<<
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
 *         if trans.shape[0] != trans.shape[1]:
*/
  }

  /* "H2MM_C.pyx":907
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
 *         if trans.shape[0] != trans.shape[1]:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
 *         if not np.issubdtype(type(niter), np.integer):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); 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_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":908
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")             # <<<<<<<<<<<<<<
 *         if not np.issubdtype(type(niter), np.integer):
 *             raise TypeError("niter must be integer")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Trans_matrix_is_not_square_and_c};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __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, 908, __pyx_L1_error)

    /* "H2MM_C.pyx":907
 *         if not (prior.shape[0] == trans.shape[0] == obs.shape[0]):
 *             raise ValueError("Dim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single model")
 *         if trans.shape[0] != trans.shape[1]:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
 *         if not np.issubdtype(type(niter), np.integer):
*/
  }

  /* "H2MM_C.pyx":909
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
 *         if not np.issubdtype(type(niter), np.integer):             # <<<<<<<<<<<<<<
 *             raise TypeError("niter must be integer")
 *         if niter < 0:
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_issubdtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_integer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)Py_TYPE(__pyx_v_niter)), __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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 (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (!__pyx_t_8);
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":910
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
 *         if not np.issubdtype(type(niter), np.integer):
 *             raise TypeError("niter must be integer")             # <<<<<<<<<<<<<<
 *         if niter < 0:
 *             raise ValueError("niter must be positive")
*/
    __pyx_t_7 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_niter_must_be_integer};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __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, 910, __pyx_L1_error)

    /* "H2MM_C.pyx":909
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans matrix is not square, and connot be used for a model")
 *         if not np.issubdtype(type(niter), np.integer):             # <<<<<<<<<<<<<<
 *             raise TypeError("niter must be integer")
 *         if niter < 0:
*/
  }

  /* "H2MM_C.pyx":911
 *         if not np.issubdtype(type(niter), np.integer):
 *             raise TypeError("niter must be integer")
 *         if niter < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("niter must be positive")
 *         if nphot< 0:
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_niter, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":912
 *             raise TypeError("niter must be integer")
 *         if niter < 0:
 *             raise ValueError("niter must be positive")             # <<<<<<<<<<<<<<
 *         if nphot< 0:
 *             raise ValueError("nphot must be positive")
*/
    __pyx_t_7 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_niter_must_be_positive};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 912, __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, 912, __pyx_L1_error)

    /* "H2MM_C.pyx":911
 *         if not np.issubdtype(type(niter), np.integer):
 *             raise TypeError("niter must be integer")
 *         if niter < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("niter must be positive")
 *         if nphot< 0:
*/
  }

  /* "H2MM_C.pyx":913
 *         if niter < 0:
 *             raise ValueError("niter must be positive")
 *         if nphot< 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("nphot must be positive")
 *         if not isinstance(is_conv, int):
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_nphot, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":914
 *             raise ValueError("niter must be positive")
 *         if nphot< 0:
 *             raise ValueError("nphot must be positive")             # <<<<<<<<<<<<<<
 *         if not isinstance(is_conv, int):
 *             raise TypeError("is_conv must be boolean or int")
*/
    __pyx_t_7 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_nphot_must_be_positive};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __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, 914, __pyx_L1_error)

    /* "H2MM_C.pyx":913
 *         if niter < 0:
 *             raise ValueError("niter must be positive")
 *         if nphot< 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("nphot must be positive")
 *         if not isinstance(is_conv, int):
*/
  }

  /* "H2MM_C.pyx":915
 *         if nphot< 0:
 *             raise ValueError("nphot must be positive")
 *         if not isinstance(is_conv, int):             # <<<<<<<<<<<<<<
 *             raise TypeError("is_conv must be boolean or int")
 *         elif isinstance(is_conv, bool):
*/
  __pyx_t_2 = PyLong_Check(__pyx_v_is_conv); 
  __pyx_t_8 = (!__pyx_t_2);
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":916
 *             raise ValueError("nphot must be positive")
 *         if not isinstance(is_conv, int):
 *             raise TypeError("is_conv must be boolean or int")             # <<<<<<<<<<<<<<
 *         elif isinstance(is_conv, bool):
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
*/
    __pyx_t_7 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_is_conv_must_be_boolean_or_int};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __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, 916, __pyx_L1_error)

    /* "H2MM_C.pyx":915
 *         if nphot< 0:
 *             raise ValueError("nphot must be positive")
 *         if not isinstance(is_conv, int):             # <<<<<<<<<<<<<<
 *             raise TypeError("is_conv must be boolean or int")
 *         elif isinstance(is_conv, bool):
*/
  }

  /* "H2MM_C.pyx":917
 *         if not isinstance(is_conv, int):
 *             raise TypeError("is_conv must be boolean or int")
 *         elif isinstance(is_conv, bool):             # <<<<<<<<<<<<<<
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
 *         if loglik > 0.0:
*/
  __pyx_t_8 = PyBool_Check(__pyx_v_is_conv); 
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":918
 *             raise TypeError("is_conv must be boolean or int")
 *         elif isinstance(is_conv, bool):
 *             is_conv = CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *         if loglik > 0.0:
 *             raise ValueError("loglik must be negative")
*/
    __pyx_t_1 = __Pyx_PyLong_From_int64_t(CONVCODE_OUTPUT_CONVERGED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_is_conv, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":917
 *         if not isinstance(is_conv, int):
 *             raise TypeError("is_conv must be boolean or int")
 *         elif isinstance(is_conv, bool):             # <<<<<<<<<<<<<<
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
 *         if loglik > 0.0:
*/
  }

  /* "H2MM_C.pyx":919
 *         elif isinstance(is_conv, bool):
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
 *         if loglik > 0.0:             # <<<<<<<<<<<<<<
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_loglik, __pyx_mstate_global->__pyx_float_0_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 919, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":920
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
 *         if loglik > 0.0:
 *             raise ValueError("loglik must be negative")             # <<<<<<<<<<<<<<
 *         elif loglik != -np.inf:
 *             if nphot == 0:
*/
    __pyx_t_7 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_loglik_must_be_negative};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __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, 920, __pyx_L1_error)

    /* "H2MM_C.pyx":919
 *         elif isinstance(is_conv, bool):
 *             is_conv = CONVCODE_OUTPUT_CONVERGED
 *         if loglik > 0.0:             # <<<<<<<<<<<<<<
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:
*/
  }

  /* "H2MM_C.pyx":921
 *         if loglik > 0.0:
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:             # <<<<<<<<<<<<<<
 *             if nphot == 0:
 *                 raise ValueError("Must specify number of photons if loglik is specified")
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Negative(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_v_loglik, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":922
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:
 *             if nphot == 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must specify number of photons if loglik is specified")
 *         else:
*/
    __pyx_t_8 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_nphot, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 922, __pyx_L1_error)
    if (unlikely(__pyx_t_8)) {

      /* "H2MM_C.pyx":923
 *         elif loglik != -np.inf:
 *             if nphot == 0:
 *                 raise ValueError("Must specify number of photons if loglik is specified")             # <<<<<<<<<<<<<<
 *         else:
 *             if is_conv == True:
*/
      __pyx_t_1 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Must_specify_number_of_photons_i};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 923, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 923, __pyx_L1_error)

      /* "H2MM_C.pyx":922
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:
 *             if nphot == 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Must specify number of photons if loglik is specified")
 *         else:
*/
    }

    /* "H2MM_C.pyx":921
 *         if loglik > 0.0:
 *             raise ValueError("loglik must be negative")
 *         elif loglik != -np.inf:             # <<<<<<<<<<<<<<
 *             if nphot == 0:
 *                 raise ValueError("Must specify number of photons if loglik is specified")
*/
    goto __pyx_L12;
  }

  /* "H2MM_C.pyx":925
 *                 raise ValueError("Must specify number of photons if loglik is specified")
 *         else:
 *             if is_conv == True:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Converged Model cannot have -inf loglik")
 *         if np.any(prior < 0.0):
*/
  /*else*/ {
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_is_conv, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 925, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 925, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__pyx_t_8)) {

      /* "H2MM_C.pyx":926
 *         else:
 *             if is_conv == True:
 *                 raise ValueError("Converged Model cannot have -inf loglik")             # <<<<<<<<<<<<<<
 *         if np.any(prior < 0.0):
 *             raise ValueError("prior array can have no negative values")
*/
      __pyx_t_1 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_Converged_Model_cannot_have_inf};
        __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 926, __pyx_L1_error)

      /* "H2MM_C.pyx":925
 *                 raise ValueError("Must specify number of photons if loglik is specified")
 *         else:
 *             if is_conv == True:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Converged Model cannot have -inf loglik")
 *         if np.any(prior < 0.0):
*/
    }
  }
  __pyx_L12:;

  /* "H2MM_C.pyx":927
 *             if is_conv == True:
 *                 raise ValueError("Converged Model cannot have -inf loglik")
 *         if np.any(prior < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("prior array can have no negative values")
 *         if np.any(trans < 0.0):
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_prior, __pyx_mstate_global->__pyx_float_0_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_6};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":928
 *                 raise ValueError("Converged Model cannot have -inf loglik")
 *         if np.any(prior < 0.0):
 *             raise ValueError("prior array can have no negative values")             # <<<<<<<<<<<<<<
 *         if np.any(trans < 0.0):
 *             raise ValueError("trans array can have no negative values")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_prior_array_can_have_no_negative};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 928, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 928, __pyx_L1_error)

    /* "H2MM_C.pyx":927
 *             if is_conv == True:
 *                 raise ValueError("Converged Model cannot have -inf loglik")
 *         if np.any(prior < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("prior array can have no negative values")
 *         if np.any(trans < 0.0):
*/
  }

  /* "H2MM_C.pyx":929
 *         if np.any(prior < 0.0):
 *             raise ValueError("prior array can have no negative values")
 *         if np.any(trans < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("trans array can have no negative values")
 *         if np.any(obs < 0.0):
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_trans, __pyx_mstate_global->__pyx_float_0_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 929, __pyx_L1_error)
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":930
 *             raise ValueError("prior array can have no negative values")
 *         if np.any(trans < 0.0):
 *             raise ValueError("trans array can have no negative values")             # <<<<<<<<<<<<<<
 *         if np.any(obs < 0.0):
 *             raise ValueError("obs array can have no negative values")
*/
    __pyx_t_1 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_trans_array_can_have_no_negative};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 930, __pyx_L1_error)

    /* "H2MM_C.pyx":929
 *         if np.any(prior < 0.0):
 *             raise ValueError("prior array can have no negative values")
 *         if np.any(trans < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("trans array can have no negative values")
 *         if np.any(obs < 0.0):
*/
  }

  /* "H2MM_C.pyx":931
 *         if np.any(trans < 0.0):
 *             raise ValueError("trans array can have no negative values")
 *         if np.any(obs < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("obs array can have no negative values")
 *         # coerce the matricies into c type double
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_obs, __pyx_mstate_global->__pyx_float_0_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 931, __pyx_L1_error)
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_6};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":932
 *             raise ValueError("trans array can have no negative values")
 *         if np.any(obs < 0.0):
 *             raise ValueError("obs array can have no negative values")             # <<<<<<<<<<<<<<
 *         # coerce the matricies into c type double
 *         prior = prior.astype('double')
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_obs_array_can_have_no_negative_v};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 932, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 932, __pyx_L1_error)

    /* "H2MM_C.pyx":931
 *         if np.any(trans < 0.0):
 *             raise ValueError("trans array can have no negative values")
 *         if np.any(obs < 0.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("obs array can have no negative values")
 *         # coerce the matricies into c type double
*/
  }

  /* "H2MM_C.pyx":934
 *             raise ValueError("obs array can have no negative values")
 *         # coerce the matricies into c type double
 *         prior = prior.astype('double')             # <<<<<<<<<<<<<<
 *         trans = trans.astype('double')
 *         obs = obs.astype('double')
*/
  __pyx_t_3 = __pyx_v_prior;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __Pyx_DECREF_SET(__pyx_v_prior, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":935
 *         # coerce the matricies into c type double
 *         prior = prior.astype('double')
 *         trans = trans.astype('double')             # <<<<<<<<<<<<<<
 *         obs = obs.astype('double')
 *         # allocate and copy information over to h2mm_mod pointer
*/
  __pyx_t_3 = __pyx_v_trans;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __Pyx_DECREF_SET(__pyx_v_trans, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":936
 *         prior = prior.astype('double')
 *         trans = trans.astype('double')
 *         obs = obs.astype('double')             # <<<<<<<<<<<<<<
 *         # allocate and copy information over to h2mm_mod pointer
 *         self.model = Py_allocate_models(1, obs.shape[0], obs.shape[1], <int64_t> nphot)
*/
  __pyx_t_3 = __pyx_v_obs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":938
 *         obs = obs.astype('double')
 *         # allocate and copy information over to h2mm_mod pointer
 *         self.model = Py_allocate_models(1, obs.shape[0], obs.shape[1], <int64_t> nphot)             # <<<<<<<<<<<<<<
 *         if loglik == -np.inf:
 *             self.model.conv = 0
*/
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_t_3); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyLong_As_int64_t(__pyx_t_7); if (unlikely((__pyx_t_10 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyLong_As_int64_t(__pyx_v_nphot); if (unlikely((__pyx_t_11 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error)
  __pyx_t_12 = __pyx_f_6H2MM_C_Py_allocate_models(1, __pyx_t_9, __pyx_t_10, ((int64_t)__pyx_t_11)); if (unlikely(__pyx_t_12 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error)
  __pyx_v_self->model = __pyx_t_12;

  /* "H2MM_C.pyx":939
 *         # allocate and copy information over to h2mm_mod pointer
 *         self.model = Py_allocate_models(1, obs.shape[0], obs.shape[1], <int64_t> nphot)
 *         if loglik == -np.inf:             # <<<<<<<<<<<<<<
 *             self.model.conv = 0
 *             self.model.loglik = <double> loglik
*/
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_loglik, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":940
 *         self.model = Py_allocate_models(1, obs.shape[0], obs.shape[1], <int64_t> nphot)
 *         if loglik == -np.inf:
 *             self.model.conv = 0             # <<<<<<<<<<<<<<
 *             self.model.loglik = <double> loglik
 *         else:
*/
    __pyx_v_self->model->conv = 0;

    /* "H2MM_C.pyx":941
 *         if loglik == -np.inf:
 *             self.model.conv = 0
 *             self.model.loglik = <double> loglik             # <<<<<<<<<<<<<<
 *         else:
 *             self.model.conv = is_conv
*/
    __pyx_t_13 = __Pyx_PyFloat_AsDouble(__pyx_v_loglik); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 941, __pyx_L1_error)
    __pyx_v_self->model->loglik = ((double)__pyx_t_13);

    /* "H2MM_C.pyx":939
 *         # allocate and copy information over to h2mm_mod pointer
 *         self.model = Py_allocate_models(1, obs.shape[0], obs.shape[1], <int64_t> nphot)
 *         if loglik == -np.inf:             # <<<<<<<<<<<<<<
 *             self.model.conv = 0
 *             self.model.loglik = <double> loglik
*/
    goto __pyx_L18;
  }

  /* "H2MM_C.pyx":943
 *             self.model.loglik = <double> loglik
 *         else:
 *             self.model.conv = is_conv             # <<<<<<<<<<<<<<
 *             self.model.loglik = <double> loglik
 *         # allocate and copy array values
*/
  /*else*/ {
    __pyx_t_11 = __Pyx_PyLong_As_int64_t(__pyx_v_is_conv); if (unlikely((__pyx_t_11 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L1_error)
    __pyx_v_self->model->conv = __pyx_t_11;

    /* "H2MM_C.pyx":944
 *         else:
 *             self.model.conv = is_conv
 *             self.model.loglik = <double> loglik             # <<<<<<<<<<<<<<
 *         # allocate and copy array values
 *         for i in range(self.model.nstate):
*/
    __pyx_t_13 = __Pyx_PyFloat_AsDouble(__pyx_v_loglik); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L1_error)
    __pyx_v_self->model->loglik = ((double)__pyx_t_13);
  }
  __pyx_L18:;

  /* "H2MM_C.pyx":946
 *             self.model.loglik = <double> loglik
 *         # allocate and copy array values
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
*/
  __pyx_t_11 = __pyx_v_self->model->nstate;
  __pyx_t_10 = __pyx_t_11;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "H2MM_C.pyx":947
 *         # allocate and copy array values
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         for i in range(self.model.nstate):
*/
    __pyx_t_14 = __pyx_v_self->model->nstate;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_j = __pyx_t_16;

      /* "H2MM_C.pyx":948
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]
*/
      __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyLong_From_int64_t(__pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 948, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 948, __pyx_L1_error);
      __pyx_t_3 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_trans, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_13 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      (__pyx_v_self->model->trans[((__pyx_v_self->model->nstate * __pyx_v_i) + __pyx_v_j)]) = __pyx_t_13;
    }
  }

  /* "H2MM_C.pyx":949
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             self.model.prior[i] = prior[i]
 *         for i in range(self.model.ndet):
*/
  __pyx_t_11 = __pyx_v_self->model->nstate;
  __pyx_t_10 = __pyx_t_11;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "H2MM_C.pyx":950
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]             # <<<<<<<<<<<<<<
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):
*/
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_prior, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    (__pyx_v_self->model->prior[__pyx_v_i]) = __pyx_t_13;
  }

  /* "H2MM_C.pyx":951
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]
 *         for i in range(self.model.ndet):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
*/
  __pyx_t_11 = __pyx_v_self->model->ndet;
  __pyx_t_10 = __pyx_t_11;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "H2MM_C.pyx":952
 *             self.model.prior[i] = prior[i]
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
 *         self.normalize()
*/
    __pyx_t_14 = __pyx_v_self->model->nstate;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_j = __pyx_t_16;

      /* "H2MM_C.pyx":953
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]             # <<<<<<<<<<<<<<
 *         self.normalize()
 * 
*/
      __pyx_t_7 = __Pyx_PyLong_From_int64_t(__pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_obs, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_13 = __Pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 953, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      (__pyx_v_self->model->obs[((__pyx_v_self->model->nstate * __pyx_v_i) + __pyx_v_j)]) = __pyx_t_13;
    }
  }

  /* "H2MM_C.pyx":954
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
 *         self.normalize()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H2MM_C.pyx":896
 *         self.model = NULL
 * 
 *     def __init__(self, prior, trans, obs, loglik=-np.inf, niter=0, nphot = 0, is_conv=False):             # <<<<<<<<<<<<<<
 *         # if statements check to confirm first the correct dimensinality of input matrices, then that their shapes match
 *         cdef int64_t i, j
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_trans);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF(__pyx_v_is_conv);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":956
 *         self.normalize()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.model is not NULL:
 *             Py_free_models(1, self.model)
*/

/* Python wrapper */
static void __pyx_pw_6H2MM_C_10h2mm_model_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6H2MM_C_10h2mm_model_5__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6H2MM_C_10h2mm_model_4__dealloc__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static void __pyx_pf_6H2MM_C_10h2mm_model_4__dealloc__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":957
 * 
 *     def __dealloc__(self):
 *         if self.model is not NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(1, self.model)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->model != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":958
 *     def __dealloc__(self):
 *         if self.model is not NULL:
 *             Py_free_models(1, self.model)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
    __pyx_t_2 = __pyx_f_6H2MM_C_Py_free_models(1, __pyx_v_self->model); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error)

    /* "H2MM_C.pyx":957
 * 
 *     def __dealloc__(self):
 *         if self.model is not NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(1, self.model)
 * 
*/
  }

  /* "H2MM_C.pyx":956
 *         self.normalize()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.model is not NULL:
 *             Py_free_models(1, self.model)
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("H2MM_C.h2mm_model.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
}

/* "H2MM_C.pyx":960
 *             Py_free_models(1, self.model)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef h2mm_model from_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/

static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_10h2mm_model_from_ptr(h2mm_mod *__pyx_v_model) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_new = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_ptr", 0);

  /* "H2MM_C.pyx":962
 *     @staticmethod
 *     cdef h2mm_model from_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)             # <<<<<<<<<<<<<<
 *         new.model = model
 *         return new
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6H2MM_C_h2mm_model(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 962, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_new = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":963
 *     cdef h2mm_model from_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = model             # <<<<<<<<<<<<<<
 *         return new
 * 
*/
  __pyx_v_new->model = __pyx_v_model;

  /* "H2MM_C.pyx":964
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = model
 *         return new             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_new);
  __pyx_r = __pyx_v_new;
  goto __pyx_L0;

  /* "H2MM_C.pyx":960
 *             Py_free_models(1, self.model)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef h2mm_model from_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":966
 *         return new
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef h2mm_model move_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/

static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_10h2mm_model_move_ptr(h2mm_mod *__pyx_v_model) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_new = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("move_ptr", 0);

  /* "H2MM_C.pyx":968
 *     @staticmethod
 *     cdef h2mm_model move_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)             # <<<<<<<<<<<<<<
 *         new.model = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         new.model.prior = NULL
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6H2MM_C_h2mm_model(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_new = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":969
 *     cdef h2mm_model move_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))             # <<<<<<<<<<<<<<
 *         new.model.prior = NULL
 *         new.model.trans = NULL
*/
  __pyx_v_new->model = ((h2mm_mod *)PyMem_Malloc((sizeof(h2mm_mod))));

  /* "H2MM_C.pyx":970
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         new.model.prior = NULL             # <<<<<<<<<<<<<<
 *         new.model.trans = NULL
 *         new.model.obs = NULL
*/
  __pyx_v_new->model->prior = NULL;

  /* "H2MM_C.pyx":971
 *         new.model = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         new.model.prior = NULL
 *         new.model.trans = NULL             # <<<<<<<<<<<<<<
 *         new.model.obs = NULL
 *         move_model_ptrs(model, new.model)
*/
  __pyx_v_new->model->trans = NULL;

  /* "H2MM_C.pyx":972
 *         new.model.prior = NULL
 *         new.model.trans = NULL
 *         new.model.obs = NULL             # <<<<<<<<<<<<<<
 *         move_model_ptrs(model, new.model)
 *         return new
*/
  __pyx_v_new->model->obs = NULL;

  /* "H2MM_C.pyx":973
 *         new.model.trans = NULL
 *         new.model.obs = NULL
 *         move_model_ptrs(model, new.model)             # <<<<<<<<<<<<<<
 *         return new
 * 
*/
  (void)(move_model_ptrs(__pyx_v_model, __pyx_v_new->model));

  /* "H2MM_C.pyx":974
 *         new.model.obs = NULL
 *         move_model_ptrs(model, new.model)
 *         return new             # <<<<<<<<<<<<<<
 * 
 *     def tobytes(self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_new);
  __pyx_r = __pyx_v_new;
  goto __pyx_L0;

  /* "H2MM_C.pyx":966
 *         return new
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     cdef h2mm_model move_ptr(h2mm_mod *model):
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.move_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":976
 *         return new
 * 
 *     def tobytes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Serialize :class:`h2mm_model` into bytes, which can be read back into
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7tobytes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_6tobytes, "\n        Serialize :class:`h2mm_model` into bytes, which can be read back into\n        :class:`h2mm_model` with :meth:`h2mm_model.frombytes`.\n        \n        Returns\n        -------\n        bytes\n            Serialized bytes represenation of :class:`h2mm_model`. Includes\n            all information contained within model.\n            \n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_7tobytes = {"tobytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_7tobytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_6tobytes};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7tobytes(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tobytes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("tobytes", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("tobytes", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_6tobytes(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6tobytes(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  arrayobject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tobytes", 0);

  /* "H2MM_C.pyx":988
 * 
 *         """
 *         cdef array.array arr = array.array('b', [])             # <<<<<<<<<<<<<<
 *         array.resize(arr, 5*sizeof(int64_t)+(self.model.nstate*(1+self.model.nstate+self.model.ndet)+1)*sizeof(double))
 *         memcpy(arr.data.as_chars, <char*>&self.model.nstate, sizeof(int64_t))
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_b, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7cpython_5array_array, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 988, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_arr = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":989
 *         """
 *         cdef array.array arr = array.array('b', [])
 *         array.resize(arr, 5*sizeof(int64_t)+(self.model.nstate*(1+self.model.nstate+self.model.ndet)+1)*sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars, <char*>&self.model.nstate, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t), <char*>&self.model.ndet, sizeof(int64_t))
*/
  __pyx_t_5 = resize(__pyx_v_arr, ((5 * (sizeof(int64_t))) + (((__pyx_v_self->model->nstate * ((1 + __pyx_v_self->model->nstate) + __pyx_v_self->model->ndet)) + 1) * (sizeof(double))))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 989, __pyx_L1_error)

  /* "H2MM_C.pyx":990
 *         cdef array.array arr = array.array('b', [])
 *         array.resize(arr, 5*sizeof(int64_t)+(self.model.nstate*(1+self.model.nstate+self.model.ndet)+1)*sizeof(double))
 *         memcpy(arr.data.as_chars, <char*>&self.model.nstate, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t), <char*>&self.model.ndet, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*2, <char*>&self.model.nphot, sizeof(int64_t))
*/
  (void)(memcpy(__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars, ((char *)(&__pyx_v_self->model->nstate)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":991
 *         array.resize(arr, 5*sizeof(int64_t)+(self.model.nstate*(1+self.model.nstate+self.model.ndet)+1)*sizeof(double))
 *         memcpy(arr.data.as_chars, <char*>&self.model.nstate, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t), <char*>&self.model.ndet, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*2, <char*>&self.model.nphot, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*3, <char*>&self.model.niter, sizeof(int64_t))
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + (sizeof(int64_t))), ((char *)(&__pyx_v_self->model->ndet)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":992
 *         memcpy(arr.data.as_chars, <char*>&self.model.nstate, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t), <char*>&self.model.ndet, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*2, <char*>&self.model.nphot, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*3, <char*>&self.model.niter, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*4, <char*>&self.model.conv, sizeof(int64_t))
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 2)), ((char *)(&__pyx_v_self->model->nphot)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":993
 *         memcpy(arr.data.as_chars+sizeof(int64_t), <char*>&self.model.ndet, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*2, <char*>&self.model.nphot, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*3, <char*>&self.model.niter, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*4, <char*>&self.model.conv, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5, <char*>&self.model.loglik, sizeof(double))
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 3)), ((char *)(&__pyx_v_self->model->niter)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":994
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*2, <char*>&self.model.nphot, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*3, <char*>&self.model.niter, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*4, <char*>&self.model.conv, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5, <char*>&self.model.loglik, sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double), <char*>self.model.prior, self.model.nstate*sizeof(double))
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 4)), ((char *)(&__pyx_v_self->model->conv)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":995
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*3, <char*>&self.model.niter, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*4, <char*>&self.model.conv, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5, <char*>&self.model.loglik, sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double), <char*>self.model.prior, self.model.nstate*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*sizeof(double), <char*>self.model.trans, (self.model.nstate**2)*sizeof(double))
*/
  (void)(memcpy((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 5)), ((char *)(&__pyx_v_self->model->loglik)), (sizeof(double))));

  /* "H2MM_C.pyx":996
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*4, <char*>&self.model.conv, sizeof(int64_t))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5, <char*>&self.model.loglik, sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double), <char*>self.model.prior, self.model.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*sizeof(double), <char*>self.model.trans, (self.model.nstate**2)*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*(self.model.nstate+1)*sizeof(double), <char*>self.model.obs, self.model.ndet*self.model.nstate*sizeof(double))
*/
  (void)(memcpy(((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 5)) + (sizeof(double))), ((char *)__pyx_v_self->model->prior), (__pyx_v_self->model->nstate * (sizeof(double)))));

  /* "H2MM_C.pyx":997
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5, <char*>&self.model.loglik, sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double), <char*>self.model.prior, self.model.nstate*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*sizeof(double), <char*>self.model.trans, (self.model.nstate**2)*sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*(self.model.nstate+1)*sizeof(double), <char*>self.model.obs, self.model.ndet*self.model.nstate*sizeof(double))
 *         return arr.tobytes()
*/
  (void)(memcpy((((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 5)) + (sizeof(double))) + (__pyx_v_self->model->nstate * (sizeof(double)))), ((char *)__pyx_v_self->model->trans), (__Pyx_pow_int64_t(__pyx_v_self->model->nstate, 2) * (sizeof(double)))));

  /* "H2MM_C.pyx":998
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double), <char*>self.model.prior, self.model.nstate*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*sizeof(double), <char*>self.model.trans, (self.model.nstate**2)*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*(self.model.nstate+1)*sizeof(double), <char*>self.model.obs, self.model.ndet*self.model.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         return arr.tobytes()
 * 
*/
  (void)(memcpy((((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_arr).as_chars + ((sizeof(int64_t)) * 5)) + (sizeof(double))) + ((__pyx_v_self->model->nstate * (__pyx_v_self->model->nstate + 1)) * (sizeof(double)))), ((char *)__pyx_v_self->model->obs), ((__pyx_v_self->model->ndet * __pyx_v_self->model->nstate) * (sizeof(double)))));

  /* "H2MM_C.pyx":999
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*sizeof(double), <char*>self.model.trans, (self.model.nstate**2)*sizeof(double))
 *         memcpy(arr.data.as_chars+sizeof(int64_t)*5+sizeof(double)+self.model.nstate*(self.model.nstate+1)*sizeof(double), <char*>self.model.obs, self.model.ndet*self.model.nstate*sizeof(double))
 *         return arr.tobytes()             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_arr);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_tobytes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 999, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":976
 *         return new
 * 
 *     def tobytes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Serialize :class:`h2mm_model` into bytes, which can be read back into
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.tobytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1001
 *         return arr.tobytes()
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def frombytes(cls, buffer):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_9frombytes(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_8frombytes, "\n        Create :class:`h2mm_model` from a bytes object generated by\n        :meth:`h2mm_model.toobytes`.\n        \n\n        Parameters\n        ----------\n        buffer : bytes\n            Bytes representation of :class:`h2mm_model` object. Should have\n            originated from :meth:`h2mm_model.tobytes`.\n\n        Raises\n        ------\n        ValueError\n            Invalid bytes represenation of :class:`h2mm_model`, data either was\n            never a :class:`h2mm_model` or was corrupted.\n\n        Returns\n        -------\n        h2mm_model\n            Data converted to :class:`h2mm_model`\n\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_9frombytes = {"frombytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_9frombytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_8frombytes};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_9frombytes(PyObject *__pyx_v_cls, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_buffer = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frombytes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_buffer,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1001, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "frombytes", 0) < (0)) __PYX_ERR(0, 1001, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("frombytes", 1, 1, 1, i); __PYX_ERR(0, 1001, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
    }
    __pyx_v_buffer = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("frombytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1001, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.frombytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_8frombytes(((PyTypeObject*)__pyx_v_cls), __pyx_v_buffer);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8frombytes(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_buffer) {
  arrayobject *__pyx_v_buf = 0;
  Py_ssize_t __pyx_v_ln;
  int64_t __pyx_v_nstate;
  int64_t __pyx_v_ndet;
  int64_t __pyx_v_nphot;
  Py_ssize_t __pyx_v_eln;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_new = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __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[8];
  PyObject *__pyx_t_11 = NULL;
  h2mm_mod *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frombytes", 0);

  /* "H2MM_C.pyx":1026
 * 
 *         """
 *         cdef array.array buf = array.array('b', buffer)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t ln = len(buf)
 *         if ln < (sizeof(int64_t)*5 + sizeof(double)):
*/
  __pyx_t_2 = NULL;
  __pyx_t_3 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_b, __pyx_v_buffer};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7cpython_5array_array, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_buf = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1027
 *         """
 *         cdef array.array buf = array.array('b', buffer)
 *         cdef Py_ssize_t ln = len(buf)             # <<<<<<<<<<<<<<
 *         if ln < (sizeof(int64_t)*5 + sizeof(double)):
 *             raise ValueError("bytes too small to read as h2mm_model")
*/
  __pyx_t_4 = Py_SIZE(((PyObject *)__pyx_v_buf)); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1027, __pyx_L1_error)
  __pyx_v_ln = __pyx_t_4;

  /* "H2MM_C.pyx":1028
 *         cdef array.array buf = array.array('b', buffer)
 *         cdef Py_ssize_t ln = len(buf)
 *         if ln < (sizeof(int64_t)*5 + sizeof(double)):             # <<<<<<<<<<<<<<
 *             raise ValueError("bytes too small to read as h2mm_model")
 *         cdef int64_t nstate
*/
  __pyx_t_5 = (__pyx_v_ln < (((sizeof(int64_t)) * 5) + (sizeof(double))));
  if (unlikely(__pyx_t_5)) {

    /* "H2MM_C.pyx":1029
 *         cdef Py_ssize_t ln = len(buf)
 *         if ln < (sizeof(int64_t)*5 + sizeof(double)):
 *             raise ValueError("bytes too small to read as h2mm_model")             # <<<<<<<<<<<<<<
 *         cdef int64_t nstate
 *         cdef int64_t ndet
*/
    __pyx_t_2 = NULL;
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_bytes_too_small_to_read_as_h2mm};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __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, 1029, __pyx_L1_error)

    /* "H2MM_C.pyx":1028
 *         cdef array.array buf = array.array('b', buffer)
 *         cdef Py_ssize_t ln = len(buf)
 *         if ln < (sizeof(int64_t)*5 + sizeof(double)):             # <<<<<<<<<<<<<<
 *             raise ValueError("bytes too small to read as h2mm_model")
 *         cdef int64_t nstate
*/
  }

  /* "H2MM_C.pyx":1033
 *         cdef int64_t ndet
 *         cdef int64_t nphot
 *         memcpy(&nstate, buf.data.as_chars, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(&ndet, buf.data.as_chars+sizeof(int64_t), sizeof(int64_t))
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))
*/
  (void)(memcpy((&__pyx_v_nstate), __pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars, (sizeof(int64_t))));

  /* "H2MM_C.pyx":1034
 *         cdef int64_t nphot
 *         memcpy(&nstate, buf.data.as_chars, sizeof(int64_t))
 *         memcpy(&ndet, buf.data.as_chars+sizeof(int64_t), sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)
*/
  (void)(memcpy((&__pyx_v_ndet), (__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + (sizeof(int64_t))), (sizeof(int64_t))));

  /* "H2MM_C.pyx":1035
 *         memcpy(&nstate, buf.data.as_chars, sizeof(int64_t))
 *         memcpy(&ndet, buf.data.as_chars+sizeof(int64_t), sizeof(int64_t))
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)
 *         if eln != ln:
*/
  (void)(memcpy((&__pyx_v_nphot), (__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 2)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":1036
 *         memcpy(&ndet, buf.data.as_chars+sizeof(int64_t), sizeof(int64_t))
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)             # <<<<<<<<<<<<<<
 *         if eln != ln:
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")
*/
  __pyx_v_eln = (((5 * (sizeof(int64_t))) + (sizeof(double))) + ((((1 + __pyx_v_nstate) + __pyx_v_ndet) * __pyx_v_nstate) * (sizeof(double))));

  /* "H2MM_C.pyx":1037
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)
 *         if eln != ln:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/
  __pyx_t_5 = (__pyx_v_eln != __pyx_v_ln);
  if (unlikely(__pyx_t_5)) {

    /* "H2MM_C.pyx":1038
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)
 *         if eln != ln:
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")             # <<<<<<<<<<<<<<
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = Py_allocate_models(1, nstate, ndet, nphot)
*/
    __pyx_t_2 = NULL;
    __pyx_t_6 = __Pyx_PyUnicode_From_int64_t(__pyx_v_nstate, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_ndet, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_eln, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_ln, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_mallformed_h2mm_model_bytes_arra;
    __pyx_t_10[1] = __pyx_t_6;
    __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_states_and;
    __pyx_t_10[3] = __pyx_t_7;
    __pyx_t_10[4] = __pyx_mstate_global->__pyx_kp_u_dets_meaning_buffer_size_should;
    __pyx_t_10[5] = __pyx_t_8;
    __pyx_t_10[6] = __pyx_mstate_global->__pyx_kp_u_but_buffer_has_size;
    __pyx_t_10[7] = __pyx_t_9;
    __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_10, 8, 45 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 12 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9), 127);
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __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;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_11};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __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, 1038, __pyx_L1_error)

    /* "H2MM_C.pyx":1037
 *         memcpy(&nphot, buf.data.as_chars+sizeof(int64_t)*2, sizeof(int64_t))
 *         cdef Py_ssize_t eln = 5*sizeof(int64_t)+sizeof(double)+(1+nstate+ndet)*nstate*sizeof(double)
 *         if eln != ln:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
*/
  }

  /* "H2MM_C.pyx":1039
 *         if eln != ln:
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)             # <<<<<<<<<<<<<<
 *         new.model = Py_allocate_models(1, nstate, ndet, nphot)
 *         memcpy(<void*>&new.model.niter, buf.data.as_chars+sizeof(int64_t)*3, sizeof(int64_t))
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6H2MM_C_h2mm_model(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_new = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1040
 *             raise ValueError(f"mallformed h2mm_model bytes array, specified {nstate} states and {ndet} dets, meaning buffer size should be {eln}, but buffer has size {ln}")
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = Py_allocate_models(1, nstate, ndet, nphot)             # <<<<<<<<<<<<<<
 *         memcpy(<void*>&new.model.niter, buf.data.as_chars+sizeof(int64_t)*3, sizeof(int64_t))
 *         memcpy(<void*>&new.model.conv, buf.data.as_chars+sizeof(int64_t)*4, sizeof(int64_t))
*/
  __pyx_t_12 = __pyx_f_6H2MM_C_Py_allocate_models(1, __pyx_v_nstate, __pyx_v_ndet, __pyx_v_nphot); if (unlikely(__pyx_t_12 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error)
  __pyx_v_new->model = __pyx_t_12;

  /* "H2MM_C.pyx":1041
 *         cdef h2mm_model new = h2mm_model.__new__(h2mm_model)
 *         new.model = Py_allocate_models(1, nstate, ndet, nphot)
 *         memcpy(<void*>&new.model.niter, buf.data.as_chars+sizeof(int64_t)*3, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(<void*>&new.model.conv, buf.data.as_chars+sizeof(int64_t)*4, sizeof(int64_t))
 *         memcpy(<void*>&new.model.loglik, buf.data.as_chars+sizeof(int64_t)*5, sizeof(double))
*/
  (void)(memcpy(((void *)(&__pyx_v_new->model->niter)), (__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 3)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":1042
 *         new.model = Py_allocate_models(1, nstate, ndet, nphot)
 *         memcpy(<void*>&new.model.niter, buf.data.as_chars+sizeof(int64_t)*3, sizeof(int64_t))
 *         memcpy(<void*>&new.model.conv, buf.data.as_chars+sizeof(int64_t)*4, sizeof(int64_t))             # <<<<<<<<<<<<<<
 *         memcpy(<void*>&new.model.loglik, buf.data.as_chars+sizeof(int64_t)*5, sizeof(double))
 *         memcpy(<void*>new.model.prior, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double), new.model.nstate*sizeof(double))
*/
  (void)(memcpy(((void *)(&__pyx_v_new->model->conv)), (__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 4)), (sizeof(int64_t))));

  /* "H2MM_C.pyx":1043
 *         memcpy(<void*>&new.model.niter, buf.data.as_chars+sizeof(int64_t)*3, sizeof(int64_t))
 *         memcpy(<void*>&new.model.conv, buf.data.as_chars+sizeof(int64_t)*4, sizeof(int64_t))
 *         memcpy(<void*>&new.model.loglik, buf.data.as_chars+sizeof(int64_t)*5, sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(<void*>new.model.prior, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double), new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.trans, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double)+sizeof(double)*new.model.nstate, new.model.nstate*new.model.nstate*sizeof(double))
*/
  (void)(memcpy(((void *)(&__pyx_v_new->model->loglik)), (__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 5)), (sizeof(double))));

  /* "H2MM_C.pyx":1044
 *         memcpy(<void*>&new.model.conv, buf.data.as_chars+sizeof(int64_t)*4, sizeof(int64_t))
 *         memcpy(<void*>&new.model.loglik, buf.data.as_chars+sizeof(int64_t)*5, sizeof(double))
 *         memcpy(<void*>new.model.prior, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double), new.model.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(<void*>new.model.trans, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double)+sizeof(double)*new.model.nstate, new.model.nstate*new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.obs, buf.data.as_chars+5*sizeof(int64_t)+sizeof(double)+(1+new.model.nstate)*new.model.nstate*sizeof(double), new.model.nstate*new.model.ndet*sizeof(double))
*/
  (void)(memcpy(((void *)__pyx_v_new->model->prior), ((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 5)) + (sizeof(double))), (__pyx_v_new->model->nstate * (sizeof(double)))));

  /* "H2MM_C.pyx":1045
 *         memcpy(<void*>&new.model.loglik, buf.data.as_chars+sizeof(int64_t)*5, sizeof(double))
 *         memcpy(<void*>new.model.prior, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double), new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.trans, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double)+sizeof(double)*new.model.nstate, new.model.nstate*new.model.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         memcpy(<void*>new.model.obs, buf.data.as_chars+5*sizeof(int64_t)+sizeof(double)+(1+new.model.nstate)*new.model.nstate*sizeof(double), new.model.nstate*new.model.ndet*sizeof(double))
 *         return new
*/
  (void)(memcpy(((void *)__pyx_v_new->model->trans), (((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + ((sizeof(int64_t)) * 5)) + (sizeof(double))) + ((sizeof(double)) * __pyx_v_new->model->nstate)), ((__pyx_v_new->model->nstate * __pyx_v_new->model->nstate) * (sizeof(double)))));

  /* "H2MM_C.pyx":1046
 *         memcpy(<void*>new.model.prior, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double), new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.trans, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double)+sizeof(double)*new.model.nstate, new.model.nstate*new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.obs, buf.data.as_chars+5*sizeof(int64_t)+sizeof(double)+(1+new.model.nstate)*new.model.nstate*sizeof(double), new.model.nstate*new.model.ndet*sizeof(double))             # <<<<<<<<<<<<<<
 *         return new
 * 
*/
  (void)(memcpy(((void *)__pyx_v_new->model->obs), (((__pyx_f_7cpython_5array_5array_4data_data(__pyx_v_buf).as_chars + (5 * (sizeof(int64_t)))) + (sizeof(double))) + (((1 + __pyx_v_new->model->nstate) * __pyx_v_new->model->nstate) * (sizeof(double)))), ((__pyx_v_new->model->nstate * __pyx_v_new->model->ndet) * (sizeof(double)))));

  /* "H2MM_C.pyx":1047
 *         memcpy(<void*>new.model.trans, buf.data.as_chars+sizeof(int64_t)*5+sizeof(double)+sizeof(double)*new.model.nstate, new.model.nstate*new.model.nstate*sizeof(double))
 *         memcpy(<void*>new.model.obs, buf.data.as_chars+5*sizeof(int64_t)+sizeof(double)+(1+new.model.nstate)*new.model.nstate*sizeof(double), new.model.nstate*new.model.ndet*sizeof(double))
 *         return new             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_new);
  __pyx_r = ((PyObject *)__pyx_v_new);
  goto __pyx_L0;

  /* "H2MM_C.pyx":1001
 *         return arr.tobytes()
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def frombytes(cls, buffer):
 *         """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.frombytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF((PyObject *)__pyx_v_new);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1049
 *         return new
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         cdef int64_t i, j
 *         msg = f"nstate: {self.model.nstate}, ndet: {self.model.ndet}, nphot: {self.model.nphot}, niter: {self.model.niter}, loglik: {self.model.loglik} converged state: {hex(self.model.conv)}\n"
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_11__repr__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_10__repr__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_10__repr__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  PyObject *__pyx_v_msg = 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[13];
  int64_t __pyx_t_9;
  int64_t __pyx_t_10;
  int64_t __pyx_t_11;
  int __pyx_t_12;
  int64_t __pyx_t_13;
  int64_t __pyx_t_14;
  int64_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "H2MM_C.pyx":1051
 *     def __repr__(self):
 *         cdef int64_t i, j
 *         msg = f"nstate: {self.model.nstate}, ndet: {self.model.ndet}, nphot: {self.model.nphot}, niter: {self.model.niter}, loglik: {self.model.loglik} converged state: {hex(self.model.conv)}\n"             # <<<<<<<<<<<<<<
 *         msg += "prior:\n"
 *         for i in range(self.model.nstate):
*/
  __pyx_t_1 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->nstate, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->ndet, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->nphot, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->niter, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->conv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyNumber_Hex(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_nstate_2;
  __pyx_t_8[1] = __pyx_t_1;
  __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_ndet;
  __pyx_t_8[3] = __pyx_t_2;
  __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_nphot_2;
  __pyx_t_8[5] = __pyx_t_3;
  __pyx_t_8[6] = __pyx_mstate_global->__pyx_kp_u_niter_2;
  __pyx_t_8[7] = __pyx_t_4;
  __pyx_t_8[8] = __pyx_mstate_global->__pyx_kp_u_loglik_2;
  __pyx_t_8[9] = __pyx_t_6;
  __pyx_t_8[10] = __pyx_mstate_global->__pyx_kp_u_converged_state;
  __pyx_t_8[11] = __pyx_t_5;
  __pyx_t_8[12] = __pyx_mstate_global->__pyx_kp_u__12;
  __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_8, 13, 8 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 9 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1051, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_msg = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":1052
 *         cdef int64_t i, j
 *         msg = f"nstate: {self.model.nstate}, ndet: {self.model.ndet}, nphot: {self.model.nphot}, niter: {self.model.niter}, loglik: {self.model.loglik} converged state: {hex(self.model.conv)}\n"
 *         msg += "prior:\n"             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             msg += f"{self.model.prior[i]}, " if i < self.model.nstate -1 else f"{self.model.prior[i]}\n"
*/
  __pyx_t_7 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_prior_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_7));
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":1053
 *         msg = f"nstate: {self.model.nstate}, ndet: {self.model.ndet}, nphot: {self.model.nphot}, niter: {self.model.niter}, loglik: {self.model.loglik} converged state: {hex(self.model.conv)}\n"
 *         msg += "prior:\n"
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             msg += f"{self.model.prior[i]}, " if i < self.model.nstate -1 else f"{self.model.prior[i]}\n"
 *         msg += "trans:\n"
*/
  __pyx_t_9 = __pyx_v_self->model->nstate;
  __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;

    /* "H2MM_C.pyx":1054
 *         msg += "prior:\n"
 *         for i in range(self.model.nstate):
 *             msg += f"{self.model.prior[i]}, " if i < self.model.nstate -1 else f"{self.model.prior[i]}\n"             # <<<<<<<<<<<<<<
 *         msg += "trans:\n"
 *         for i in range(self.model.nstate):
*/
    __pyx_t_12 = (__pyx_v_i < (__pyx_v_self->model->nstate - 1));
    if (__pyx_t_12) {
      __pyx_t_5 = PyFloat_FromDouble((__pyx_v_self->model->prior[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_6, __pyx_mstate_global->__pyx_kp_u__20); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __pyx_t_5 = PyFloat_FromDouble((__pyx_v_self->model->prior[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_6, __pyx_mstate_global->__pyx_kp_u__12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_v_msg, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;
  }

  /* "H2MM_C.pyx":1055
 *         for i in range(self.model.nstate):
 *             msg += f"{self.model.prior[i]}, " if i < self.model.nstate -1 else f"{self.model.prior[i]}\n"
 *         msg += "trans:\n"             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):
*/
  __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_trans_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_5));
  __pyx_t_5 = 0;

  /* "H2MM_C.pyx":1056
 *             msg += f"{self.model.prior[i]}, " if i < self.model.nstate -1 else f"{self.model.prior[i]}\n"
 *         msg += "trans:\n"
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 msg += f"{self.model.trans[i*self.model.nstate + j]}"
*/
  __pyx_t_9 = __pyx_v_self->model->nstate;
  __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;

    /* "H2MM_C.pyx":1057
 *         msg += "trans:\n"
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 msg += f"{self.model.trans[i*self.model.nstate + j]}"
 *                 msg += ", " if j < self.model.nstate -1 else "\n"
*/
    __pyx_t_13 = __pyx_v_self->model->nstate;
    __pyx_t_14 = __pyx_t_13;
    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "H2MM_C.pyx":1058
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):
 *                 msg += f"{self.model.trans[i*self.model.nstate + j]}"             # <<<<<<<<<<<<<<
 *                 msg += ", " if j < self.model.nstate -1 else "\n"
 *         msg += "obs:\n"
*/
      __pyx_t_5 = PyFloat_FromDouble((__pyx_v_self->model->trans[((__pyx_v_i * __pyx_v_self->model->nstate) + __pyx_v_j)])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1058, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1058, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_msg, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1058, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "H2MM_C.pyx":1059
 *             for j in range(self.model.nstate):
 *                 msg += f"{self.model.trans[i*self.model.nstate + j]}"
 *                 msg += ", " if j < self.model.nstate -1 else "\n"             # <<<<<<<<<<<<<<
 *         msg += "obs:\n"
 *         for i in range(self.model.nstate):
*/
      __pyx_t_12 = (__pyx_v_j < (__pyx_v_self->model->nstate - 1));
      if (__pyx_t_12) {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__20);
        __pyx_t_5 = __pyx_mstate_global->__pyx_kp_u__20;
      } else {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__12);
        __pyx_t_5 = __pyx_mstate_global->__pyx_kp_u__12;
      }
      __pyx_t_7 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_v_msg, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1059, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;
    }
  }

  /* "H2MM_C.pyx":1060
 *                 msg += f"{self.model.trans[i*self.model.nstate + j]}"
 *                 msg += ", " if j < self.model.nstate -1 else "\n"
 *         msg += "obs:\n"             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.ndet):
*/
  __pyx_t_7 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_obs_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_7));
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":1061
 *                 msg += ", " if j < self.model.nstate -1 else "\n"
 *         msg += "obs:\n"
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.ndet):
 *                 msg += f"{self.model.obs[j*self.model.nstate + i]}"
*/
  __pyx_t_9 = __pyx_v_self->model->nstate;
  __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;

    /* "H2MM_C.pyx":1062
 *         msg += "obs:\n"
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.ndet):             # <<<<<<<<<<<<<<
 *                 msg += f"{self.model.obs[j*self.model.nstate + i]}"
 *                 msg += ", " if j < self.model.ndet - 1 else "\n"
*/
    __pyx_t_13 = __pyx_v_self->model->ndet;
    __pyx_t_14 = __pyx_t_13;
    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "H2MM_C.pyx":1063
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.ndet):
 *                 msg += f"{self.model.obs[j*self.model.nstate + i]}"             # <<<<<<<<<<<<<<
 *                 msg += ", " if j < self.model.ndet - 1 else "\n"
 *         return msg
*/
      __pyx_t_7 = PyFloat_FromDouble((__pyx_v_self->model->obs[((__pyx_v_j * __pyx_v_self->model->nstate) + __pyx_v_i)])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_msg, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "H2MM_C.pyx":1064
 *             for j in range(self.model.ndet):
 *                 msg += f"{self.model.obs[j*self.model.nstate + i]}"
 *                 msg += ", " if j < self.model.ndet - 1 else "\n"             # <<<<<<<<<<<<<<
 *         return msg
 * 
*/
      __pyx_t_12 = (__pyx_v_j < (__pyx_v_self->model->ndet - 1));
      if (__pyx_t_12) {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__20);
        __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u__20;
      } else {
        __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__12);
        __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u__12;
      }
      __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_v_msg, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_msg, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;
    }
  }

  /* "H2MM_C.pyx":1065
 *                 msg += f"{self.model.obs[j*self.model.nstate + i]}"
 *                 msg += ", " if j < self.model.ndet - 1 else "\n"
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1049
 *         return new
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         cdef int64_t i, j
 *         msg = f"nstate: {self.model.nstate}, ndet: {self.model.ndet}, nphot: {self.model.nphot}, niter: {self.model.niter}, loglik: {self.model.loglik} converged state: {hex(self.model.conv)}\n"
*/

  /* 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_AddTraceback("H2MM_C.h2mm_model.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1067
 *         return msg
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'
 *         if self.model.conv & CONVCODE_LLCOMPUTED:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_13__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_13__str__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_12__str__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_12__str__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_v_out = 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[4];
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "H2MM_C.pyx":1068
 * 
 *     def __str__(self):
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'             # <<<<<<<<<<<<<<
 *         if self.model.conv & CONVCODE_LLCOMPUTED:
 *             out += f', loglik: {self.model.loglik}'
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_get_conv_descr(__pyx_v_self->model->conv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->nstate, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyUnicode_From_int64_t(__pyx_v_self->model->ndet, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_states;
  __pyx_t_4[1] = __pyx_t_2;
  __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_streams;
  __pyx_t_4[3] = __pyx_t_3;
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127);
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1068, __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 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __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_out = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1069
 *     def __str__(self):
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'
 *         if self.model.conv & CONVCODE_LLCOMPUTED:             # <<<<<<<<<<<<<<
 *             out += f', loglik: {self.model.loglik}'
 *         return out
*/
  __pyx_t_6 = ((__pyx_v_self->model->conv & CONVCODE_LLCOMPUTED) != 0);
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":1070
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'
 *         if self.model.conv & CONVCODE_LLCOMPUTED:
 *             out += f', loglik: {self.model.loglik}'             # <<<<<<<<<<<<<<
 *         return out
 * 
*/
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_loglik_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_v_out, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "H2MM_C.pyx":1069
 *     def __str__(self):
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'
 *         if self.model.conv & CONVCODE_LLCOMPUTED:             # <<<<<<<<<<<<<<
 *             out += f', loglik: {self.model.loglik}'
 *         return out
*/
  }

  /* "H2MM_C.pyx":1071
 *         if self.model.conv & CONVCODE_LLCOMPUTED:
 *             out += f', loglik: {self.model.loglik}'
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     # a number of property defs so that the values are accesible from python
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1067
 *         return msg
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         out = get_conv_descr(self.model.conv) + f' states={self.model.nstate}, streams={self.model.ndet}'
 *         if self.model.conv & CONVCODE_LLCOMPUTED:
*/

  /* 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_AddTraceback("H2MM_C.h2mm_model.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1074
 * 
 *     # a number of property defs so that the values are accesible from python
 *     @property             # <<<<<<<<<<<<<<
 *     def prior(self):
 *         """Prior probability matrix, 1D, size nstate"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5prior_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5prior_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5prior___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5prior___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  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;
  double *__pyx_t_7;
  struct __pyx_array_obj *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1077
 *     def prior(self):
 *         """Prior probability matrix, 1D, size nstate"""
 *         return np.asarray(<double[:self.model.nstate]>self.model.prior).copy()             # <<<<<<<<<<<<<<
 * 
 *     @prior.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_v_self->model->prior;
  if (!__pyx_t_7) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(0, 1077, __pyx_L1_error)
  }
  __pyx_t_9 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = Py_BuildValue("("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_self->model->nstate)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_LIMITED_API
  __pyx_t_10 = PyBytes_AsString(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1077, __pyx_L1_error)
  #else
  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_9);
  #endif
  __pyx_t_8 = __pyx_array_new(__pyx_t_5, sizeof(double), __pyx_t_10, "c", (char *) __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_11 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_t_8)};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_11 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1074
 * 
 *     # a number of property defs so that the values are accesible from python
 *     @property             # <<<<<<<<<<<<<<
 *     def prior(self):
 *         """Prior probability matrix, 1D, size nstate"""
*/

  /* 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((PyObject *)__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.prior.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1079
 *         return np.asarray(<double[:self.model.nstate]>self.model.prior).copy()
 * 
 *     @prior.setter             # <<<<<<<<<<<<<<
 *     def prior(self,prior):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_5prior_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prior); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_5prior_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prior) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5prior_2__set__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), ((PyObject *)__pyx_v_prior));

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

static int __pyx_pf_6H2MM_C_10h2mm_model_5prior_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_prior) {
  int64_t __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  double __pyx_t_7;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  int64_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_prior);

  /* "H2MM_C.pyx":1081
 *     @prior.setter
 *     def prior(self,prior):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if prior.ndim != 1:
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1082
 *     def prior(self,prior):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")             # <<<<<<<<<<<<<<
 *         if prior.ndim != 1:
 *             raise ValueError("Prior must be 1D numpy floating point array")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Fixed_models_cannot_be_altered};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_AttributeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1082, __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(0, 1082, __pyx_L1_error)

    /* "H2MM_C.pyx":1081
 *     @prior.setter
 *     def prior(self,prior):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if prior.ndim != 1:
*/
  }

  /* "H2MM_C.pyx":1083
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if prior.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Prior must be 1D numpy floating point array")
 *         if prior.shape[0] != self.model.nstate:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1084
 *             raise AttributeError("Fixed models cannot be altered")
 *         if prior.ndim != 1:
 *             raise ValueError("Prior must be 1D numpy floating point array")             # <<<<<<<<<<<<<<
 *         if prior.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Prior_must_be_1D_numpy_floating};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1084, __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(0, 1084, __pyx_L1_error)

    /* "H2MM_C.pyx":1083
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if prior.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Prior must be 1D numpy floating point array")
 *         if prior.shape[0] != self.model.nstate:
*/
  }

  /* "H2MM_C.pyx":1085
 *         if prior.ndim != 1:
 *             raise ValueError("Prior must be 1D numpy floating point array")
 *         if prior.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states")
 *         if (prior.sum() - 1.0) > 1e-14:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_prior, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1086
 *             raise ValueError("Prior must be 1D numpy floating point array")
 *         if prior.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states")             # <<<<<<<<<<<<<<
 *         if (prior.sum() - 1.0) > 1e-14:
 *             warnings.warn("Input array not stochastic, new array will be normalized")
*/
    __pyx_t_2 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_number_of_stat};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __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(0, 1086, __pyx_L1_error)

    /* "H2MM_C.pyx":1085
 *         if prior.ndim != 1:
 *             raise ValueError("Prior must be 1D numpy floating point array")
 *         if prior.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states")
 *         if (prior.sum() - 1.0) > 1e-14:
*/
  }

  /* "H2MM_C.pyx":1087
 *         if prior.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states")
 *         if (prior.sum() - 1.0) > 1e-14:             # <<<<<<<<<<<<<<
 *             warnings.warn("Input array not stochastic, new array will be normalized")
 *         prior = prior.astype('double')
*/
  __pyx_t_2 = __pyx_v_prior;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_2 = __Pyx_PyFloat_SubtractObjC(__pyx_t_5, __pyx_mstate_global->__pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_mstate_global->__pyx_float_1eneg_14, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1088
 *             raise ValueError("Cannot change the number of states")
 *         if (prior.sum() - 1.0) > 1e-14:
 *             warnings.warn("Input array not stochastic, new array will be normalized")             # <<<<<<<<<<<<<<
 *         prior = prior.astype('double')
 *         self.model.loglik = -np.inf
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Input_array_not_stochastic_new_a};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H2MM_C.pyx":1087
 *         if prior.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states")
 *         if (prior.sum() - 1.0) > 1e-14:             # <<<<<<<<<<<<<<
 *             warnings.warn("Input array not stochastic, new array will be normalized")
 *         prior = prior.astype('double')
*/
  }

  /* "H2MM_C.pyx":1089
 *         if (prior.sum() - 1.0) > 1e-14:
 *             warnings.warn("Input array not stochastic, new array will be normalized")
 *         prior = prior.astype('double')             # <<<<<<<<<<<<<<
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
*/
  __pyx_t_6 = __pyx_v_prior;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF_SET(__pyx_v_prior, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "H2MM_C.pyx":1090
 *             warnings.warn("Input array not stochastic, new array will be normalized")
 *         prior = prior.astype('double')
 *         self.model.loglik = -np.inf             # <<<<<<<<<<<<<<
 *         self.model.conv = 0
 *         self.model.niter = 0
*/
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_self->model->loglik = __pyx_t_7;

  /* "H2MM_C.pyx":1091
 *         prior = prior.astype('double')
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0             # <<<<<<<<<<<<<<
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):
*/
  __pyx_v_self->model->conv = 0;

  /* "H2MM_C.pyx":1092
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
 *         self.model.niter = 0             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]
*/
  __pyx_v_self->model->niter = 0;

  /* "H2MM_C.pyx":1093
 *         self.model.conv = 0
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             self.model.prior[i] = prior[i]
 *         self.normalize()
*/
  __pyx_t_8 = __pyx_v_self->model->nstate;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "H2MM_C.pyx":1094
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]             # <<<<<<<<<<<<<<
 *         self.normalize()
 * 
*/
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_prior, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    (__pyx_v_self->model->prior[__pyx_v_i]) = __pyx_t_7;
  }

  /* "H2MM_C.pyx":1095
 *         for i in range(self.model.nstate):
 *             self.model.prior[i] = prior[i]
 *         self.normalize()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_6 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":1079
 *         return np.asarray(<double[:self.model.nstate]>self.model.prior).copy()
 * 
 *     @prior.setter             # <<<<<<<<<<<<<<
 *     def prior(self,prior):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.prior.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1097
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def trans(self):
 *         """Transition probability matrix, square, dimenstions nstate x nstate"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5trans_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5trans_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5trans___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5trans___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  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;
  double *__pyx_t_7;
  struct __pyx_array_obj *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1100
 *     def trans(self):
 *         """Transition probability matrix, square, dimenstions nstate x nstate"""
 *         return np.asarray(<double[:self.model.nstate,:self.model.nstate]>self.model.trans).copy()             # <<<<<<<<<<<<<<
 * 
 *     @trans.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_v_self->model->trans;
  if (!__pyx_t_7) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(0, 1100, __pyx_L1_error)
  }
  __pyx_t_9 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = Py_BuildValue("("  __PYX_BUILD_PY_SSIZE_T  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_self->model->nstate), ((Py_ssize_t)__pyx_v_self->model->nstate)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_LIMITED_API
  __pyx_t_10 = PyBytes_AsString(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1100, __pyx_L1_error)
  #else
  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_9);
  #endif
  __pyx_t_8 = __pyx_array_new(__pyx_t_5, sizeof(double), __pyx_t_10, "c", (char *) __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_11 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_t_8)};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_11 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1097
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def trans(self):
 *         """Transition probability matrix, square, dimenstions nstate x nstate"""
*/

  /* 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((PyObject *)__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.trans.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1102
 *         return np.asarray(<double[:self.model.nstate,:self.model.nstate]>self.model.trans).copy()
 * 
 *     @trans.setter             # <<<<<<<<<<<<<<
 *     def trans(self, trans):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_5trans_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_trans); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_5trans_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_trans) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5trans_2__set__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), ((PyObject *)__pyx_v_trans));

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

static int __pyx_pf_6H2MM_C_10h2mm_model_5trans_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_trans) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  double __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_trans);

  /* "H2MM_C.pyx":1104
 *     @trans.setter
 *     def trans(self, trans):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if trans.ndim != 2:
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1105
 *     def trans(self, trans):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")             # <<<<<<<<<<<<<<
 *         if trans.ndim != 2:
 *             raise ValueError("Trans must be a 2D numpy floating point array")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Fixed_models_cannot_be_altered};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_AttributeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1105, __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(0, 1105, __pyx_L1_error)

    /* "H2MM_C.pyx":1104
 *     @trans.setter
 *     def trans(self, trans):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if trans.ndim != 2:
*/
  }

  /* "H2MM_C.pyx":1106
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if trans.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans must be a 2D numpy floating point array")
 *         if trans.shape[0] != trans.shape[1]:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1107
 *             raise AttributeError("Fixed models cannot be altered")
 *         if trans.ndim != 2:
 *             raise ValueError("Trans must be a 2D numpy floating point array")             # <<<<<<<<<<<<<<
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans must be a square array")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Trans_must_be_a_2D_numpy_floatin};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1107, __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(0, 1107, __pyx_L1_error)

    /* "H2MM_C.pyx":1106
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if trans.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans must be a 2D numpy floating point array")
 *         if trans.shape[0] != trans.shape[1]:
*/
  }

  /* "H2MM_C.pyx":1108
 *         if trans.ndim != 2:
 *             raise ValueError("Trans must be a 2D numpy floating point array")
 *         if trans.shape[0] != trans.shape[1]:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans must be a square array")
 *         if trans.shape[0] != self.model.nstate:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1109
 *             raise ValueError("Trans must be a 2D numpy floating point array")
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans must be a square array")             # <<<<<<<<<<<<<<
 *         if trans.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
*/
    __pyx_t_5 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Trans_must_be_a_square_array};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1109, __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(0, 1109, __pyx_L1_error)

    /* "H2MM_C.pyx":1108
 *         if trans.ndim != 2:
 *             raise ValueError("Trans must be a 2D numpy floating point array")
 *         if trans.shape[0] != trans.shape[1]:             # <<<<<<<<<<<<<<
 *             raise ValueError("Trans must be a square array")
 *         if trans.shape[0] != self.model.nstate:
*/
  }

  /* "H2MM_C.pyx":1110
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans must be a square array")
 *         if trans.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states in a model")
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_trans, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1111
 *             raise ValueError("Trans must be a square array")
 *         if trans.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")             # <<<<<<<<<<<<<<
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
*/
    __pyx_t_2 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_number_of_stat_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1111, __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(0, 1111, __pyx_L1_error)

    /* "H2MM_C.pyx":1110
 *         if trans.shape[0] != trans.shape[1]:
 *             raise ValueError("Trans must be a square array")
 *         if trans.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states in a model")
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):
*/
  }

  /* "H2MM_C.pyx":1112
 *         if trans.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):             # <<<<<<<<<<<<<<
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         trans = trans.astype('double')
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_v_trans;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_8 = __Pyx_PyFloat_SubtractObjC(__pyx_t_5, __pyx_mstate_global->__pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_8, __pyx_mstate_global->__pyx_float_1eneg_14, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1113
 *             raise ValueError("Cannot change the number of states in a model")
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")             # <<<<<<<<<<<<<<
 *         trans = trans.astype('double')
 *         self.model.loglik = -np.inf
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warnings); 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_mstate_global->__pyx_n_u_warn); 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_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Input_matrix_not_row_stochastic};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1112
 *         if trans.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):             # <<<<<<<<<<<<<<
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         trans = trans.astype('double')
*/
  }

  /* "H2MM_C.pyx":1114
 *         if np.any((trans.sum(axis=1) - 1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         trans = trans.astype('double')             # <<<<<<<<<<<<<<
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
*/
  __pyx_t_2 = __pyx_v_trans;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF_SET(__pyx_v_trans, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1115
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         trans = trans.astype('double')
 *         self.model.loglik = -np.inf             # <<<<<<<<<<<<<<
 *         self.model.conv = 0
 *         self.model.niter = 0
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->model->loglik = __pyx_t_9;

  /* "H2MM_C.pyx":1116
 *         trans = trans.astype('double')
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0             # <<<<<<<<<<<<<<
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):
*/
  __pyx_v_self->model->conv = 0;

  /* "H2MM_C.pyx":1117
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
 *         self.model.niter = 0             # <<<<<<<<<<<<<<
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):
*/
  __pyx_v_self->model->niter = 0;

  /* "H2MM_C.pyx":1118
 *         self.model.conv = 0
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
*/
  __pyx_t_2 = NULL;
  __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_10(__pyx_t_6);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1118, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1119
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         self.normalize()
*/
    __pyx_t_2 = NULL;
    __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 1119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      {
        __pyx_t_3 = __pyx_t_11(__pyx_t_5);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1119, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":1120
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]             # <<<<<<<<<<<<<<
 *         self.normalize()
 * 
*/
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 1120, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 1120, __pyx_L1_error);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_trans, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1120, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      (__pyx_v_self->model->trans[__pyx_t_12]) = __pyx_t_9;

      /* "H2MM_C.pyx":1119
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         self.normalize()
*/
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H2MM_C.pyx":1118
 *         self.model.conv = 0
 *         self.model.niter = 0
 *         for i in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H2MM_C.pyx":1121
 *             for j in range(self.model.nstate):
 *                 self.model.trans[self.model.nstate*i + j] = trans[i,j]
 *         self.normalize()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H2MM_C.pyx":1102
 *         return np.asarray(<double[:self.model.nstate,:self.model.nstate]>self.model.trans).copy()
 * 
 *     @trans.setter             # <<<<<<<<<<<<<<
 *     def trans(self, trans):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.trans.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_trans);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1123
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def obs(self):
 *         """Emission probability matrix, 2D shape nstate x ndet"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_3obs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_3obs_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_3obs___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_3obs___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  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;
  double *__pyx_t_7;
  struct __pyx_array_obj *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1126
 *     def obs(self):
 *         """Emission probability matrix, 2D shape nstate x ndet"""
 *         return np.asarray(<double[:self.model.ndet,:self.model.nstate]>self.model.obs).T.copy()             # <<<<<<<<<<<<<<
 * 
 *     @obs.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __pyx_v_self->model->obs;
  if (!__pyx_t_7) {
    PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
    __PYX_ERR(0, 1126, __pyx_L1_error)
  }
  __pyx_t_9 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = Py_BuildValue("("  __PYX_BUILD_PY_SSIZE_T  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_self->model->ndet), ((Py_ssize_t)__pyx_v_self->model->nstate)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_LIMITED_API
  __pyx_t_10 = PyBytes_AsString(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1126, __pyx_L1_error)
  #else
  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_9);
  #endif
  __pyx_t_8 = __pyx_array_new(__pyx_t_5, sizeof(double), __pyx_t_10, "c", (char *) __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_11 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_11 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_t_8)};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF((PyObject *)__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_T_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_6;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_11 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1123
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def obs(self):
 *         """Emission probability matrix, 2D shape nstate x ndet"""
*/

  /* 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((PyObject *)__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.obs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1128
 *         return np.asarray(<double[:self.model.ndet,:self.model.nstate]>self.model.obs).T.copy()
 * 
 *     @obs.setter             # <<<<<<<<<<<<<<
 *     def obs(self,obs):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_3obs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_obs); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_3obs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_obs) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_3obs_2__set__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), ((PyObject *)__pyx_v_obs));

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

static int __pyx_pf_6H2MM_C_10h2mm_model_3obs_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_obs) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  double __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_obs);

  /* "H2MM_C.pyx":1130
 *     @obs.setter
 *     def obs(self,obs):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if obs.ndim != 2:
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1131
 *     def obs(self,obs):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")             # <<<<<<<<<<<<<<
 *         if obs.ndim != 2:
 *             raise ValueError("Obs must be a 2D numpy floating point array")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Fixed_models_cannot_be_altered};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_AttributeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __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(0, 1131, __pyx_L1_error)

    /* "H2MM_C.pyx":1130
 *     @obs.setter
 *     def obs(self,obs):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Fixed models cannot be altered")
 *         if obs.ndim != 2:
*/
  }

  /* "H2MM_C.pyx":1132
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if obs.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Obs must be a 2D numpy floating point array")
 *         if obs.shape[0] != self.model.nstate:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1133
 *             raise AttributeError("Fixed models cannot be altered")
 *         if obs.ndim != 2:
 *             raise ValueError("Obs must be a 2D numpy floating point array")             # <<<<<<<<<<<<<<
 *         if obs.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Obs_must_be_a_2D_numpy_floating};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1133, __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(0, 1133, __pyx_L1_error)

    /* "H2MM_C.pyx":1132
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Fixed models cannot be altered")
 *         if obs.ndim != 2:             # <<<<<<<<<<<<<<
 *             raise ValueError("Obs must be a 2D numpy floating point array")
 *         if obs.shape[0] != self.model.nstate:
*/
  }

  /* "H2MM_C.pyx":1134
 *         if obs.ndim != 2:
 *             raise ValueError("Obs must be a 2D numpy floating point array")
 *         if obs.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states in a model")
 *         if obs.shape[1] != self.model.ndet:
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1135
 *             raise ValueError("Obs must be a 2D numpy floating point array")
 *         if obs.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")             # <<<<<<<<<<<<<<
 *         if obs.shape[1] != self.model.ndet:
 *             raise ValueError("Cannot change the number of streams in the model")
*/
    __pyx_t_2 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_number_of_stat_2};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __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(0, 1135, __pyx_L1_error)

    /* "H2MM_C.pyx":1134
 *         if obs.ndim != 2:
 *             raise ValueError("Obs must be a 2D numpy floating point array")
 *         if obs.shape[0] != self.model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of states in a model")
 *         if obs.shape[1] != self.model.ndet:
*/
  }

  /* "H2MM_C.pyx":1136
 *         if obs.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
 *         if obs.shape[1] != self.model.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of streams in the model")
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_obs, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->ndet); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __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, 1136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1137
 *             raise ValueError("Cannot change the number of states in a model")
 *         if obs.shape[1] != self.model.ndet:
 *             raise ValueError("Cannot change the number of streams in the model")             # <<<<<<<<<<<<<<
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
*/
    __pyx_t_5 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Cannot_change_the_number_of_stre};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __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(0, 1137, __pyx_L1_error)

    /* "H2MM_C.pyx":1136
 *         if obs.shape[0] != self.model.nstate:
 *             raise ValueError("Cannot change the number of states in a model")
 *         if obs.shape[1] != self.model.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot change the number of streams in the model")
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):
*/
  }

  /* "H2MM_C.pyx":1138
 *         if obs.shape[1] != self.model.ndet:
 *             raise ValueError("Cannot change the number of streams in the model")
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):             # <<<<<<<<<<<<<<
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         obs = obs.astype('double')
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_v_obs;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_8 = __Pyx_PyFloat_SubtractObjC(__pyx_t_2, __pyx_mstate_global->__pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_mstate_global->__pyx_float_1eneg_14, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1139
 *             raise ValueError("Cannot change the number of streams in the model")
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")             # <<<<<<<<<<<<<<
 *         obs = obs.astype('double')
 *         self.model.loglik = -np.inf
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Input_matrix_not_row_stochastic};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1138
 *         if obs.shape[1] != self.model.ndet:
 *             raise ValueError("Cannot change the number of streams in the model")
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):             # <<<<<<<<<<<<<<
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         obs = obs.astype('double')
*/
  }

  /* "H2MM_C.pyx":1140
 *         if np.any((obs.sum(axis=1) -  1.0) > 1e-14):
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         obs = obs.astype('double')             # <<<<<<<<<<<<<<
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
*/
  __pyx_t_5 = __pyx_v_obs;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_double};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF_SET(__pyx_v_obs, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1141
 *             warnings.warn("Input matrix not row stochastic, new matrix will be normalized")
 *         obs = obs.astype('double')
 *         self.model.loglik = -np.inf             # <<<<<<<<<<<<<<
 *         self.model.conv = 0
 *         self.model.niter = 0
*/
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->model->loglik = __pyx_t_9;

  /* "H2MM_C.pyx":1142
 *         obs = obs.astype('double')
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0             # <<<<<<<<<<<<<<
 *         self.model.niter = 0
 *         for i in range(self.model.ndet):
*/
  __pyx_v_self->model->conv = 0;

  /* "H2MM_C.pyx":1143
 *         self.model.loglik = -np.inf
 *         self.model.conv = 0
 *         self.model.niter = 0             # <<<<<<<<<<<<<<
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):
*/
  __pyx_v_self->model->niter = 0;

  /* "H2MM_C.pyx":1144
 *         self.model.conv = 0
 *         self.model.niter = 0
 *         for i in range(self.model.ndet):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->ndet); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1144, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_10(__pyx_t_6);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1144, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1145
 *         self.model.niter = 0
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
 *         self.normalize()
*/
    __pyx_t_5 = NULL;
    __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 1145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1145, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      {
        __pyx_t_3 = __pyx_t_11(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1145, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":1146
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]             # <<<<<<<<<<<<<<
 *         self.normalize()
 * 
*/
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_j);
      __Pyx_GIVEREF(__pyx_v_j);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_j) != (0)) __PYX_ERR(0, 1146, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i) != (0)) __PYX_ERR(0, 1146, __pyx_L1_error);
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_obs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      (__pyx_v_self->model->obs[__pyx_t_12]) = __pyx_t_9;

      /* "H2MM_C.pyx":1145
 *         self.model.niter = 0
 *         for i in range(self.model.ndet):
 *             for j in range(self.model.nstate):             # <<<<<<<<<<<<<<
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
 *         self.normalize()
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H2MM_C.pyx":1144
 *         self.model.conv = 0
 *         self.model.niter = 0
 *         for i in range(self.model.ndet):             # <<<<<<<<<<<<<<
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
*/
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H2MM_C.pyx":1147
 *             for j in range(self.model.nstate):
 *                 self.model.obs[self.model.nstate * i + j] = obs[j,i]
 *         self.normalize()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H2MM_C.pyx":1128
 *         return np.asarray(<double[:self.model.ndet,:self.model.nstate]>self.model.obs).T.copy()
 * 
 *     @obs.setter             # <<<<<<<<<<<<<<
 *     def obs(self,obs):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.obs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1149
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def loglik(self):
 *         """Loglikelihood of model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6loglik_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6loglik_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_6loglik___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6loglik___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  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;
  size_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1152
 *     def loglik(self):
 *         """Loglikelihood of model"""
 *         if self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn("loglik not calculated against data, will be meaningless -inf")
 *         return self.model.loglik
*/
  __pyx_t_1 = (__pyx_v_self->model->nphot == 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1153
 *         """Loglikelihood of model"""
 *         if self.model.nphot == 0:
 *             warnings.warn("loglik not calculated against data, will be meaningless -inf")             # <<<<<<<<<<<<<<
 *         return self.model.loglik
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_loglik_not_calculated_against_da};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 1153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H2MM_C.pyx":1152
 *     def loglik(self):
 *         """Loglikelihood of model"""
 *         if self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn("loglik not calculated against data, will be meaningless -inf")
 *         return self.model.loglik
*/
  }

  /* "H2MM_C.pyx":1154
 *         if self.model.nphot == 0:
 *             warnings.warn("loglik not calculated against data, will be meaningless -inf")
 *         return self.model.loglik             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1149
 *         self.normalize()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def loglik(self):
 *         """Loglikelihood of model"""
*/

  /* 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("H2MM_C.h2mm_model.loglik.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1156
 *         return self.model.loglik
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def k(self):
 *         """Number of free parameters in model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_1k_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_1k_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_1k___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_1k___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1159
 *     def k(self):
 *         """Number of free parameters in model"""
 *         return self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(((__Pyx_pow_int64_t(__pyx_v_self->model->nstate, 2) + ((__pyx_v_self->model->ndet - 1) * __pyx_v_self->model->nstate)) - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1156
 *         return self.model.loglik
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def k(self):
 *         """Number of free parameters in model"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.k.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1161
 *         return self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def bic(self):
 *         """Bayes Information Criterion of model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_3bic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_3bic_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_3bic___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_3bic___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1164
 *     def bic(self):
 *         """Bayes Information Criterion of model"""
 *         if self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             raise Exception("Init model, no data linked, therefore BIC not known.")
 *         if self.model.conv == 0:
*/
  __pyx_t_1 = (__pyx_v_self->model->nphot == 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1165
 *         """Bayes Information Criterion of model"""
 *         if self.model.nphot == 0:
 *             raise Exception("Init model, no data linked, therefore BIC not known.")             # <<<<<<<<<<<<<<
 *         if self.model.conv == 0:
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Init_model_no_data_linked_theref};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1165, __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(0, 1165, __pyx_L1_error)

    /* "H2MM_C.pyx":1164
 *     def bic(self):
 *         """Bayes Information Criterion of model"""
 *         if self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             raise Exception("Init model, no data linked, therefore BIC not known.")
 *         if self.model.conv == 0:
*/
  }

  /* "H2MM_C.pyx":1166
 *         if self.model.nphot == 0:
 *             raise Exception("Init model, no data linked, therefore BIC not known.")
 *         if self.model.conv == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
 *         if self.model.conv == 1 and self.model.loglik == 0.0:
*/
  __pyx_t_1 = (__pyx_v_self->model->conv == 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1167
 *             raise Exception("Init model, no data linked, therefore BIC not known.")
 *         if self.model.conv == 0:
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")             # <<<<<<<<<<<<<<
 *         if self.model.conv == 1 and self.model.loglik == 0.0:
 *             return 0.0
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_loglik_not_calculated_against_da_2};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H2MM_C.pyx":1166
 *         if self.model.nphot == 0:
 *             raise Exception("Init model, no data linked, therefore BIC not known.")
 *         if self.model.conv == 0:             # <<<<<<<<<<<<<<
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
 *         if self.model.conv == 1 and self.model.loglik == 0.0:
*/
  }

  /* "H2MM_C.pyx":1168
 *         if self.model.conv == 0:
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
 *         if self.model.conv == 1 and self.model.loglik == 0.0:             # <<<<<<<<<<<<<<
 *             return 0.0
 *         else:
*/
  __pyx_t_7 = (__pyx_v_self->model->conv == 1);
  if (__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->model->loglik == 0.0);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1169
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
 *         if self.model.conv == 1 and self.model.loglik == 0.0:
 *             return 0.0             # <<<<<<<<<<<<<<
 *         else:
 *             return -2*self.model.loglik + np.log(self.model.nphot)*(self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0);
    __pyx_r = __pyx_mstate_global->__pyx_float_0_0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1168
 *         if self.model.conv == 0:
 *             warnings.warn("loglik not calculated against data, BIC meaningless -inf")
 *         if self.model.conv == 1 and self.model.loglik == 0.0:             # <<<<<<<<<<<<<<
 *             return 0.0
 *         else:
*/
  }

  /* "H2MM_C.pyx":1171
 *             return 0.0
 *         else:
 *             return -2*self.model.loglik + np.log(self.model.nphot)*(self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble((-2.0 * __pyx_v_self->model->loglik)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nphot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_8 = __Pyx_PyLong_From_int64_t(((__Pyx_pow_int64_t(__pyx_v_self->model->nstate, 2) + ((__pyx_v_self->model->ndet - 1) * __pyx_v_self->model->nstate)) - 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1171, __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_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "H2MM_C.pyx":1161
 *         return self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def bic(self):
 *         """Bayes Information Criterion of model"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __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("H2MM_C.h2mm_model.bic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1173
 *             return -2*self.model.loglik + np.log(self.model.nphot)*(self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nstate(self):
 *         """Number of states in model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6nstate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6nstate_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_6nstate___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6nstate___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1176
 *     def nstate(self):
 *         """Number of states in model"""
 *         return self.model.nstate             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1173
 *             return -2*self.model.loglik + np.log(self.model.nphot)*(self.model.nstate**2 + ((self.model.ndet - 1)*self.model.nstate) - 1)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nstate(self):
 *         """Number of states in model"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.nstate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1178
 *         return self.model.nstate
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndet(self):
 *         """Nubmer of detectors/photon streams in model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_4ndet_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_4ndet_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_4ndet___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_4ndet___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1181
 *     def ndet(self):
 *         """Nubmer of detectors/photon streams in model"""
 *         return self.model.ndet             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->ndet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1178
 *         return self.model.nstate
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ndet(self):
 *         """Nubmer of detectors/photon streams in model"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.ndet.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1183
 *         return self.model.ndet
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nphot(self):
 *         """Number of photons in data set used to optimize model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5nphot_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5nphot_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5nphot___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5nphot___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1186
 *     def nphot(self):
 *         """Number of photons in data set used to optimize model"""
 *         return self.model.nphot             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nphot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1183
 *         return self.model.ndet
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def nphot(self):
 *         """Number of photons in data set used to optimize model"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.nphot.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1188
 *         return self.model.nphot
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_conv(self):
 *         """Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7is_conv_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7is_conv_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_7is_conv___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_7is_conv___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1191
 *     def is_conv(self):
 *         """Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"""
 *         if self.model.conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             return True
 *         return False
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_OUTPUT) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1192
 *         """Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"""
 *         if self.model.conv & CONVCODE_OUTPUT:
 *             return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1191
 *     def is_conv(self):
 *         """Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"""
 *         if self.model.conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *             return True
 *         return False
*/
  }

  /* "H2MM_C.pyx":1193
 *         if self.model.conv & CONVCODE_OUTPUT:
 *             return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1188
 *         return self.model.nphot
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_conv(self):
 *         """Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"""
*/

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

/* "H2MM_C.pyx":1195
 *         return False
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_opt(self):
 *         """Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6is_opt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_6is_opt_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_6is_opt___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_6is_opt___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1198
 *     def is_opt(self):
 *         """Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"""
 *         if self.model.conv & CONVCODE_FROMOPT:             # <<<<<<<<<<<<<<
 *             return True if self.model.niter != 0 else False
 *         return False
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FROMOPT) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1199
 *         """Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"""
 *         if self.model.conv & CONVCODE_FROMOPT:
 *             return True if self.model.niter != 0 else False             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = (__pyx_v_self->model->niter != 0);
    if (__pyx_t_1) {
      __Pyx_INCREF(Py_True);
      __pyx_t_2 = Py_True;
    } else {
      __Pyx_INCREF(Py_False);
      __pyx_t_2 = Py_False;
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1198
 *     def is_opt(self):
 *         """Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"""
 *         if self.model.conv & CONVCODE_FROMOPT:             # <<<<<<<<<<<<<<
 *             return True if self.model.niter != 0 else False
 *         return False
*/
  }

  /* "H2MM_C.pyx":1200
 *         if self.model.conv & CONVCODE_FROMOPT:
 *             return True if self.model.niter != 0 else False
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1195
 *         return False
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_opt(self):
 *         """Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"""
*/

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

/* "H2MM_C.pyx":1202
 *         return False
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_calc(self):
 *         """If model has been optimized/eveluated, vs being an initial model"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7is_calc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_7is_calc_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_7is_calc___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_7is_calc___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1205
 *     def is_calc(self):
 *         """If model has been optimized/eveluated, vs being an initial model"""
 *         if np.isnan(self.model.loglik) or self.model.loglik == -np.inf or self.model.loglik == 0 or self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             return False
 *         return True
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Negative(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->model->loglik == 0.0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->model->nphot == 0);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1206
 *         """If model has been optimized/eveluated, vs being an initial model"""
 *         if np.isnan(self.model.loglik) or self.model.loglik == -np.inf or self.model.loglik == 0 or self.model.nphot == 0:
 *             return False             # <<<<<<<<<<<<<<
 *         return True
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1205
 *     def is_calc(self):
 *         """If model has been optimized/eveluated, vs being an initial model"""
 *         if np.isnan(self.model.loglik) or self.model.loglik == -np.inf or self.model.loglik == 0 or self.model.nphot == 0:             # <<<<<<<<<<<<<<
 *             return False
 *         return True
*/
  }

  /* "H2MM_C.pyx":1207
 *         if np.isnan(self.model.loglik) or self.model.loglik == -np.inf or self.model.loglik == 0 or self.model.nphot == 0:
 *             return False
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1202
 *         return False
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_calc(self):
 *         """If model has been optimized/eveluated, vs being an initial model"""
*/

  /* 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("H2MM_C.h2mm_model.is_calc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1209
 *         return True
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def conv_code(self):
 *         """The convergence code of model, an int"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_9conv_code_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_9conv_code_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_9conv_code___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_9conv_code___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1212
 *     def conv_code(self):
 *         """The convergence code of model, an int"""
 *         return self.model.conv             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->conv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1209
 *         return True
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def conv_code(self):
 *         """The convergence code of model, an int"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.conv_code.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1214
 *         return self.model.conv
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def conv_str(self):
 *         """String description of how model optimization/calculation ended"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_8conv_str_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_8conv_str_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_8conv_str___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8conv_str___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1217
 *     def conv_str(self):
 *         """String description of how model optimization/calculation ended"""
 *         return get_conv_descr(self.model.conv)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6H2MM_C_get_conv_descr(__pyx_v_self->model->conv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1214
 *         return self.model.conv
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def conv_str(self):
 *         """String description of how model optimization/calculation ended"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.conv_str.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1219
 *         return get_conv_descr(self.model.conv)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def niter(self):
 *         """Number of iterations optimization took"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5niter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_5niter_1__get__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5niter___get__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_5niter___get__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "H2MM_C.pyx":1222
 *     def niter(self):
 *         """Number of iterations optimization took"""
 *         return self.model.niter             # <<<<<<<<<<<<<<
 * 
 *     @niter.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->niter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1219
 *         return get_conv_descr(self.model.conv)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def niter(self):
 *         """Number of iterations optimization took"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.niter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1224
 *         return self.model.niter
 * 
 *     @niter.setter             # <<<<<<<<<<<<<<
 *     def niter(self,niter):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10h2mm_model_5niter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_niter); /*proto*/
static int __pyx_pw_6H2MM_C_10h2mm_model_5niter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_niter) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_5niter_2__set__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), ((PyObject *)__pyx_v_niter));

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

static int __pyx_pf_6H2MM_C_10h2mm_model_5niter_2__set__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_niter) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int64_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "H2MM_C.pyx":1226
 *     @niter.setter
 *     def niter(self,niter):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Cannot set niter for this type of model")
 *         if niter <= 0:
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1227
 *     def niter(self,niter):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Cannot set niter for this type of model")             # <<<<<<<<<<<<<<
 *         if niter <= 0:
 *             raise ValueError("Cannot have negative iterations")
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_set_niter_for_this_type_o};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_AttributeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __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(0, 1227, __pyx_L1_error)

    /* "H2MM_C.pyx":1226
 *     @niter.setter
 *     def niter(self,niter):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise AttributeError("Cannot set niter for this type of model")
 *         if niter <= 0:
*/
  }

  /* "H2MM_C.pyx":1228
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Cannot set niter for this type of model")
 *         if niter <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot have negative iterations")
 *         self.model.niter = niter
*/
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_niter, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1229
 *             raise AttributeError("Cannot set niter for this type of model")
 *         if niter <= 0:
 *             raise ValueError("Cannot have negative iterations")             # <<<<<<<<<<<<<<
 *         self.model.niter = niter
 * 
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_have_negative_iterations};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __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(0, 1229, __pyx_L1_error)

    /* "H2MM_C.pyx":1228
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise AttributeError("Cannot set niter for this type of model")
 *         if niter <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot have negative iterations")
 *         self.model.niter = niter
*/
  }

  /* "H2MM_C.pyx":1230
 *         if niter <= 0:
 *             raise ValueError("Cannot have negative iterations")
 *         self.model.niter = niter             # <<<<<<<<<<<<<<
 * 
 *     def set_converged(self, converged=True):
*/
  __pyx_t_5 = __Pyx_PyLong_As_int64_t(__pyx_v_niter); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1230, __pyx_L1_error)
  __pyx_v_self->model->niter = __pyx_t_5;

  /* "H2MM_C.pyx":1224
 *         return self.model.niter
 * 
 *     @niter.setter             # <<<<<<<<<<<<<<
 *     def niter(self,niter):
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.niter.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1232
 *         self.model.niter = niter
 * 
 *     def set_converged(self, converged=True):             # <<<<<<<<<<<<<<
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_15set_converged(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_14set_converged, "Modify model to mark as converged or not");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_15set_converged = {"set_converged", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_15set_converged, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_14set_converged};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_15set_converged(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_converged = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_converged (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_converged_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1232, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_converged", 0) < (0)) __PYX_ERR(0, 1232, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    } else {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_converged = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_converged", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1232, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.set_converged", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_14set_converged(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v_converged);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_14set_converged(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_converged) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_converged", 0);
  __Pyx_INCREF(__pyx_v_converged);

  /* "H2MM_C.pyx":1234
 *     def set_converged(self, converged=True):
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)             # <<<<<<<<<<<<<<
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):
 *             raise Exception("Model uninitialized with data, cannot set converged")
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_converged); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1234, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_converged, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":1235
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):             # <<<<<<<<<<<<<<
 *             raise Exception("Model uninitialized with data, cannot set converged")
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/
  __pyx_t_3 = (__pyx_v_self->model->nphot == 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_self->model->loglik == 0.0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1236
 *         converged = bool(converged)
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):
 *             raise Exception("Model uninitialized with data, cannot set converged")             # <<<<<<<<<<<<<<
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise Exception("Fixed model, cannot mutate converged state")
*/
    __pyx_t_6 = NULL;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Model_uninitialized_with_data_ca};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __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, 1236, __pyx_L1_error)

    /* "H2MM_C.pyx":1235
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):             # <<<<<<<<<<<<<<
 *             raise Exception("Model uninitialized with data, cannot set converged")
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
*/
  }

  /* "H2MM_C.pyx":1237
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):
 *             raise Exception("Model uninitialized with data, cannot set converged")
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise Exception("Fixed model, cannot mutate converged state")
 *         if converged:
*/
  __pyx_t_1 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1238
 *             raise Exception("Model uninitialized with data, cannot set converged")
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise Exception("Fixed model, cannot mutate converged state")             # <<<<<<<<<<<<<<
 *         if converged:
 *             self.model.conv |= CONVCODE_OUTPUT_CONVERGED
*/
    __pyx_t_6 = NULL;
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Fixed_model_cannot_mutate_conver};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1238, __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, 1238, __pyx_L1_error)

    /* "H2MM_C.pyx":1237
 *         if self.model.nphot == 0 or self.model.loglik == 0 or self.model.loglik == np.inf or np.isnan(self.model.loglik):
 *             raise Exception("Model uninitialized with data, cannot set converged")
 *         if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             raise Exception("Fixed model, cannot mutate converged state")
 *         if converged:
*/
  }

  /* "H2MM_C.pyx":1239
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise Exception("Fixed model, cannot mutate converged state")
 *         if converged:             # <<<<<<<<<<<<<<
 *             self.model.conv |= CONVCODE_OUTPUT_CONVERGED
 *         else:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_converged); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1239, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1240
 *             raise Exception("Fixed model, cannot mutate converged state")
 *         if converged:
 *             self.model.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *         else:
 *             self.model.conv &= ~(CONVCODE_OUTPUT|CONVCODE_ANYFINAL)
*/
    __pyx_v_self->model->conv = (__pyx_v_self->model->conv | CONVCODE_OUTPUT_CONVERGED);

    /* "H2MM_C.pyx":1239
 *         if self.model.conv & CONVCODE_FIXEDMODEL:
 *             raise Exception("Fixed model, cannot mutate converged state")
 *         if converged:             # <<<<<<<<<<<<<<
 *             self.model.conv |= CONVCODE_OUTPUT_CONVERGED
 *         else:
*/
    goto __pyx_L9;
  }

  /* "H2MM_C.pyx":1242
 *             self.model.conv |= CONVCODE_OUTPUT_CONVERGED
 *         else:
 *             self.model.conv &= ~(CONVCODE_OUTPUT|CONVCODE_ANYFINAL)             # <<<<<<<<<<<<<<
 * 
 *     def sort_states(self):
*/
  /*else*/ {
    __pyx_v_self->model->conv = (__pyx_v_self->model->conv & (~(CONVCODE_OUTPUT | CONVCODE_ANYFINAL)));
  }
  __pyx_L9:;

  /* "H2MM_C.pyx":1232
 *         self.model.niter = niter
 * 
 *     def set_converged(self, converged=True):             # <<<<<<<<<<<<<<
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
*/

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.set_converged", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_converged);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1244
 *             self.model.conv &= ~(CONVCODE_OUTPUT|CONVCODE_ANYFINAL)
 * 
 *     def sort_states(self):             # <<<<<<<<<<<<<<
 *         """Return model with states sorted by values in prior, and set as 'hashable'"""
 *         srt = np.argsort(self.prior)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_17sort_states(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_16sort_states, "Return model with states sorted by values in prior, and set as 'hashable'");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_17sort_states = {"sort_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_17sort_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_16sort_states};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_17sort_states(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sort_states (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("sort_states", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("sort_states", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_16sort_states(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_16sort_states(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_v_srt = NULL;
  PyObject *__pyx_v_prior = NULL;
  PyObject *__pyx_v_trans = NULL;
  PyObject *__pyx_v_obs = NULL;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_out = 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;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sort_states", 0);

  /* "H2MM_C.pyx":1246
 *     def sort_states(self):
 *         """Return model with states sorted by values in prior, and set as 'hashable'"""
 *         srt = np.argsort(self.prior)             # <<<<<<<<<<<<<<
 *         prior = self.prior[srt]
 *         trans = self.trans[srt]
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_argsort); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_srt = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1247
 *         """Return model with states sorted by values in prior, and set as 'hashable'"""
 *         srt = np.argsort(self.prior)
 *         prior = self.prior[srt]             # <<<<<<<<<<<<<<
 *         trans = self.trans[srt]
 *         trans = trans[:,srt]
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_srt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_prior = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1248
 *         srt = np.argsort(self.prior)
 *         prior = self.prior[srt]
 *         trans = self.trans[srt]             # <<<<<<<<<<<<<<
 *         trans = trans[:,srt]
 *         obs = self.obs[srt]
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_srt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_trans = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1249
 *         prior = self.prior[srt]
 *         trans = self.trans[srt]
 *         trans = trans[:,srt]             # <<<<<<<<<<<<<<
 *         obs = self.obs[srt]
 *         cdef h2mm_model out=  h2mm_model(prior, trans, obs, loglik=self.model.loglik, niter=self.model.niter, nphot=self.model.nphot)
*/
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 1249, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_srt);
  __Pyx_GIVEREF(__pyx_v_srt);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_srt) != (0)) __PYX_ERR(0, 1249, __pyx_L1_error);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_trans, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_trans, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1250
 *         trans = self.trans[srt]
 *         trans = trans[:,srt]
 *         obs = self.obs[srt]             # <<<<<<<<<<<<<<
 *         cdef h2mm_model out=  h2mm_model(prior, trans, obs, loglik=self.model.loglik, niter=self.model.niter, nphot=self.model.nphot)
 *         out.model.conv |= CONVCODE_FIXEDMODEL
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_srt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_obs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1251
 *         trans = trans[:,srt]
 *         obs = self.obs[srt]
 *         cdef h2mm_model out=  h2mm_model(prior, trans, obs, loglik=self.model.loglik, niter=self.model.niter, nphot=self.model.nphot)             # <<<<<<<<<<<<<<
 *         out.model.conv |= CONVCODE_FIXEDMODEL
 *         return out
*/
  __pyx_t_4 = NULL;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->model->loglik); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->niter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->nphot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_4, __pyx_v_prior, __pyx_v_trans, __pyx_v_obs};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_loglik, __pyx_t_3, __pyx_t_7, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1251, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_niter, __pyx_t_2, __pyx_t_7, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1251, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_nphot, __pyx_t_6, __pyx_t_7, __pyx_callargs+4, 2) < (0)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __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;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_v_out = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1252
 *         obs = self.obs[srt]
 *         cdef h2mm_model out=  h2mm_model(prior, trans, obs, loglik=self.model.loglik, niter=self.model.niter, nphot=self.model.nphot)
 *         out.model.conv |= CONVCODE_FIXEDMODEL             # <<<<<<<<<<<<<<
 *         return out
 * 
*/
  __pyx_v_out->model->conv = (__pyx_v_out->model->conv | CONVCODE_FIXEDMODEL);

  /* "H2MM_C.pyx":1253
 *         cdef h2mm_model out=  h2mm_model(prior, trans, obs, loglik=self.model.loglik, niter=self.model.niter, nphot=self.model.nphot)
 *         out.model.conv |= CONVCODE_FIXEDMODEL
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_out);
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "H2MM_C.pyx":1244
 *             self.model.conv &= ~(CONVCODE_OUTPUT|CONVCODE_ANYFINAL)
 * 
 *     def sort_states(self):             # <<<<<<<<<<<<<<
 *         """Return model with states sorted by values in prior, and set as 'hashable'"""
 *         srt = np.argsort(self.prior)
*/

  /* 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("H2MM_C.h2mm_model.sort_states", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_srt);
  __Pyx_XDECREF(__pyx_v_prior);
  __Pyx_XDECREF(__pyx_v_trans);
  __Pyx_XDECREF(__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1255
 *         return out
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, h2mm_model):
 *             return False
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_19__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_19__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_18__eq__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), ((PyObject *)__pyx_v_other));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_18__eq__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_sf = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_ot = 0;
  int __pyx_v_i;
  int __pyx_v_j;
  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;
  size_t __pyx_t_6;
  int64_t __pyx_t_7;
  int64_t __pyx_t_8;
  int __pyx_t_9;
  int64_t __pyx_t_10;
  int64_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "H2MM_C.pyx":1256
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, h2mm_model):             # <<<<<<<<<<<<<<
 *             return False
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1257
 *     def __eq__(self, other):
 *         if not isinstance(other, h2mm_model):
 *             return False             # <<<<<<<<<<<<<<
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1256
 * 
 *     def __eq__(self, other):
 *         if not isinstance(other, h2mm_model):             # <<<<<<<<<<<<<<
 *             return False
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
*/
  }

  /* "H2MM_C.pyx":1258
 *         if not isinstance(other, h2mm_model):
 *             return False
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()             # <<<<<<<<<<<<<<
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()
 *         if sf.model.nstate != ot.model.nstate or sf.model.ndet != ot.model.ndet:
*/
  __pyx_t_2 = (__pyx_v_self->model->conv == 8);
  if (__pyx_t_2) {
    __Pyx_INCREF((PyObject *)__pyx_v_self);
    __pyx_t_3 = ((PyObject *)__pyx_v_self);
  } else {
    __pyx_t_5 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sort_states, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1258, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_v_sf = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1259
 *             return False
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()             # <<<<<<<<<<<<<<
 *         if sf.model.nstate != ot.model.nstate or sf.model.ndet != ot.model.ndet:
 *             return False
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_conv_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_8, 8, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1259, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_other);
    __pyx_t_3 = __pyx_v_other;
  } else {
    __pyx_t_5 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sort_states, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1259, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_v_ot = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1260
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()
 *         if sf.model.nstate != ot.model.nstate or sf.model.ndet != ot.model.ndet:             # <<<<<<<<<<<<<<
 *             return False
 *         cdef int i
*/
  __pyx_t_1 = (__pyx_v_sf->model->nstate != __pyx_v_ot->model->nstate);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_sf->model->ndet != __pyx_v_ot->model->ndet);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1261
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()
 *         if sf.model.nstate != ot.model.nstate or sf.model.ndet != ot.model.ndet:
 *             return False             # <<<<<<<<<<<<<<
 *         cdef int i
 *         cdef int j
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "H2MM_C.pyx":1260
 *         cdef h2mm_model sf = self if self.model.conv == 8 else self.sort_states()
 *         cdef h2mm_model ot = other if other.conv_code == 8 else other.sort_states()
 *         if sf.model.nstate != ot.model.nstate or sf.model.ndet != ot.model.ndet:             # <<<<<<<<<<<<<<
 *             return False
 *         cdef int i
*/
  }

  /* "H2MM_C.pyx":1264
 *         cdef int i
 *         cdef int j
 *         for i in range(sf.model.nstate):             # <<<<<<<<<<<<<<
 *             if sf.model.prior[i] != ot.model.prior[i]:
 *                 return False
*/
  __pyx_t_7 = __pyx_v_sf->model->nstate;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "H2MM_C.pyx":1265
 *         cdef int j
 *         for i in range(sf.model.nstate):
 *             if sf.model.prior[i] != ot.model.prior[i]:             # <<<<<<<<<<<<<<
 *                 return False
 *             for j in range(sf.model.nstate):
*/
    __pyx_t_2 = ((__pyx_v_sf->model->prior[__pyx_v_i]) != (__pyx_v_ot->model->prior[__pyx_v_i]));
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":1266
 *         for i in range(sf.model.nstate):
 *             if sf.model.prior[i] != ot.model.prior[i]:
 *                 return False             # <<<<<<<<<<<<<<
 *             for j in range(sf.model.nstate):
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "H2MM_C.pyx":1265
 *         cdef int j
 *         for i in range(sf.model.nstate):
 *             if sf.model.prior[i] != ot.model.prior[i]:             # <<<<<<<<<<<<<<
 *                 return False
 *             for j in range(sf.model.nstate):
*/
    }

    /* "H2MM_C.pyx":1267
 *             if sf.model.prior[i] != ot.model.prior[i]:
 *                 return False
 *             for j in range(sf.model.nstate):             # <<<<<<<<<<<<<<
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:
 *                     return False
*/
    __pyx_t_10 = __pyx_v_sf->model->nstate;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_j = __pyx_t_12;

      /* "H2MM_C.pyx":1268
 *                 return False
 *             for j in range(sf.model.nstate):
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:             # <<<<<<<<<<<<<<
 *                     return False
 *             for j in range(sf.model.ndet):
*/
      __pyx_t_2 = ((__pyx_v_sf->model->trans[((__pyx_v_i * __pyx_v_sf->model->nstate) + __pyx_v_j)]) != (__pyx_v_ot->model->trans[((__pyx_v_i * __pyx_v_sf->model->nstate) + __pyx_v_j)]));
      if (__pyx_t_2) {

        /* "H2MM_C.pyx":1269
 *             for j in range(sf.model.nstate):
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:
 *                     return False             # <<<<<<<<<<<<<<
 *             for j in range(sf.model.ndet):
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;

        /* "H2MM_C.pyx":1268
 *                 return False
 *             for j in range(sf.model.nstate):
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:             # <<<<<<<<<<<<<<
 *                     return False
 *             for j in range(sf.model.ndet):
*/
      }
    }

    /* "H2MM_C.pyx":1270
 *                 if sf.model.trans[i*sf.model.nstate+j] != ot.model.trans[i*sf.model.nstate+j]:
 *                     return False
 *             for j in range(sf.model.ndet):             # <<<<<<<<<<<<<<
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:
 *                     return False
*/
    __pyx_t_10 = __pyx_v_sf->model->ndet;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_j = __pyx_t_12;

      /* "H2MM_C.pyx":1271
 *                     return False
 *             for j in range(sf.model.ndet):
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:             # <<<<<<<<<<<<<<
 *                     return False
 *         return True
*/
      __pyx_t_2 = ((__pyx_v_sf->model->obs[((__pyx_v_j * __pyx_v_sf->model->nstate) + __pyx_v_i)]) != (__pyx_v_sf->model->obs[((__pyx_v_j * __pyx_v_sf->model->nstate) + __pyx_v_i)]));
      if (__pyx_t_2) {

        /* "H2MM_C.pyx":1272
 *             for j in range(sf.model.ndet):
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:
 *                     return False             # <<<<<<<<<<<<<<
 *         return True
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;

        /* "H2MM_C.pyx":1271
 *                     return False
 *             for j in range(sf.model.ndet):
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:             # <<<<<<<<<<<<<<
 *                     return False
 *         return True
*/
      }
    }
  }

  /* "H2MM_C.pyx":1273
 *                 if sf.model.obs[j*sf.model.nstate+i] != sf.model.obs[j*sf.model.nstate+i]:
 *                     return False
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def normalize(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1255
 *         return out
 * 
 *     def __eq__(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, h2mm_model):
 *             return False
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sf);
  __Pyx_XDECREF((PyObject *)__pyx_v_ot);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1275
 *         return True
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_21normalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_20normalize, "For internal use, ensures all model arrays are row stochastic");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_21normalize = {"normalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_21normalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_20normalize};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_21normalize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("normalize", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("normalize", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_20normalize(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_20normalize(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "H2MM_C.pyx":1277
 *     def normalize(self):
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             h2mm_normalize(self.model)
 * 
*/
  __pyx_t_1 = (!((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0));
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1278
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:
 *             h2mm_normalize(self.model)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
    h2mm_normalize(__pyx_v_self->model);

    /* "H2MM_C.pyx":1277
 *     def normalize(self):
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *             h2mm_normalize(self.model)
 * 
*/
  }

  /* "H2MM_C.pyx":1275
 *         return True
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1280
 *             h2mm_normalize(self.model)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """ Make a duplicate model in new memory"""
 *         return model_copy_from_ptr(self.model)
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_23copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_22copy, " Make a duplicate model in new memory");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_23copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_23copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_22copy};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_23copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_22copy(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_22copy(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "H2MM_C.pyx":1282
 *     def copy(self):
 *         """ Make a duplicate model in new memory"""
 *         return model_copy_from_ptr(self.model)             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_self->model)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1280
 *             h2mm_normalize(self.model)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """ Make a duplicate model in new memory"""
 *         return model_copy_from_ptr(self.model)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1284
 *         return model_copy_from_ptr(self.model)
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return self.copy()
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_25__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_25__copy__ = {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_25__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_25__copy__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__copy__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__copy__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_24__copy__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_24__copy__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "H2MM_C.pyx":1285
 * 
 *     def __copy__(self):
 *         return self.copy()             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1284
 *         return model_copy_from_ptr(self.model)
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return self.copy()
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1287
 *         return self.copy()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
*/

/* Python wrapper */
static Py_hash_t __pyx_pw_6H2MM_C_10h2mm_model_27__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_6H2MM_C_10h2mm_model_27__hash__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_26__hash__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":1290
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))             # <<<<<<<<<<<<<<
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
*/

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_5_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1290, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_10h2mm_model_8__hash___2generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_hash___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__hash__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1290, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1290, __pyx_L1_error) }
    __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->model->prior[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1290, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___5generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":1291
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))             # <<<<<<<<<<<<<<
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
 *         return hash(p+t+o)
*/

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___3genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_6_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1291, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_10h2mm_model_8__hash___5generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_hash___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__hash__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___5generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1291, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1291, __pyx_L1_error) }
    __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->model->trans[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1291, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___8generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":1292
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))             # <<<<<<<<<<<<<<
 *         return hash(p+t+o)
 * 
*/

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_8__hash___6genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_7_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1292, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_10h2mm_model_8__hash___8generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_hash___locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__hash__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___8generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 1292, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1292, __pyx_L1_error) }
    __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->model->obs[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1292, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1287
 *         return self.copy()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
*/

static Py_hash_t __pyx_pf_6H2MM_C_10h2mm_model_26__hash__(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *__pyx_cur_scope;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_o = NULL;
  PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___2generator3 = 0;
  PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___5generator4 = 0;
  PyObject *__pyx_gb_6H2MM_C_10h2mm_model_8__hash___8generator5 = 0;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  Py_hash_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_4___hash__(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1287, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__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);

  /* "H2MM_C.pyx":1288
 * 
 *     def __hash__(self):
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):             # <<<<<<<<<<<<<<
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
*/
  __pyx_t_1 = (!((__pyx_cur_scope->__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0));
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1289
 *     def __hash__(self):
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")             # <<<<<<<<<<<<<<
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unhashable_model_must_sort_state};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __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(0, 1289, __pyx_L1_error)

    /* "H2MM_C.pyx":1288
 * 
 *     def __hash__(self):
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):             # <<<<<<<<<<<<<<
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
*/
  }

  /* "H2MM_C.pyx":1290
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))             # <<<<<<<<<<<<<<
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
*/
  __pyx_t_2 = __pyx_pf_6H2MM_C_10h2mm_model_8__hash___genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_self->model->nstate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); 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_v_p = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1291
 *             raise TypeError("unhashable model, must sort_states first")
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))             # <<<<<<<<<<<<<<
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
 *         return hash(p+t+o)
*/
  __pyx_t_3 = __pyx_pf_6H2MM_C_10h2mm_model_8__hash___3genexpr(((PyObject*)__pyx_cur_scope), __Pyx_pow_int64_t(__pyx_cur_scope->__pyx_v_self->model->nstate, 2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_t = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":1292
 *         p = tuple(self.model.prior[i] for i in range(self.model.nstate))
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))             # <<<<<<<<<<<<<<
 *         return hash(p+t+o)
 * 
*/
  __pyx_t_2 = __pyx_pf_6H2MM_C_10h2mm_model_8__hash___6genexpr(((PyObject*)__pyx_cur_scope), (__pyx_cur_scope->__pyx_v_self->model->nstate * __pyx_cur_scope->__pyx_v_self->model->ndet)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_o = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":1293
 *         t = tuple(self.model.trans[i] for i in range(self.model.nstate**2))
 *         o = tuple(self.model.obs[i] for i in range(self.model.nstate*self.model.ndet))
 *         return hash(p+t+o)             # <<<<<<<<<<<<<<
 * 
 *     def optimize(self, indexes, times, max_iter=None,
*/
  __pyx_t_3 = PyNumber_Add(__pyx_v_p, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_o); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_hash_t)-1))) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1287
 *         return self.copy()
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         if not (self.model.conv & CONVCODE_FIXEDMODEL):
 *             raise TypeError("unhashable model, must sort_states first")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_10h2mm_model_8__hash___2generator3);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_10h2mm_model_8__hash___5generator4);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_10h2mm_model_8__hash___8generator5);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1295
 *         return hash(p+t+o)
 * 
 *     def optimize(self, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_29optimize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_28optimize, "\n        Optimize the H2MM model for the given set of data.\n        \n        .. note::\n            \n            This method calls the :func:`EM_H2MM_C` function.\n    \n        Parameters\n        ----------\n        model : h2mm_model\n            An initial guess for the H2MM model, just give a general guess, the algorithm\n            will optimize, and generally the algorithm will converge even when the\n            initial guess is very far off\n        \n        indexes : list of NUMPY 1D int arrays\n            A list of the arrival indexes for each photon in each burst.\n            Each element of the list (a numpy array) corresponds to a burst, and\n            each element of the array is a singular photon.\n            The indexes list must maintain  1-to-1 correspondence to the times list\n        \n        times : list of NUMPY 1D int arrays\n            A list of the arrival times for each photon in each burst\n            Each element of the list (a numpy array) corresponds to a burst, and\n            each element of the array is a singular photon.\n            The times list must maintain  1-to-1 correspondence to the indexes list\n        \n        max_iter : int or None, optional\n            the maximum number of iterations to conduct before returning the current\n            :class:`h2mm_model`, if None (default) use value from optimization_limits. \n            Default is None\n        \n        bounds_func : str, callable or None, optional\n            function to be evaluated after every iteration of the H2MM algorithm\n            its primary function is to place bounds on :class:`h2mm_model`\n            \n            .. note:: \n                \n                bounding the :class:`h2mm_model` causes the guarantee of improvement on each\n                iteration until convergence to no longer apply, therefore the results are\n                no longer guaranteed to be the optimal model within bounds.\n            \n            Defa""ult is None\n            \n            Acceptable inputs\\:\n                \n                C level limits: 'minmax' 'revert' 'revert_old'\n                    prevents the model from having values outside of those defined\n                    by :class:`h2mm_limits` class given to bounds, if an iteration produces\n                    a new model for loglik calculation in the next iteration with \n                    values that are out of those bounds, the 3 function differ in\n                    how they correct the model when a new model has a value out of\n                    bounds, they are as follows:\n                    \n                    **'minmax'**\\: \n                        \n                        sets the out of bounds value to the min or max value\n                        closer to the original value\n                    \n                    **'revert'**\\: \n                        \n                        sets the out of bounds value to the value from the last\n                        model for which the loglik was calculated\n                    \n                    **'revert_old'**\\: \n                        \n                        similar to revert, but instead reverts to the value\n                        from the model one before the last calculated model\n                \n                Callable: python function that takes 4 inputs and returns :class:`h2mm_model` object\n                    .. warning:: \n                    \n                        The user takes full responsibility for errors in the results.\n                    \n                    must be a python function that takes the signature\n                    ``bounds_func(new, current, old, *bounds, **bounds_kwargs)``\n                    ``new``, ``current``, and ``old`` are :class:`h2mm_model` objects, \n                    with ``new`` being the model whose loglik has yet to be calculated\n                    resulting from the latest iteration, ``current""`` being the model\n                    whose loglik was just calculated, and ``old`` being the result\n                    of the previous iteration. Be one of the following: :class:`h2mm_model`,\n                    :code:`bool`, :code:`int`, or a 2-tuple of :class:`h2mm_model` and\n                    either :code:`bool` or :code:`int`. In all cases, :code:`int` values\n                    must 0, 1, or 2. :class:`h2mm_model` objects will be used as the\n                    next model to compute the loglik of. :class:`bool` and :code:`int`\n                    objects determine if optimization will continue.\n                    If :code:`True`, then optimization will continue, if :code:`False`,\n                    then optimization will cease, and the ``old`` model will be returned\n                    as the ideal model. If :code:`0`, then optimization will continue,\n                    if :code:`1`, then return ``old`` model as optimal model, if \n                    :code:`2`, then return ``current`` model as optimizal model.\n        \n        bounds : h2mm_limits, tuple, or None, optional\n            Argument(s) pass to bounds_func function. If bounds_func is a string,\n            then bounds **must** be specified, and **must** be a :class:`h2mm_limits`\n            object.\n            \n            If ``bounds_func`` is callable, and bounds is not None or a tuple, bounds\n            is passed as the 4th argument to bounds_func, ie \n            :code:`bounds_func(new, current, old, bounds, **bounds_kwargs)`, \n            if bounds is a tuple, then passed as \\*args, \n            ie :code:`bounds_func(new, current, old, *bounds, **bounds_kwargs)`\n            Default is None\n        \n        bounds_kwargs : dict, or None, optional\n            Only used when ``bounds_func`` is callable, passed as \\*\\*kwargs to\n            ``bounds_func`` ie ie :code:`bounds_func(new, current, old, *bounds, **bounds_kwargs)`.\n            If :code:`None`\n      ""      The default is None\n        \n        print_func : None, str or callable, optional\n            Specifies how the results of each iteration will be displayed, several \n            strings specify built-in functions. Default is 'iter'\n            Acceptable inputs: str, Callable or None\n                \n                **None**\\:\n                \n                    causes no printout anywhere of the results of each iteration\n                    \n                Str: 'all', 'diff', 'comp', 'iter'\n                \n                    **'all'**\\: \n                        \n                        prints out the full :class:`h2mm_model` just evaluated, this is very\n                        verbose, and not generally recommended unless you really want\n                        to know every step of the optimization\n                    \n                    **'diff'**\\: \n                        \n                        prints the loglik of the iteration, and the difference \n                        between the current and old loglik, this is the same format\n                        that the 'console' option used, the difference is whether the\n                        print function used is the C printf, or Cython print, which \n                        changes the destination from the console to the Jupyter notebook\n                        \n                    **'diff_time'**\\: \n                        \n                        same as 'diff' but adds the time of the last iteration\n                        and the total optimization time\n                        \n                    **'comp'**\\: \n                        \n                        prints out the current and old loglik\n                    \n                    **'comp_time'**\\: \n                        \n                        same as 'comp'  but with times, like in 'diff_time'\n                    \n                    **'iter'**\\: \n                        \n              ""          prints out only the current iteration\n                \n                Callable: user defined function\n                    A python function for printing out a custom output, the function must\n                    accept the input of \n                    (int, :class:`h2mm_model`, :class:`h2mm_model`, :class:`h2mm_model`, float, float)\n                    as the function will be handed ``(niter, new, current, old, iter_time, total_time)``\n                    from a special Cython wrapper. iter_time and total_time are the times\n                    of the latest iteration and total time of optimization, respectively.\n                    Note that iter_time and total_time are based on the fast, but\n                    inaccurate C clock function.\n        \n        print_freq: int, optional\n            Number of iterations between updating display. Default is 1\n        \n        print_args : tuple or None, optional\n            Only used when ``print_func`` is callable. Passed as final argument to\n            ``print_func`` if not :code:`None` or :code:`tuple`, ie\n            ``print_func(niter, new, current, old, iter_time, total_time, print_args, **print_kwargs)``\n            if :code:`tuple`, then passed as \\*args, ie\n            ``print_func(niter, new, current, old, iter_time, total_time, *print_args, **print_kwargs)``\n            If :code:`None`, then ignored. The default is :code:`None`.\n        \n        print_kwargs: dict or None, optional\n            Only used when ``print_func`` is callable, passed as \\*\\*kwargs to ``print_func``\n            ie ``print_func(niter, new, current, old, iter_time, time_total, *print_args, **print_kwargs)``.\n            If :code:`None`, then ignored. The default is :code:`None`.\n        \n        print_stream : OutStream, optional\n            Typically OutStream, the stream where the output will be displayed.\n            Passed as first argument to print_formatter, if :code:`None`, then use""\n            stream specified in optimization_limites. Default is None\n        \n        print_formatter : Printer, optional\n            Class object (usually subclass of :class:`Printer`) that formats\n            text for output to ``print_stream``. Instance of ``print_formatter`` class\n            will be created with \n            ``fmtr = print_formatter(print_stream, *print_fmt_args, **print_fmt_kwargs)``\n            to use for printing. Each print will call ``fmtr.update(text)`` where\n            ``text`` is output of ``print_func`` call. At end of optimization,\n            ``fmtr.close()`` will be called. If ``print_formatter`` is :code:`None`\n            then will use the formatter specified in ``optimization_limits``.\n            The default is :code:`None`.\n        \n        print_fmt_args : tuple, Any or None, optional\n            Additional arguments passed to ``print_formatter``, if None, ignored,\n            if not tuple, then treated as single argument. The default is :code:`None`.\n        \n        print_fmt_kwargs : dict or None, optional\n            Additional  keyword arguments passed to ``print_formatter``, if None, ignored.\n            The default is :code:`None`.\n            \n        max_time : float or None, optional\n            The maximum time (in seconds) before returning current model\n            **NOTE** this uses the inaccurate C clock, which is often longer than the\n            actual time. If :code:`None` (default) use value from optimization_limits. \n            Default is :code:`None`.\n        \n        converged_min : float or None, optional\n            The difference between new and current :class:`h2mm_model` to consider the model\n            converged, the default setting is close to floating point error, it is\n            recommended to only increase the size. If None (default) use value from \n            optimization_limits. Default is None\n        num_cores : int or None, optional\n            the n""umber of C threads (which ignore the gil, thus functioning more\n            like python processes), to use when calculating iterations.\n            \n            .. note:: \n                \n                optimization_limtis sets this to be `os.cpu_count() // 2`, as most machines\n                are multithreaded. Because os.cpu_count() returns the number of threads,\n                not necessarily the number of cpus. For most machines, being multithreaded,\n                this actually returns twice the number of physical cores. Hence the default\n                to set at `os.cpu_count() // 2`. If your machine is not multithreaded, it\n                is best to set `optimization_limits.num_cores = os.cpu_count()`\n                \n            If None (default) use value from optimization_limits. \n            Default is None\n        reset_niter : bool, optional\n            Tells the algorithm whether or not to reset the iteration counter of the\n            model, True means that even if the model was previously optimized, the \n            iteration counter will start at 0, so calling :func:`EM_H2MM_C` on a model that\n            reached its maximum iteration number will proceed another max_iter \n            iterations. On the other hand, if set to False, then the new iterations\n            will be added to the old. If set to False, you likely will have to increase\n            max_iter, as the optimization will count the previous iterations towards\n            the max_iter threshold.\n            Default is False\n        \n        gamma : bool, optional\n            Whether or not to return the gamma array, which gives the probabilities\n            of each photon being in a given state.\n            \n            .. note::\n                \n                If opt_array is True, then only the gamma arrays for the ideal\n                model are returned.\n            \n            Default is False\n        \n        opt_array : bool | int, opt""ional\n            Defines how the result is returned, if False (default) (or 0) then return only\n            the ideal model, if True (or 1), then a numpy array is returned containing all\n            models during the optimization, with the last model being the optimial model.\n            If 2 then return all models, including models after converged.\n            Default is False\n        \n        inplace : bool, optional\n            Whether or not to store the optimized model in the current model object.\n            \n            .. note::\n                \n                When opt_array is True, then the ideal model is copied into the\n                current model object, while the return value contains all models\n                \n            Default is False\n        \n        Returns\n        -------\n        out : h2mm_model\n            The optimized :class:`h2mm_model`. will return after one of the following conditions\n            are met: model has converged (according to converged_min, default 1e-14),\n            maximum iterations reached, maximum time has passed, or an error has occurred\n            (usually the result of a nan from a floating point precision error)\n        gamma : list, tuple or np.ndarray (optional)\n            If gamma = True, this variable is returned, which contains (as numpy arrays)\n            the probabilities of each photon to be in each state, for each burst.\n            The arrays are returned in the same order and type as the input indexes,\n            individual data points organized as [photon, state] within each data\n            sequence.\n            \n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_29optimize = {"optimize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_29optimize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_28optimize};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_29optimize(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_max_iter = 0;
  PyObject *__pyx_v_bounds_func = 0;
  PyObject *__pyx_v_bounds = 0;
  PyObject *__pyx_v_bounds_kwargs = 0;
  PyObject *__pyx_v_print_func = 0;
  PyObject *__pyx_v_print_freq = 0;
  PyObject *__pyx_v_print_args = 0;
  PyObject *__pyx_v_print_kwargs = 0;
  PyObject *__pyx_v_print_stream = 0;
  PyObject *__pyx_v_print_formatter = 0;
  PyObject *__pyx_v_print_fmt_args = 0;
  PyObject *__pyx_v_print_fmt_kwargs = 0;
  PyObject *__pyx_v_max_time = 0;
  PyObject *__pyx_v_converged_min = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_reset_niter = 0;
  PyObject *__pyx_v_gamma = 0;
  PyObject *__pyx_v_opt_array = 0;
  PyObject *__pyx_v_inplace = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("optimize (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_max_iter,&__pyx_mstate_global->__pyx_n_u_bounds_func,&__pyx_mstate_global->__pyx_n_u_bounds,&__pyx_mstate_global->__pyx_n_u_bounds_kwargs,&__pyx_mstate_global->__pyx_n_u_print_func,&__pyx_mstate_global->__pyx_n_u_print_freq,&__pyx_mstate_global->__pyx_n_u_print_args,&__pyx_mstate_global->__pyx_n_u_print_kwargs,&__pyx_mstate_global->__pyx_n_u_print_stream,&__pyx_mstate_global->__pyx_n_u_print_formatter,&__pyx_mstate_global->__pyx_n_u_print_fmt_args,&__pyx_mstate_global->__pyx_n_u_print_fmt_kwargs,&__pyx_mstate_global->__pyx_n_u_max_time,&__pyx_mstate_global->__pyx_n_u_converged_min,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_reset_niter,&__pyx_mstate_global->__pyx_n_u_gamma,&__pyx_mstate_global->__pyx_n_u_opt_array,&__pyx_mstate_global->__pyx_n_u_inplace,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1295, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 21:
        values[20] = __Pyx_ArgRef_FASTCALL(__pyx_args, 20);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[20])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 20:
        values[19] = __Pyx_ArgRef_FASTCALL(__pyx_args, 19);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[19])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 19:
        values[18] = __Pyx_ArgRef_FASTCALL(__pyx_args, 18);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[18])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 18:
        values[17] = __Pyx_ArgRef_FASTCALL(__pyx_args, 17);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[17])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 17:
        values[16] = __Pyx_ArgRef_FASTCALL(__pyx_args, 16);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[16])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 16:
        values[15] = __Pyx_ArgRef_FASTCALL(__pyx_args, 15);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[15])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 15:
        values[14] = __Pyx_ArgRef_FASTCALL(__pyx_args, 14);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[14])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 14:
        values[13] = __Pyx_ArgRef_FASTCALL(__pyx_args, 13);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[13])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 13:
        values[12] = __Pyx_ArgRef_FASTCALL(__pyx_args, 12);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[12])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 12:
        values[11] = __Pyx_ArgRef_FASTCALL(__pyx_args, 11);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[11])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "optimize", 0) < (0)) __PYX_ERR(0, 1295, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1296
 * 
 *     def optimize(self, indexes, times, max_iter=None,
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,             # <<<<<<<<<<<<<<
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_iter));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));

      /* "H2MM_C.pyx":1297
 *     def optimize(self, indexes, times, max_iter=None,
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,             # <<<<<<<<<<<<<<
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1298
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,             # <<<<<<<<<<<<<<
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1299
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,             # <<<<<<<<<<<<<<
 *                   max_time=np.inf, converged_min=None, num_cores=None,
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[14]) values[14] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__21);

      /* "H2MM_C.pyx":1300
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
 *         """
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1301
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):             # <<<<<<<<<<<<<<
 *         """
 *         Optimize the H2MM model for the given set of data.
*/
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[18]) values[18] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[19]) values[19] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[20]) values[20] = __Pyx_NewRef(((PyObject *)Py_False));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("optimize", 0, 2, 21, i); __PYX_ERR(0, 1295, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 21:
        values[20] = __Pyx_ArgRef_FASTCALL(__pyx_args, 20);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[20])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 20:
        values[19] = __Pyx_ArgRef_FASTCALL(__pyx_args, 19);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[19])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 19:
        values[18] = __Pyx_ArgRef_FASTCALL(__pyx_args, 18);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[18])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 18:
        values[17] = __Pyx_ArgRef_FASTCALL(__pyx_args, 17);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[17])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 17:
        values[16] = __Pyx_ArgRef_FASTCALL(__pyx_args, 16);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[16])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 16:
        values[15] = __Pyx_ArgRef_FASTCALL(__pyx_args, 15);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[15])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 15:
        values[14] = __Pyx_ArgRef_FASTCALL(__pyx_args, 14);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[14])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 14:
        values[13] = __Pyx_ArgRef_FASTCALL(__pyx_args, 13);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[13])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 13:
        values[12] = __Pyx_ArgRef_FASTCALL(__pyx_args, 12);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[12])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 12:
        values[11] = __Pyx_ArgRef_FASTCALL(__pyx_args, 11);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[11])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1295, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1295, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1295, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "H2MM_C.pyx":1295
 *         return hash(p+t+o)
 * 
 *     def optimize(self, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1296
 * 
 *     def optimize(self, indexes, times, max_iter=None,
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,             # <<<<<<<<<<<<<<
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_iter));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));

      /* "H2MM_C.pyx":1297
 *     def optimize(self, indexes, times, max_iter=None,
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,             # <<<<<<<<<<<<<<
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
*/
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1298
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,             # <<<<<<<<<<<<<<
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,
*/
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1299
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,             # <<<<<<<<<<<<<<
 *                   max_time=np.inf, converged_min=None, num_cores=None,
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
*/
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[14]) values[14] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__21);

      /* "H2MM_C.pyx":1300
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
 *         """
*/
      if (!values[15]) values[15] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1301
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):             # <<<<<<<<<<<<<<
 *         """
 *         Optimize the H2MM model for the given set of data.
*/
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_True));
      if (!values[18]) values[18] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[19]) values[19] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[20]) values[20] = __Pyx_NewRef(((PyObject *)Py_False));
    }
    __pyx_v_indexes = values[0];
    __pyx_v_times = values[1];
    __pyx_v_max_iter = values[2];
    __pyx_v_bounds_func = values[3];
    __pyx_v_bounds = values[4];
    __pyx_v_bounds_kwargs = values[5];
    __pyx_v_print_func = values[6];
    __pyx_v_print_freq = values[7];
    __pyx_v_print_args = values[8];
    __pyx_v_print_kwargs = values[9];
    __pyx_v_print_stream = values[10];
    __pyx_v_print_formatter = values[11];
    __pyx_v_print_fmt_args = values[12];
    __pyx_v_print_fmt_kwargs = values[13];
    __pyx_v_max_time = values[14];
    __pyx_v_converged_min = values[15];
    __pyx_v_num_cores = values[16];
    __pyx_v_reset_niter = values[17];
    __pyx_v_gamma = values[18];
    __pyx_v_opt_array = values[19];
    __pyx_v_inplace = values[20];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("optimize", 0, 2, 21, __pyx_nargs); __PYX_ERR(0, 1295, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_28optimize(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v_indexes, __pyx_v_times, __pyx_v_max_iter, __pyx_v_bounds_func, __pyx_v_bounds, __pyx_v_bounds_kwargs, __pyx_v_print_func, __pyx_v_print_freq, __pyx_v_print_args, __pyx_v_print_kwargs, __pyx_v_print_stream, __pyx_v_print_formatter, __pyx_v_print_fmt_args, __pyx_v_print_fmt_kwargs, __pyx_v_max_time, __pyx_v_converged_min, __pyx_v_num_cores, __pyx_v_reset_niter, __pyx_v_gamma, __pyx_v_opt_array, __pyx_v_inplace);

  /* "H2MM_C.pyx":1295
 *         return hash(p+t+o)
 * 
 *     def optimize(self, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_28optimize(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_bounds_func, PyObject *__pyx_v_bounds, PyObject *__pyx_v_bounds_kwargs, PyObject *__pyx_v_print_func, PyObject *__pyx_v_print_freq, PyObject *__pyx_v_print_args, PyObject *__pyx_v_print_kwargs, PyObject *__pyx_v_print_stream, PyObject *__pyx_v_print_formatter, PyObject *__pyx_v_print_fmt_args, PyObject *__pyx_v_print_fmt_kwargs, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_reset_niter, PyObject *__pyx_v_gamma, PyObject *__pyx_v_opt_array, PyObject *__pyx_v_inplace) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_out_model = 0;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_out_arr = NULL;
  PyObject *__pyx_v_i = 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;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("optimize", 0);
  __Pyx_INCREF(__pyx_v_max_iter);
  __Pyx_INCREF(__pyx_v_gamma);

  /* "H2MM_C.pyx":1583
 * 
 *         """
 *         if self.model.conv & CONVCODE_FIXEDMODEL and inplace:             # <<<<<<<<<<<<<<
 *             raise TypeError("cannot inpnlace optimize fixed hashable model")
 *         cdef h2mm_model out_model
*/
  __pyx_t_2 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_inplace); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1583, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1584
 *         """
 *         if self.model.conv & CONVCODE_FIXEDMODEL and inplace:
 *             raise TypeError("cannot inpnlace optimize fixed hashable model")             # <<<<<<<<<<<<<<
 *         cdef h2mm_model out_model
 *         if max_iter is None:
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_cannot_inpnlace_optimize_fixed_h};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __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(0, 1584, __pyx_L1_error)

    /* "H2MM_C.pyx":1583
 * 
 *         """
 *         if self.model.conv & CONVCODE_FIXEDMODEL and inplace:             # <<<<<<<<<<<<<<
 *             raise TypeError("cannot inpnlace optimize fixed hashable model")
 *         cdef h2mm_model out_model
*/
  }

  /* "H2MM_C.pyx":1586
 *             raise TypeError("cannot inpnlace optimize fixed hashable model")
 *         cdef h2mm_model out_model
 *         if max_iter is None:             # <<<<<<<<<<<<<<
 *             max_iter = optimization_limits.max_iter
 *         if self.model.conv == 4 and self.model.niter >= max_iter:
*/
  __pyx_t_1 = (__pyx_v_max_iter == Py_None);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1587
 *         cdef h2mm_model out_model
 *         if max_iter is None:
 *             max_iter = optimization_limits.max_iter             # <<<<<<<<<<<<<<
 *         if self.model.conv == 4 and self.model.niter >= max_iter:
 *             max_iter = self.model.niter + max_iter
*/
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_max_iter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_max_iter, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1586
 *             raise TypeError("cannot inpnlace optimize fixed hashable model")
 *         cdef h2mm_model out_model
 *         if max_iter is None:             # <<<<<<<<<<<<<<
 *             max_iter = optimization_limits.max_iter
 *         if self.model.conv == 4 and self.model.niter >= max_iter:
*/
  }

  /* "H2MM_C.pyx":1588
 *         if max_iter is None:
 *             max_iter = optimization_limits.max_iter
 *         if self.model.conv == 4 and self.model.niter >= max_iter:             # <<<<<<<<<<<<<<
 *             max_iter = self.model.niter + max_iter
 *         out = EM_H2MM_C(self, indexes, times, max_iter=max_iter,
*/
  __pyx_t_2 = (__pyx_v_self->model->conv == 4);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->niter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_v_max_iter, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1589
 *             max_iter = optimization_limits.max_iter
 *         if self.model.conv == 4 and self.model.niter >= max_iter:
 *             max_iter = self.model.niter + max_iter             # <<<<<<<<<<<<<<
 *         out = EM_H2MM_C(self, indexes, times, max_iter=max_iter,
 *                       bounds_func=bounds_func, bounds=bounds, bounds_kwargs=bounds_kwargs,
*/
    __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_self->model->niter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_max_iter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_max_iter, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1588
 *         if max_iter is None:
 *             max_iter = optimization_limits.max_iter
 *         if self.model.conv == 4 and self.model.niter >= max_iter:             # <<<<<<<<<<<<<<
 *             max_iter = self.model.niter + max_iter
 *         out = EM_H2MM_C(self, indexes, times, max_iter=max_iter,
*/
  }

  /* "H2MM_C.pyx":1590
 *         if self.model.conv == 4 and self.model.niter >= max_iter:
 *             max_iter = self.model.niter + max_iter
 *         out = EM_H2MM_C(self, indexes, times, max_iter=max_iter,             # <<<<<<<<<<<<<<
 *                       bounds_func=bounds_func, bounds=bounds, bounds_kwargs=bounds_kwargs,
 *                       print_func=print_func, print_freq=print_freq, print_args=print_args, print_kwargs=print_kwargs,
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_EM_H2MM_C); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "H2MM_C.pyx":1596
 *                       print_fmt_args=print_fmt_args, print_fmt_kwargs=print_fmt_kwargs,
 *                       max_time=max_time, converged_min=converged_min, num_cores=num_cores,
 *                       reset_niter=reset_niter, gamma=gamma, opt_array=opt_array)             # <<<<<<<<<<<<<<
 *         if inplace:
 *             # separate the models from gamma
*/
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 18 : 0)] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_indexes, __pyx_v_times};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_iter, __pyx_v_max_iter, __pyx_t_7, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bounds_func, __pyx_v_bounds_func, __pyx_t_7, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bounds, __pyx_v_bounds, __pyx_t_7, __pyx_callargs+4, 2) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_bounds_kwargs, __pyx_v_bounds_kwargs, __pyx_t_7, __pyx_callargs+4, 3) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_func, __pyx_v_print_func, __pyx_t_7, __pyx_callargs+4, 4) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_freq, __pyx_v_print_freq, __pyx_t_7, __pyx_callargs+4, 5) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_args, __pyx_v_print_args, __pyx_t_7, __pyx_callargs+4, 6) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_kwargs, __pyx_v_print_kwargs, __pyx_t_7, __pyx_callargs+4, 7) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_stream, __pyx_v_print_stream, __pyx_t_7, __pyx_callargs+4, 8) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_formatter, __pyx_v_print_formatter, __pyx_t_7, __pyx_callargs+4, 9) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_fmt_args, __pyx_v_print_fmt_args, __pyx_t_7, __pyx_callargs+4, 10) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_print_fmt_kwargs, __pyx_v_print_fmt_kwargs, __pyx_t_7, __pyx_callargs+4, 11) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_time, __pyx_v_max_time, __pyx_t_7, __pyx_callargs+4, 12) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_converged_min, __pyx_v_converged_min, __pyx_t_7, __pyx_callargs+4, 13) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num_cores, __pyx_v_num_cores, __pyx_t_7, __pyx_callargs+4, 14) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_reset_niter, __pyx_v_reset_niter, __pyx_t_7, __pyx_callargs+4, 15) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_gamma, __pyx_v_gamma, __pyx_t_7, __pyx_callargs+4, 16) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_opt_array, __pyx_v_opt_array, __pyx_t_7, __pyx_callargs+4, 17) < (0)) __PYX_ERR(0, 1590, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_v_out = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1597
 *                       max_time=max_time, converged_min=converged_min, num_cores=num_cores,
 *                       reset_niter=reset_niter, gamma=gamma, opt_array=opt_array)
 *         if inplace:             # <<<<<<<<<<<<<<
 *             # separate the models from gamma
 *             if gamma:
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_inplace); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1597, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1599
 *         if inplace:
 *             # separate the models from gamma
 *             if gamma:             # <<<<<<<<<<<<<<
 *                 out_arr, gamma = out
 *             else:
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gamma); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1599, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1600
 *             # separate the models from gamma
 *             if gamma:
 *                 out_arr, gamma = out             # <<<<<<<<<<<<<<
 *             else:
 *                 out_arr = out
*/
      if ((likely(PyTuple_CheckExact(__pyx_v_out))) || (PyList_CheckExact(__pyx_v_out))) {
        PyObject* sequence = __pyx_v_out;
        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, 1600, __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_INCREF(__pyx_t_4);
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_6);
        } else {
          __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_6);
        }
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_v_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
        index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1600, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_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, 1600, __pyx_L1_error)
        __pyx_L13_unpacking_done:;
      }
      __pyx_v_out_arr = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_gamma, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "H2MM_C.pyx":1599
 *         if inplace:
 *             # separate the models from gamma
 *             if gamma:             # <<<<<<<<<<<<<<
 *                 out_arr, gamma = out
 *             else:
*/
      goto __pyx_L11;
    }

    /* "H2MM_C.pyx":1602
 *                 out_arr, gamma = out
 *             else:
 *                 out_arr = out             # <<<<<<<<<<<<<<
 *             # find the ideal model
 *             if opt_array:
*/
    /*else*/ {
      __Pyx_INCREF(__pyx_v_out);
      __pyx_v_out_arr = __pyx_v_out;
    }
    __pyx_L11:;

    /* "H2MM_C.pyx":1604
 *                 out_arr = out
 *             # find the ideal model
 *             if opt_array:             # <<<<<<<<<<<<<<
 *                 for i in range(out_arr.size-1, -1, -1):
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_opt_array); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1604, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1605
 *             # find the ideal model
 *             if opt_array:
 *                 for i in range(out_arr.size-1, -1, -1):             # <<<<<<<<<<<<<<
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
 *                         out_model = out_arr[i]
*/
      __pyx_t_4 = NULL;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_out_arr, __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_t_7, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_t_3, __pyx_mstate_global->__pyx_int_neg_1, __pyx_mstate_global->__pyx_int_neg_1};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        {
          __pyx_t_6 = __pyx_t_9(__pyx_t_3);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1605, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "H2MM_C.pyx":1606
 *             if opt_array:
 *                 for i in range(out_arr.size-1, -1, -1):
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *                         out_model = out_arr[i]
 *                         break
*/
        __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_out_arr, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_conv_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyLong_From_int64_t(CONVCODE_OUTPUT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyNumber_And(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_1) {

          /* "H2MM_C.pyx":1607
 *                 for i in range(out_arr.size-1, -1, -1):
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
 *                         out_model = out_arr[i]             # <<<<<<<<<<<<<<
 *                         break
 *             else:
*/
          __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_out_arr, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1607, __pyx_L1_error)
          __pyx_v_out_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_7);
          __pyx_t_7 = 0;

          /* "H2MM_C.pyx":1608
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
 *                         out_model = out_arr[i]
 *                         break             # <<<<<<<<<<<<<<
 *             else:
 *                 out_model = out_arr
*/
          goto __pyx_L16_break;

          /* "H2MM_C.pyx":1606
 *             if opt_array:
 *                 for i in range(out_arr.size-1, -1, -1):
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *                         out_model = out_arr[i]
 *                         break
*/
        }

        /* "H2MM_C.pyx":1605
 *             # find the ideal model
 *             if opt_array:
 *                 for i in range(out_arr.size-1, -1, -1):             # <<<<<<<<<<<<<<
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
 *                         out_model = out_arr[i]
*/
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L18_for_end;
      __pyx_L16_break:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L18_for_end;
      __pyx_L18_for_end:;

      /* "H2MM_C.pyx":1604
 *                 out_arr = out
 *             # find the ideal model
 *             if opt_array:             # <<<<<<<<<<<<<<
 *                 for i in range(out_arr.size-1, -1, -1):
 *                     if out_arr[i].conv_code & CONVCODE_OUTPUT:
*/
      goto __pyx_L14;
    }

    /* "H2MM_C.pyx":1610
 *                         break
 *             else:
 *                 out_model = out_arr             # <<<<<<<<<<<<<<
 *             copy_model(out_model.model, self.model)
 *         return out
*/
    /*else*/ {
      __pyx_t_3 = __pyx_v_out_arr;
      __Pyx_INCREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1610, __pyx_L1_error)
      __pyx_v_out_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L14:;

    /* "H2MM_C.pyx":1611
 *             else:
 *                 out_model = out_arr
 *             copy_model(out_model.model, self.model)             # <<<<<<<<<<<<<<
 *         return out
 * 
*/
    if (unlikely(!__pyx_v_out_model)) { __Pyx_RaiseUnboundLocalError("out_model"); __PYX_ERR(0, 1611, __pyx_L1_error) }
    (void)(copy_model(__pyx_v_out_model->model, __pyx_v_self->model));

    /* "H2MM_C.pyx":1597
 *                       max_time=max_time, converged_min=converged_min, num_cores=num_cores,
 *                       reset_niter=reset_niter, gamma=gamma, opt_array=opt_array)
 *         if inplace:             # <<<<<<<<<<<<<<
 *             # separate the models from gamma
 *             if gamma:
*/
  }

  /* "H2MM_C.pyx":1612
 *                 out_model = out_arr
 *             copy_model(out_model.model, self.model)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1295
 *         return hash(p+t+o)
 * 
 *     def optimize(self, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_model);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_out_arr);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_max_iter);
  __Pyx_XDECREF(__pyx_v_gamma);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=True):
 *         """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_31evaluate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10h2mm_model_30evaluate, "\n        Calculate the loglikelihood of the model given a set of data. The \n        loglikelihood is stored with the model.\n        NOTE: this method calls the H2MM_arr function, and has essentially the \n        same syntax\n    \n        Parameters\n        ----------\n        indexes : list or tuple of NUMPY 1D int arrays\n            A list of the arrival indexes for each photon in each burst.\n            Each element of the list (a numpy array) corresponds to a burst, and\n            each element of the array is a singular photon.\n            The indexes list must maintain  1-to11 correspondence to the times list\n        times : list or tuple of NUMPY 1D int arrays\n            A list of the arrival times for each photon in each burst\n            Each element of the list (a numpy array) corresponds to a burst, and\n            each element of the array is a singular photon.\n            The times list must maintain  1-to-1 correspondence to the indexes list\n        gamma : bool (optional)\n            Whether or not to return the gamma array. (The default is False)\n        num_cores : int or None, optional\n            the number of C threads (which ignore the gil, thus functioning more\n            like python processes), to use when calculating iterations.\n            \n            .. note:: \n                \n                optimization_limtis sets this to be `os.cpu_count() // 2`, as most machines\n                are multithreaded. Because os.cpu_count() returns the number of threads,\n                not necessarily the number of cpus. For most machines, being multithreaded,\n                this actually returns twice the number of physical cores. Hence the default\n                to set at `os.cpu_count() // 2`. If your machine is not multithreaded, it\n                is best to set `optimization_limits.num_cores = os.cpu_count()`\n                \n            If None (default) use value from optimization_limits. \n            Default is"" None\n        inplace: bool, optional\n            Whether or not to store the evaluated model in the current model object.\n            Default is True\n        \n        Returns\n        -------\n        out: h2mm_model\n            The evaluated model\n        gamma_arr : list, tuple or np.ndarray (optional)\n            If gamma = True, this variable is returned, which contains (as numpy arrays)\n            the probabilities of each photon to be in each state, for each burst and model.\n            The arrays are returned in the same order and type as the indexes, \n            individual data points organized as [photon, state] within each data\n            sequence.\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_31evaluate = {"evaluate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_31evaluate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_30evaluate};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_31evaluate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_gamma = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_inplace = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_gamma,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_inplace,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1614, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "evaluate", 0) < (0)) __PYX_ERR(0, 1614, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1615
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,
 *                  inplace=True):             # <<<<<<<<<<<<<<
 *         """
 *         Calculate the loglikelihood of the model given a set of data. The
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("evaluate", 0, 2, 5, i); __PYX_ERR(0, 1614, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1614, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1614, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1614, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=True):
 *         """
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":1615
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,
 *                  inplace=True):             # <<<<<<<<<<<<<<
 *         """
 *         Calculate the loglikelihood of the model given a set of data. The
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_indexes = values[0];
    __pyx_v_times = values[1];
    __pyx_v_gamma = values[2];
    __pyx_v_num_cores = values[3];
    __pyx_v_inplace = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1614, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_30evaluate(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v_indexes, __pyx_v_times, __pyx_v_gamma, __pyx_v_num_cores, __pyx_v_inplace);

  /* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=True):
 *         """
*/

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_30evaluate(struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_gamma, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_inplace) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_out_model = 0;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);
  __Pyx_INCREF(__pyx_v_gamma);

  /* "H2MM_C.pyx":1667
 *         """
 *         cdef h2mm_model out_model
 *         out = H2MM_arr(self, indexes, times, gamma=gamma, num_cores=num_cores)             # <<<<<<<<<<<<<<
 *         if gamma:
 *             out_model, gamma = out
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_H2MM_arr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_indexes, __pyx_v_times};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_gamma, __pyx_v_gamma, __pyx_t_5, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1667, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num_cores, __pyx_v_num_cores, __pyx_t_5, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__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 (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":1668
 *         cdef h2mm_model out_model
 *         out = H2MM_arr(self, indexes, times, gamma=gamma, num_cores=num_cores)
 *         if gamma:             # <<<<<<<<<<<<<<
 *             out_model, gamma = out
 *         else:
*/
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_gamma); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1668, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":1669
 *         out = H2MM_arr(self, indexes, times, gamma=gamma, num_cores=num_cores)
 *         if gamma:
 *             out_model, gamma = out             # <<<<<<<<<<<<<<
 *         else:
 *             out_model = out
*/
    if ((likely(PyTuple_CheckExact(__pyx_v_out))) || (PyList_CheckExact(__pyx_v_out))) {
      PyObject* sequence = __pyx_v_out;
      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, 1669, __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_INCREF(__pyx_t_1);
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_3);
      } else {
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1669, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1669, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
      }
      #else
      __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_v_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1669, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
      index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 1669, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_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, 1669, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1669, __pyx_L1_error)
    __pyx_v_out_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_gamma, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1668
 *         cdef h2mm_model out_model
 *         out = H2MM_arr(self, indexes, times, gamma=gamma, num_cores=num_cores)
 *         if gamma:             # <<<<<<<<<<<<<<
 *             out_model, gamma = out
 *         else:
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":1671
 *             out_model, gamma = out
 *         else:
 *             out_model = out             # <<<<<<<<<<<<<<
 *         if inplace:
 *             if self.model.conv & CONVCODE_FIXEDMODEL:
*/
  /*else*/ {
    __pyx_t_3 = __pyx_v_out;
    __Pyx_INCREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 1671, __pyx_L1_error)
    __pyx_v_out_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":1672
 *         else:
 *             out_model = out
 *         if inplace:             # <<<<<<<<<<<<<<
 *             if self.model.conv & CONVCODE_FIXEDMODEL:
 *                 raise TypeError("cannot inplace evaluate fixed model")
*/
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_inplace); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1672, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "H2MM_C.pyx":1673
 *             out_model = out
 *         if inplace:
 *             if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot inplace evaluate fixed model")
 *             copy_model(out_model.model, self.model)
*/
    __pyx_t_6 = ((__pyx_v_self->model->conv & CONVCODE_FIXEDMODEL) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "H2MM_C.pyx":1674
 *         if inplace:
 *             if self.model.conv & CONVCODE_FIXEDMODEL:
 *                 raise TypeError("cannot inplace evaluate fixed model")             # <<<<<<<<<<<<<<
 *             copy_model(out_model.model, self.model)
 *         return out
*/
      __pyx_t_1 = NULL;
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_cannot_inplace_evaluate_fixed_mo};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1674, __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(0, 1674, __pyx_L1_error)

      /* "H2MM_C.pyx":1673
 *             out_model = out
 *         if inplace:
 *             if self.model.conv & CONVCODE_FIXEDMODEL:             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot inplace evaluate fixed model")
 *             copy_model(out_model.model, self.model)
*/
    }

    /* "H2MM_C.pyx":1675
 *             if self.model.conv & CONVCODE_FIXEDMODEL:
 *                 raise TypeError("cannot inplace evaluate fixed model")
 *             copy_model(out_model.model, self.model)             # <<<<<<<<<<<<<<
 *         return out
 * 
*/
    (void)(copy_model(__pyx_v_out_model->model, __pyx_v_self->model));

    /* "H2MM_C.pyx":1672
 *         else:
 *             out_model = out
 *         if inplace:             # <<<<<<<<<<<<<<
 *             if self.model.conv & CONVCODE_FIXEDMODEL:
 *                 raise TypeError("cannot inplace evaluate fixed model")
*/
  }

  /* "H2MM_C.pyx":1676
 *                 raise TypeError("cannot inplace evaluate fixed model")
 *             copy_model(out_model.model, self.model)
 *         return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=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_5);
  __Pyx_AddTraceback("H2MM_C.h2mm_model.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_model);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_gamma);
  __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_6H2MM_C_10h2mm_model_33__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_33__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_33__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_32__reduce_cython__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C.h2mm_model.__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_6H2MM_C_10h2mm_model_35__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10h2mm_model_35__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10h2mm_model_35__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_model.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10h2mm_model_34__setstate_cython__(((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10h2mm_model_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C.h2mm_model.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1683
 *     cdef:
 *         h2mm_minmax limits
 *     def __cinit__(self, h2mm_model model, cnp.ndarray[double,ndim=1] min_prior, cnp.ndarray[double,ndim=1] max_prior,             # <<<<<<<<<<<<<<
 *                   cnp.ndarray[double,ndim=2] min_trans, cnp.ndarray[double,ndim=2] max_trans,
 *                   cnp.ndarray[double,ndim=2] min_obs, cnp.ndarray[double,ndim=2] max_obs):
*/

/* Python wrapper */
static int __pyx_pw_6H2MM_C_10_h2mm_lims_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6H2MM_C_10_h2mm_lims_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model = 0;
  PyArrayObject *__pyx_v_min_prior = 0;
  PyArrayObject *__pyx_v_max_prior = 0;
  PyArrayObject *__pyx_v_min_trans = 0;
  PyArrayObject *__pyx_v_max_trans = 0;
  PyArrayObject *__pyx_v_min_obs = 0;
  PyArrayObject *__pyx_v_max_obs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
  #endif
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_min_prior,&__pyx_mstate_global->__pyx_n_u_max_prior,&__pyx_mstate_global->__pyx_n_u_min_trans,&__pyx_mstate_global->__pyx_n_u_max_trans,&__pyx_mstate_global->__pyx_n_u_min_obs,&__pyx_mstate_global->__pyx_n_u_max_obs,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1683, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1683, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 1683, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 7; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, i); __PYX_ERR(0, 1683, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 7)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1683, __pyx_L3_error)
      values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1683, __pyx_L3_error)
    }
    __pyx_v_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_min_prior = ((PyArrayObject *)values[1]);
    __pyx_v_max_prior = ((PyArrayObject *)values[2]);
    __pyx_v_min_trans = ((PyArrayObject *)values[3]);
    __pyx_v_max_trans = ((PyArrayObject *)values[4]);
    __pyx_v_min_obs = ((PyArrayObject *)values[5]);
    __pyx_v_max_obs = ((PyArrayObject *)values[6]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1683, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C._h2mm_lims.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "model", 0))) __PYX_ERR(0, 1683, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_min_prior), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "min_prior", 0))) __PYX_ERR(0, 1683, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_max_prior), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "max_prior", 0))) __PYX_ERR(0, 1683, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_min_trans), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "min_trans", 0))) __PYX_ERR(0, 1684, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_max_trans), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "max_trans", 0))) __PYX_ERR(0, 1684, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_min_obs), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "min_obs", 0))) __PYX_ERR(0, 1685, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_max_obs), __pyx_mstate_global->__pyx_ptype_5numpy_ndarray, 1, "max_obs", 0))) __PYX_ERR(0, 1685, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_10_h2mm_lims___cinit__(((struct __pyx_obj_6H2MM_C__h2mm_lims *)__pyx_v_self), __pyx_v_model, __pyx_v_min_prior, __pyx_v_max_prior, __pyx_v_min_trans, __pyx_v_max_trans, __pyx_v_min_obs, __pyx_v_max_obs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6H2MM_C_10_h2mm_lims___cinit__(struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyArrayObject *__pyx_v_min_prior, PyArrayObject *__pyx_v_max_prior, PyArrayObject *__pyx_v_min_trans, PyArrayObject *__pyx_v_max_trans, PyArrayObject *__pyx_v_min_obs, PyArrayObject *__pyx_v_max_obs) {
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  int64_t __pyx_v_nstate;
  int64_t __pyx_v_ndet;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_obs;
  __Pyx_Buffer __pyx_pybuffer_max_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_prior;
  __Pyx_Buffer __pyx_pybuffer_max_prior;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_trans;
  __Pyx_Buffer __pyx_pybuffer_max_trans;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_obs;
  __Pyx_Buffer __pyx_pybuffer_min_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_prior;
  __Pyx_Buffer __pyx_pybuffer_min_prior;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_trans;
  __Pyx_Buffer __pyx_pybuffer_min_trans;
  int __pyx_r;
  int64_t __pyx_t_1;
  double __pyx_t_2;
  int64_t __pyx_t_3;
  int64_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int64_t __pyx_t_7;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __pyx_pybuffer_min_prior.pybuffer.buf = NULL;
  __pyx_pybuffer_min_prior.refcount = 0;
  __pyx_pybuffernd_min_prior.data = NULL;
  __pyx_pybuffernd_min_prior.rcbuffer = &__pyx_pybuffer_min_prior;
  __pyx_pybuffer_max_prior.pybuffer.buf = NULL;
  __pyx_pybuffer_max_prior.refcount = 0;
  __pyx_pybuffernd_max_prior.data = NULL;
  __pyx_pybuffernd_max_prior.rcbuffer = &__pyx_pybuffer_max_prior;
  __pyx_pybuffer_min_trans.pybuffer.buf = NULL;
  __pyx_pybuffer_min_trans.refcount = 0;
  __pyx_pybuffernd_min_trans.data = NULL;
  __pyx_pybuffernd_min_trans.rcbuffer = &__pyx_pybuffer_min_trans;
  __pyx_pybuffer_max_trans.pybuffer.buf = NULL;
  __pyx_pybuffer_max_trans.refcount = 0;
  __pyx_pybuffernd_max_trans.data = NULL;
  __pyx_pybuffernd_max_trans.rcbuffer = &__pyx_pybuffer_max_trans;
  __pyx_pybuffer_min_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_min_obs.refcount = 0;
  __pyx_pybuffernd_min_obs.data = NULL;
  __pyx_pybuffernd_min_obs.rcbuffer = &__pyx_pybuffer_min_obs;
  __pyx_pybuffer_max_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_max_obs.refcount = 0;
  __pyx_pybuffernd_max_obs.data = NULL;
  __pyx_pybuffernd_max_obs.rcbuffer = &__pyx_pybuffer_max_obs;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_min_prior.diminfo[0].strides = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_prior.diminfo[0].shape = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_max_prior.diminfo[0].strides = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_prior.diminfo[0].shape = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_min_trans.diminfo[0].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_trans.diminfo[0].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_trans.diminfo[1].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_trans.diminfo[1].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_max_trans.diminfo[0].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_trans.diminfo[0].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_trans.diminfo[1].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_trans.diminfo[1].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_min_obs.diminfo[0].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_obs.diminfo[0].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_obs.diminfo[1].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_obs.diminfo[1].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1683, __pyx_L1_error)
  }
  __pyx_pybuffernd_max_obs.diminfo[0].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_obs.diminfo[0].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_obs.diminfo[1].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_obs.diminfo[1].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[1];

  /* "H2MM_C.pyx":1687
 *                   cnp.ndarray[double,ndim=2] min_obs, cnp.ndarray[double,ndim=2] max_obs):
 *         cdef int64_t i, j
 *         cdef int64_t nstate = model.model.nstate             # <<<<<<<<<<<<<<
 *         cdef int64_t ndet = model.model.ndet
 *         self.limits.mins = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
*/
  __pyx_t_1 = __pyx_v_model->model->nstate;
  __pyx_v_nstate = __pyx_t_1;

  /* "H2MM_C.pyx":1688
 *         cdef int64_t i, j
 *         cdef int64_t nstate = model.model.nstate
 *         cdef int64_t ndet = model.model.ndet             # <<<<<<<<<<<<<<
 *         self.limits.mins = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.mins.prior = NULL
*/
  __pyx_t_1 = __pyx_v_model->model->ndet;
  __pyx_v_ndet = __pyx_t_1;

  /* "H2MM_C.pyx":1689
 *         cdef int64_t nstate = model.model.nstate
 *         cdef int64_t ndet = model.model.ndet
 *         self.limits.mins = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))             # <<<<<<<<<<<<<<
 *         self.limits.mins.prior = NULL
 *         self.limits.mins.trans = NULL
*/
  __pyx_v_self->limits.mins = ((h2mm_mod *)PyMem_Malloc((sizeof(h2mm_mod))));

  /* "H2MM_C.pyx":1690
 *         cdef int64_t ndet = model.model.ndet
 *         self.limits.mins = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.mins.prior = NULL             # <<<<<<<<<<<<<<
 *         self.limits.mins.trans = NULL
 *         self.limits.mins.obs = NULL
*/
  __pyx_v_self->limits.mins->prior = NULL;

  /* "H2MM_C.pyx":1691
 *         self.limits.mins = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.mins.prior = NULL
 *         self.limits.mins.trans = NULL             # <<<<<<<<<<<<<<
 *         self.limits.mins.obs = NULL
 *         self.limits.maxs = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
*/
  __pyx_v_self->limits.mins->trans = NULL;

  /* "H2MM_C.pyx":1692
 *         self.limits.mins.prior = NULL
 *         self.limits.mins.trans = NULL
 *         self.limits.mins.obs = NULL             # <<<<<<<<<<<<<<
 *         self.limits.maxs = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.maxs.prior = NULL
*/
  __pyx_v_self->limits.mins->obs = NULL;

  /* "H2MM_C.pyx":1693
 *         self.limits.mins.trans = NULL
 *         self.limits.mins.obs = NULL
 *         self.limits.maxs = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))             # <<<<<<<<<<<<<<
 *         self.limits.maxs.prior = NULL
 *         self.limits.maxs.trans = NULL
*/
  __pyx_v_self->limits.maxs = ((h2mm_mod *)PyMem_Malloc((sizeof(h2mm_mod))));

  /* "H2MM_C.pyx":1694
 *         self.limits.mins.obs = NULL
 *         self.limits.maxs = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.maxs.prior = NULL             # <<<<<<<<<<<<<<
 *         self.limits.maxs.trans = NULL
 *         self.limits.maxs.obs = NULL
*/
  __pyx_v_self->limits.maxs->prior = NULL;

  /* "H2MM_C.pyx":1695
 *         self.limits.maxs = <h2mm_mod*> PyMem_Malloc(sizeof(h2mm_mod))
 *         self.limits.maxs.prior = NULL
 *         self.limits.maxs.trans = NULL             # <<<<<<<<<<<<<<
 *         self.limits.maxs.obs = NULL
 *         self.limits.mins.nstate = nstate
*/
  __pyx_v_self->limits.maxs->trans = NULL;

  /* "H2MM_C.pyx":1696
 *         self.limits.maxs.prior = NULL
 *         self.limits.maxs.trans = NULL
 *         self.limits.maxs.obs = NULL             # <<<<<<<<<<<<<<
 *         self.limits.mins.nstate = nstate
 *         self.limits.mins.ndet = ndet
*/
  __pyx_v_self->limits.maxs->obs = NULL;

  /* "H2MM_C.pyx":1697
 *         self.limits.maxs.trans = NULL
 *         self.limits.maxs.obs = NULL
 *         self.limits.mins.nstate = nstate             # <<<<<<<<<<<<<<
 *         self.limits.mins.ndet = ndet
 *         self.limits.mins.nphot = model.model.nphot
*/
  __pyx_v_self->limits.mins->nstate = __pyx_v_nstate;

  /* "H2MM_C.pyx":1698
 *         self.limits.maxs.obs = NULL
 *         self.limits.mins.nstate = nstate
 *         self.limits.mins.ndet = ndet             # <<<<<<<<<<<<<<
 *         self.limits.mins.nphot = model.model.nphot
 *         self.limits.mins.niter = model.model.niter
*/
  __pyx_v_self->limits.mins->ndet = __pyx_v_ndet;

  /* "H2MM_C.pyx":1699
 *         self.limits.mins.nstate = nstate
 *         self.limits.mins.ndet = ndet
 *         self.limits.mins.nphot = model.model.nphot             # <<<<<<<<<<<<<<
 *         self.limits.mins.niter = model.model.niter
 *         self.limits.mins.loglik = model.model.loglik
*/
  __pyx_t_1 = __pyx_v_model->model->nphot;
  __pyx_v_self->limits.mins->nphot = __pyx_t_1;

  /* "H2MM_C.pyx":1700
 *         self.limits.mins.ndet = ndet
 *         self.limits.mins.nphot = model.model.nphot
 *         self.limits.mins.niter = model.model.niter             # <<<<<<<<<<<<<<
 *         self.limits.mins.loglik = model.model.loglik
 *         self.limits.mins.conv = model.model.conv
*/
  __pyx_t_1 = __pyx_v_model->model->niter;
  __pyx_v_self->limits.mins->niter = __pyx_t_1;

  /* "H2MM_C.pyx":1701
 *         self.limits.mins.nphot = model.model.nphot
 *         self.limits.mins.niter = model.model.niter
 *         self.limits.mins.loglik = model.model.loglik             # <<<<<<<<<<<<<<
 *         self.limits.mins.conv = model.model.conv
 *         self.limits.mins.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
*/
  __pyx_t_2 = __pyx_v_model->model->loglik;
  __pyx_v_self->limits.mins->loglik = __pyx_t_2;

  /* "H2MM_C.pyx":1702
 *         self.limits.mins.niter = model.model.niter
 *         self.limits.mins.loglik = model.model.loglik
 *         self.limits.mins.conv = model.model.conv             # <<<<<<<<<<<<<<
 *         self.limits.mins.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.mins.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
*/
  __pyx_t_1 = __pyx_v_model->model->conv;
  __pyx_v_self->limits.mins->conv = __pyx_t_1;

  /* "H2MM_C.pyx":1703
 *         self.limits.mins.loglik = model.model.loglik
 *         self.limits.mins.conv = model.model.conv
 *         self.limits.mins.prior = <double*> PyMem_Malloc(nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         self.limits.mins.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.mins.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
*/
  __pyx_v_self->limits.mins->prior = ((double *)PyMem_Malloc((__pyx_v_nstate * (sizeof(double)))));

  /* "H2MM_C.pyx":1704
 *         self.limits.mins.conv = model.model.conv
 *         self.limits.mins.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.mins.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         self.limits.mins.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         self.limits.maxs.nstate = nstate
*/
  __pyx_v_self->limits.mins->trans = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_nstate) * (sizeof(double)))));

  /* "H2MM_C.pyx":1705
 *         self.limits.mins.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.mins.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.mins.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))             # <<<<<<<<<<<<<<
 *         self.limits.maxs.nstate = nstate
 *         self.limits.maxs.ndet = ndet
*/
  __pyx_v_self->limits.mins->obs = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_ndet) * (sizeof(double)))));

  /* "H2MM_C.pyx":1706
 *         self.limits.mins.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.mins.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         self.limits.maxs.nstate = nstate             # <<<<<<<<<<<<<<
 *         self.limits.maxs.ndet = ndet
 *         self.limits.maxs.nphot = model.model.nphot
*/
  __pyx_v_self->limits.maxs->nstate = __pyx_v_nstate;

  /* "H2MM_C.pyx":1707
 *         self.limits.mins.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         self.limits.maxs.nstate = nstate
 *         self.limits.maxs.ndet = ndet             # <<<<<<<<<<<<<<
 *         self.limits.maxs.nphot = model.model.nphot
 *         self.limits.maxs.niter = model.model.niter
*/
  __pyx_v_self->limits.maxs->ndet = __pyx_v_ndet;

  /* "H2MM_C.pyx":1708
 *         self.limits.maxs.nstate = nstate
 *         self.limits.maxs.ndet = ndet
 *         self.limits.maxs.nphot = model.model.nphot             # <<<<<<<<<<<<<<
 *         self.limits.maxs.niter = model.model.niter
 *         self.limits.maxs.loglik = model.model.loglik
*/
  __pyx_t_1 = __pyx_v_model->model->nphot;
  __pyx_v_self->limits.maxs->nphot = __pyx_t_1;

  /* "H2MM_C.pyx":1709
 *         self.limits.maxs.ndet = ndet
 *         self.limits.maxs.nphot = model.model.nphot
 *         self.limits.maxs.niter = model.model.niter             # <<<<<<<<<<<<<<
 *         self.limits.maxs.loglik = model.model.loglik
 *         self.limits.maxs.conv = model.model.conv
*/
  __pyx_t_1 = __pyx_v_model->model->niter;
  __pyx_v_self->limits.maxs->niter = __pyx_t_1;

  /* "H2MM_C.pyx":1710
 *         self.limits.maxs.nphot = model.model.nphot
 *         self.limits.maxs.niter = model.model.niter
 *         self.limits.maxs.loglik = model.model.loglik             # <<<<<<<<<<<<<<
 *         self.limits.maxs.conv = model.model.conv
 *         self.limits.maxs.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
*/
  __pyx_t_2 = __pyx_v_model->model->loglik;
  __pyx_v_self->limits.maxs->loglik = __pyx_t_2;

  /* "H2MM_C.pyx":1711
 *         self.limits.maxs.niter = model.model.niter
 *         self.limits.maxs.loglik = model.model.loglik
 *         self.limits.maxs.conv = model.model.conv             # <<<<<<<<<<<<<<
 *         self.limits.maxs.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.maxs.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
*/
  __pyx_t_1 = __pyx_v_model->model->conv;
  __pyx_v_self->limits.maxs->conv = __pyx_t_1;

  /* "H2MM_C.pyx":1712
 *         self.limits.maxs.loglik = model.model.loglik
 *         self.limits.maxs.conv = model.model.conv
 *         self.limits.maxs.prior = <double*> PyMem_Malloc(nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         self.limits.maxs.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.maxs.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
*/
  __pyx_v_self->limits.maxs->prior = ((double *)PyMem_Malloc((__pyx_v_nstate * (sizeof(double)))));

  /* "H2MM_C.pyx":1713
 *         self.limits.maxs.conv = model.model.conv
 *         self.limits.maxs.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.maxs.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         self.limits.maxs.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         for i in range(nstate):
*/
  __pyx_v_self->limits.maxs->trans = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_nstate) * (sizeof(double)))));

  /* "H2MM_C.pyx":1714
 *         self.limits.maxs.prior = <double*> PyMem_Malloc(nstate*sizeof(double))
 *         self.limits.maxs.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.maxs.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))             # <<<<<<<<<<<<<<
 *         for i in range(nstate):
 *             self.limits.mins.prior[i] = min_prior[i]
*/
  __pyx_v_self->limits.maxs->obs = ((double *)PyMem_Malloc(((__pyx_v_nstate * __pyx_v_ndet) * (sizeof(double)))));

  /* "H2MM_C.pyx":1715
 *         self.limits.maxs.trans = <double*> PyMem_Malloc(nstate*nstate*sizeof(double))
 *         self.limits.maxs.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         for i in range(nstate):             # <<<<<<<<<<<<<<
 *             self.limits.mins.prior[i] = min_prior[i]
 *             self.limits.maxs.prior[i] = max_prior[i]
*/
  __pyx_t_1 = __pyx_v_nstate;
  __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;

    /* "H2MM_C.pyx":1716
 *         self.limits.maxs.obs = <double*> PyMem_Malloc(nstate*ndet*sizeof(double))
 *         for i in range(nstate):
 *             self.limits.mins.prior[i] = min_prior[i]             # <<<<<<<<<<<<<<
 *             self.limits.maxs.prior[i] = max_prior[i]
 *             for j in range(nstate):
*/
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_6 = -1;
    if (__pyx_t_5 < 0) {
      __pyx_t_5 += __pyx_pybuffernd_min_prior.diminfo[0].shape;
      if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_min_prior.diminfo[0].shape)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      __PYX_ERR(0, 1716, __pyx_L1_error)
    }
    (__pyx_v_self->limits.mins->prior[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_min_prior.diminfo[0].strides));

    /* "H2MM_C.pyx":1717
 *         for i in range(nstate):
 *             self.limits.mins.prior[i] = min_prior[i]
 *             self.limits.maxs.prior[i] = max_prior[i]             # <<<<<<<<<<<<<<
 *             for j in range(nstate):
 *                 if i != j:
*/
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_6 = -1;
    if (__pyx_t_5 < 0) {
      __pyx_t_5 += __pyx_pybuffernd_max_prior.diminfo[0].shape;
      if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_max_prior.diminfo[0].shape)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      __PYX_ERR(0, 1717, __pyx_L1_error)
    }
    (__pyx_v_self->limits.maxs->prior[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_max_prior.diminfo[0].strides));

    /* "H2MM_C.pyx":1718
 *             self.limits.mins.prior[i] = min_prior[i]
 *             self.limits.maxs.prior[i] = max_prior[i]
 *             for j in range(nstate):             # <<<<<<<<<<<<<<
 *                 if i != j:
 *                     self.limits.mins.trans[i*nstate + j] = min_trans[i,j]
*/
    __pyx_t_7 = __pyx_v_nstate;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_j = __pyx_t_9;

      /* "H2MM_C.pyx":1719
 *             self.limits.maxs.prior[i] = max_prior[i]
 *             for j in range(nstate):
 *                 if i != j:             # <<<<<<<<<<<<<<
 *                     self.limits.mins.trans[i*nstate + j] = min_trans[i,j]
 *                     self.limits.maxs.trans[i*nstate + j] = max_trans[i,j]
*/
      __pyx_t_10 = (__pyx_v_i != __pyx_v_j);
      if (__pyx_t_10) {

        /* "H2MM_C.pyx":1720
 *             for j in range(nstate):
 *                 if i != j:
 *                     self.limits.mins.trans[i*nstate + j] = min_trans[i,j]             # <<<<<<<<<<<<<<
 *                     self.limits.maxs.trans[i*nstate + j] = max_trans[i,j]
 *                 else:
*/
        __pyx_t_5 = __pyx_v_i;
        __pyx_t_11 = __pyx_v_j;
        __pyx_t_6 = -1;
        if (__pyx_t_5 < 0) {
          __pyx_t_5 += __pyx_pybuffernd_min_trans.diminfo[0].shape;
          if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_min_trans.diminfo[0].shape)) __pyx_t_6 = 0;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_pybuffernd_min_trans.diminfo[1].shape;
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 1;
        } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_min_trans.diminfo[1].shape)) __pyx_t_6 = 1;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          __PYX_ERR(0, 1720, __pyx_L1_error)
        }
        (__pyx_v_self->limits.mins->trans[((__pyx_v_i * __pyx_v_nstate) + __pyx_v_j)]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_min_trans.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_min_trans.diminfo[1].strides));

        /* "H2MM_C.pyx":1721
 *                 if i != j:
 *                     self.limits.mins.trans[i*nstate + j] = min_trans[i,j]
 *                     self.limits.maxs.trans[i*nstate + j] = max_trans[i,j]             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.limits.mins.trans[i*nstate + j] = 0.0
*/
        __pyx_t_11 = __pyx_v_i;
        __pyx_t_5 = __pyx_v_j;
        __pyx_t_6 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_pybuffernd_max_trans.diminfo[0].shape;
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_max_trans.diminfo[0].shape)) __pyx_t_6 = 0;
        if (__pyx_t_5 < 0) {
          __pyx_t_5 += __pyx_pybuffernd_max_trans.diminfo[1].shape;
          if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
        } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_max_trans.diminfo[1].shape)) __pyx_t_6 = 1;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          __PYX_ERR(0, 1721, __pyx_L1_error)
        }
        (__pyx_v_self->limits.maxs->trans[((__pyx_v_i * __pyx_v_nstate) + __pyx_v_j)]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_max_trans.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_max_trans.diminfo[1].strides));

        /* "H2MM_C.pyx":1719
 *             self.limits.maxs.prior[i] = max_prior[i]
 *             for j in range(nstate):
 *                 if i != j:             # <<<<<<<<<<<<<<
 *                     self.limits.mins.trans[i*nstate + j] = min_trans[i,j]
 *                     self.limits.maxs.trans[i*nstate + j] = max_trans[i,j]
*/
        goto __pyx_L7;
      }

      /* "H2MM_C.pyx":1723
 *                     self.limits.maxs.trans[i*nstate + j] = max_trans[i,j]
 *                 else:
 *                     self.limits.mins.trans[i*nstate + j] = 0.0             # <<<<<<<<<<<<<<
 *                     self.limits.maxs.trans[i*nstate + j] = 1.0
 *             for j in range(ndet):
*/
      /*else*/ {
        (__pyx_v_self->limits.mins->trans[((__pyx_v_i * __pyx_v_nstate) + __pyx_v_j)]) = 0.0;

        /* "H2MM_C.pyx":1724
 *                 else:
 *                     self.limits.mins.trans[i*nstate + j] = 0.0
 *                     self.limits.maxs.trans[i*nstate + j] = 1.0             # <<<<<<<<<<<<<<
 *             for j in range(ndet):
 *                 self.limits.mins.obs[i + j*nstate] = min_obs[i,j]
*/
        (__pyx_v_self->limits.maxs->trans[((__pyx_v_i * __pyx_v_nstate) + __pyx_v_j)]) = 1.0;
      }
      __pyx_L7:;
    }

    /* "H2MM_C.pyx":1725
 *                     self.limits.mins.trans[i*nstate + j] = 0.0
 *                     self.limits.maxs.trans[i*nstate + j] = 1.0
 *             for j in range(ndet):             # <<<<<<<<<<<<<<
 *                 self.limits.mins.obs[i + j*nstate] = min_obs[i,j]
 *                 self.limits.maxs.obs[i + j*nstate] = max_obs[i,j]
*/
    __pyx_t_7 = __pyx_v_ndet;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_j = __pyx_t_9;

      /* "H2MM_C.pyx":1726
 *                     self.limits.maxs.trans[i*nstate + j] = 1.0
 *             for j in range(ndet):
 *                 self.limits.mins.obs[i + j*nstate] = min_obs[i,j]             # <<<<<<<<<<<<<<
 *                 self.limits.maxs.obs[i + j*nstate] = max_obs[i,j]
 * 
*/
      __pyx_t_5 = __pyx_v_i;
      __pyx_t_11 = __pyx_v_j;
      __pyx_t_6 = -1;
      if (__pyx_t_5 < 0) {
        __pyx_t_5 += __pyx_pybuffernd_min_obs.diminfo[0].shape;
        if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_min_obs.diminfo[0].shape)) __pyx_t_6 = 0;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_pybuffernd_min_obs.diminfo[1].shape;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 1;
      } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_min_obs.diminfo[1].shape)) __pyx_t_6 = 1;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        __PYX_ERR(0, 1726, __pyx_L1_error)
      }
      (__pyx_v_self->limits.mins->obs[(__pyx_v_i + (__pyx_v_j * __pyx_v_nstate))]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_min_obs.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_min_obs.diminfo[1].strides));

      /* "H2MM_C.pyx":1727
 *             for j in range(ndet):
 *                 self.limits.mins.obs[i + j*nstate] = min_obs[i,j]
 *                 self.limits.maxs.obs[i + j*nstate] = max_obs[i,j]             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
      __pyx_t_11 = __pyx_v_i;
      __pyx_t_5 = __pyx_v_j;
      __pyx_t_6 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_pybuffernd_max_obs.diminfo[0].shape;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_max_obs.diminfo[0].shape)) __pyx_t_6 = 0;
      if (__pyx_t_5 < 0) {
        __pyx_t_5 += __pyx_pybuffernd_max_obs.diminfo[1].shape;
        if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
      } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_max_obs.diminfo[1].shape)) __pyx_t_6 = 1;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        __PYX_ERR(0, 1727, __pyx_L1_error)
      }
      (__pyx_v_self->limits.maxs->obs[(__pyx_v_i + (__pyx_v_j * __pyx_v_nstate))]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_max_obs.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_max_obs.diminfo[1].strides));
    }
  }

  /* "H2MM_C.pyx":1683
 *     cdef:
 *         h2mm_minmax limits
 *     def __cinit__(self, h2mm_model model, cnp.ndarray[double,ndim=1] min_prior, cnp.ndarray[double,ndim=1] max_prior,             # <<<<<<<<<<<<<<
 *                   cnp.ndarray[double,ndim=2] min_trans, cnp.ndarray[double,ndim=2] max_trans,
 *                   cnp.ndarray[double,ndim=2] min_obs, cnp.ndarray[double,ndim=2] max_obs):
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  { 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_max_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C._h2mm_lims.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
  __pyx_L2:;
  return __pyx_r;
}

/* "H2MM_C.pyx":1729
 *                 self.limits.maxs.obs[i + j*nstate] = max_obs[i,j]
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.limits.mins.prior is not NULL:
 *             PyMem_Free(self.limits.mins.prior)
*/

/* Python wrapper */
static void __pyx_pw_6H2MM_C_10_h2mm_lims_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6H2MM_C_10_h2mm_lims_3__dealloc__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_6H2MM_C_10_h2mm_lims_2__dealloc__(((struct __pyx_obj_6H2MM_C__h2mm_lims *)__pyx_v_self));

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

static void __pyx_pf_6H2MM_C_10_h2mm_lims_2__dealloc__(struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self) {
  int __pyx_t_1;

  /* "H2MM_C.pyx":1730
 * 
 *     def __dealloc__(self):
 *         if self.limits.mins.prior is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.prior)
 *         if self.limits.maxs.prior is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.mins->prior != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1731
 *     def __dealloc__(self):
 *         if self.limits.mins.prior is not NULL:
 *             PyMem_Free(self.limits.mins.prior)             # <<<<<<<<<<<<<<
 *         if self.limits.maxs.prior is not NULL:
 *             PyMem_Free(self.limits.maxs.prior)
*/
    PyMem_Free(__pyx_v_self->limits.mins->prior);

    /* "H2MM_C.pyx":1730
 * 
 *     def __dealloc__(self):
 *         if self.limits.mins.prior is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.prior)
 *         if self.limits.maxs.prior is not NULL:
*/
  }

  /* "H2MM_C.pyx":1732
 *         if self.limits.mins.prior is not NULL:
 *             PyMem_Free(self.limits.mins.prior)
 *         if self.limits.maxs.prior is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.prior)
 *         if self.limits.mins.trans is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.maxs->prior != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1733
 *             PyMem_Free(self.limits.mins.prior)
 *         if self.limits.maxs.prior is not NULL:
 *             PyMem_Free(self.limits.maxs.prior)             # <<<<<<<<<<<<<<
 *         if self.limits.mins.trans is not NULL:
 *             PyMem_Free(self.limits.mins.trans)
*/
    PyMem_Free(__pyx_v_self->limits.maxs->prior);

    /* "H2MM_C.pyx":1732
 *         if self.limits.mins.prior is not NULL:
 *             PyMem_Free(self.limits.mins.prior)
 *         if self.limits.maxs.prior is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.prior)
 *         if self.limits.mins.trans is not NULL:
*/
  }

  /* "H2MM_C.pyx":1734
 *         if self.limits.maxs.prior is not NULL:
 *             PyMem_Free(self.limits.maxs.prior)
 *         if self.limits.mins.trans is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.trans)
 *         if self.limits.maxs.trans is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.mins->trans != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1735
 *             PyMem_Free(self.limits.maxs.prior)
 *         if self.limits.mins.trans is not NULL:
 *             PyMem_Free(self.limits.mins.trans)             # <<<<<<<<<<<<<<
 *         if self.limits.maxs.trans is not NULL:
 *             PyMem_Free(self.limits.maxs.trans)
*/
    PyMem_Free(__pyx_v_self->limits.mins->trans);

    /* "H2MM_C.pyx":1734
 *         if self.limits.maxs.prior is not NULL:
 *             PyMem_Free(self.limits.maxs.prior)
 *         if self.limits.mins.trans is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.trans)
 *         if self.limits.maxs.trans is not NULL:
*/
  }

  /* "H2MM_C.pyx":1736
 *         if self.limits.mins.trans is not NULL:
 *             PyMem_Free(self.limits.mins.trans)
 *         if self.limits.maxs.trans is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.trans)
 *         if self.limits.mins.obs is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.maxs->trans != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1737
 *             PyMem_Free(self.limits.mins.trans)
 *         if self.limits.maxs.trans is not NULL:
 *             PyMem_Free(self.limits.maxs.trans)             # <<<<<<<<<<<<<<
 *         if self.limits.mins.obs is not NULL:
 *             PyMem_Free(self.limits.mins.obs)
*/
    PyMem_Free(__pyx_v_self->limits.maxs->trans);

    /* "H2MM_C.pyx":1736
 *         if self.limits.mins.trans is not NULL:
 *             PyMem_Free(self.limits.mins.trans)
 *         if self.limits.maxs.trans is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.trans)
 *         if self.limits.mins.obs is not NULL:
*/
  }

  /* "H2MM_C.pyx":1738
 *         if self.limits.maxs.trans is not NULL:
 *             PyMem_Free(self.limits.maxs.trans)
 *         if self.limits.mins.obs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.obs)
 *         if self.limits.maxs.obs is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.mins->obs != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1739
 *             PyMem_Free(self.limits.maxs.trans)
 *         if self.limits.mins.obs is not NULL:
 *             PyMem_Free(self.limits.mins.obs)             # <<<<<<<<<<<<<<
 *         if self.limits.maxs.obs is not NULL:
 *             PyMem_Free(self.limits.maxs.obs)
*/
    PyMem_Free(__pyx_v_self->limits.mins->obs);

    /* "H2MM_C.pyx":1738
 *         if self.limits.maxs.trans is not NULL:
 *             PyMem_Free(self.limits.maxs.trans)
 *         if self.limits.mins.obs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins.obs)
 *         if self.limits.maxs.obs is not NULL:
*/
  }

  /* "H2MM_C.pyx":1740
 *         if self.limits.mins.obs is not NULL:
 *             PyMem_Free(self.limits.mins.obs)
 *         if self.limits.maxs.obs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.obs)
 *         if self.limits.mins is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.maxs->obs != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1741
 *             PyMem_Free(self.limits.mins.obs)
 *         if self.limits.maxs.obs is not NULL:
 *             PyMem_Free(self.limits.maxs.obs)             # <<<<<<<<<<<<<<
 *         if self.limits.mins is not NULL:
 *             PyMem_Free(self.limits.mins)
*/
    PyMem_Free(__pyx_v_self->limits.maxs->obs);

    /* "H2MM_C.pyx":1740
 *         if self.limits.mins.obs is not NULL:
 *             PyMem_Free(self.limits.mins.obs)
 *         if self.limits.maxs.obs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs.obs)
 *         if self.limits.mins is not NULL:
*/
  }

  /* "H2MM_C.pyx":1742
 *         if self.limits.maxs.obs is not NULL:
 *             PyMem_Free(self.limits.maxs.obs)
 *         if self.limits.mins is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins)
 *         if self.limits.maxs is not NULL:
*/
  __pyx_t_1 = (__pyx_v_self->limits.mins != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1743
 *             PyMem_Free(self.limits.maxs.obs)
 *         if self.limits.mins is not NULL:
 *             PyMem_Free(self.limits.mins)             # <<<<<<<<<<<<<<
 *         if self.limits.maxs is not NULL:
 *             PyMem_Free(self.limits.maxs)
*/
    PyMem_Free(__pyx_v_self->limits.mins);

    /* "H2MM_C.pyx":1742
 *         if self.limits.maxs.obs is not NULL:
 *             PyMem_Free(self.limits.maxs.obs)
 *         if self.limits.mins is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.mins)
 *         if self.limits.maxs is not NULL:
*/
  }

  /* "H2MM_C.pyx":1744
 *         if self.limits.mins is not NULL:
 *             PyMem_Free(self.limits.mins)
 *         if self.limits.maxs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->limits.maxs != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1745
 *             PyMem_Free(self.limits.mins)
 *         if self.limits.maxs is not NULL:
 *             PyMem_Free(self.limits.maxs)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    PyMem_Free(__pyx_v_self->limits.maxs);

    /* "H2MM_C.pyx":1744
 *         if self.limits.mins is not NULL:
 *             PyMem_Free(self.limits.mins)
 *         if self.limits.maxs is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.limits.maxs)
 * 
*/
  }

  /* "H2MM_C.pyx":1729
 *                 self.limits.maxs.obs[i + j*nstate] = max_obs[i,j]
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.limits.mins.prior is not NULL:
 *             PyMem_Free(self.limits.mins.prior)
*/

  /* function exit code */
}

/* "(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_6H2MM_C_10_h2mm_lims_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10_h2mm_lims_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10_h2mm_lims_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10_h2mm_lims_5__reduce_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; }
  const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  if (unlikely(__pyx_kwds_len < 0)) return NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_6H2MM_C_10_h2mm_lims_4__reduce_cython__(((struct __pyx_obj_6H2MM_C__h2mm_lims *)__pyx_v_self));

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

static PyObject *__pyx_pf_6H2MM_C_10_h2mm_lims_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C._h2mm_lims.__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_6H2MM_C_10_h2mm_lims_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_10_h2mm_lims_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10_h2mm_lims_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_10_h2mm_lims_7__setstate_cython__(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 1)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error)
    }
    __pyx_v___pyx_state = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C._h2mm_lims.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_10_h2mm_lims_6__setstate_cython__(((struct __pyx_obj_6H2MM_C__h2mm_lims *)__pyx_v_self), __pyx_v___pyx_state);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10_h2mm_lims_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 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_AddTraceback("H2MM_C._h2mm_lims.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1807
 * 
 *     """
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):             # <<<<<<<<<<<<<<
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_11h2mm_limits_1__init__ = {"__init__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_11h2mm_limits_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_1__init__(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_min_prior = 0;
  PyObject *__pyx_v_max_prior = 0;
  PyObject *__pyx_v_min_trans = 0;
  PyObject *__pyx_v_max_trans = 0;
  PyObject *__pyx_v_min_obs = 0;
  PyObject *__pyx_v_max_obs = 0;
  PyObject *__pyx_v_nstate = 0;
  PyObject *__pyx_v_ndet = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_min_prior,&__pyx_mstate_global->__pyx_n_u_max_prior,&__pyx_mstate_global->__pyx_n_u_min_trans,&__pyx_mstate_global->__pyx_n_u_max_trans,&__pyx_mstate_global->__pyx_n_u_min_obs,&__pyx_mstate_global->__pyx_n_u_max_obs,&__pyx_mstate_global->__pyx_n_u_nstate,&__pyx_mstate_global->__pyx_n_u_ndet_2,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1807, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 1807, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 10, i); __PYX_ERR(0, 1807, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1807, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1807, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
    }
    __pyx_v_self = values[0];
    __pyx_v_model = values[1];
    __pyx_v_min_prior = values[2];
    __pyx_v_max_prior = values[3];
    __pyx_v_min_trans = values[4];
    __pyx_v_max_trans = values[5];
    __pyx_v_min_obs = values[6];
    __pyx_v_max_obs = values[7];
    __pyx_v_nstate = values[8];
    __pyx_v_ndet = values[9];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 10, __pyx_nargs); __PYX_ERR(0, 1807, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_limits.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_11h2mm_limits___init__(__pyx_self, __pyx_v_self, __pyx_v_model, __pyx_v_min_prior, __pyx_v_max_prior, __pyx_v_min_trans, __pyx_v_max_trans, __pyx_v_min_obs, __pyx_v_max_obs, __pyx_v_nstate, __pyx_v_ndet);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_min_prior, PyObject *__pyx_v_max_prior, PyObject *__pyx_v_min_trans, PyObject *__pyx_v_max_trans, PyObject *__pyx_v_min_obs, PyObject *__pyx_v_max_obs, PyObject *__pyx_v_nstate, PyObject *__pyx_v_ndet) {
  int __pyx_v_none_kwargs;
  PyObject *__pyx_v_arg_list = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_param = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13[3];
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16[4];
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_nstate);
  __Pyx_INCREF(__pyx_v_ndet);

  /* "H2MM_C.pyx":1808
 *     """
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):
 *         none_kwargs = True             # <<<<<<<<<<<<<<
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")
*/
  __pyx_v_none_kwargs = 1;

  /* "H2MM_C.pyx":1809
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,
*/
  __pyx_t_2 = PyLong_Check(__pyx_v_nstate); 
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyLong_Check(__pyx_v_ndet); 
  __pyx_t_2 = (!__pyx_t_3);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_ndet, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1810
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")             # <<<<<<<<<<<<<<
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,
 *                     "min_trans":min_trans, "max_trans":max_trans,
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Cannot_give_negative_or_non_int};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1810, __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, 1810, __pyx_L1_error)

    /* "H2MM_C.pyx":1809
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:             # <<<<<<<<<<<<<<
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,
*/
  }

  /* "H2MM_C.pyx":1811
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,             # <<<<<<<<<<<<<<
 *                     "min_trans":min_trans, "max_trans":max_trans,
 *                     "min_obs":min_obs, "max_obs":max_obs}
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_min_prior, __pyx_v_min_prior) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_max_prior, __pyx_v_max_prior) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)

  /* "H2MM_C.pyx":1812
 *             raise TypeError("Cannot give negative or non-int values for nstate or ndet")
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,
 *                     "min_trans":min_trans, "max_trans":max_trans,             # <<<<<<<<<<<<<<
 *                     "min_obs":min_obs, "max_obs":max_obs}
 *         for name, param in arg_list.items():
*/
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_min_trans, __pyx_v_min_trans) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_max_trans, __pyx_v_max_trans) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)

  /* "H2MM_C.pyx":1813
 *         arg_list = {"min_prior":min_prior, "max_prior":max_prior,
 *                     "min_trans":min_trans, "max_trans":max_trans,
 *                     "min_obs":min_obs, "max_obs":max_obs}             # <<<<<<<<<<<<<<
 *         for name, param in arg_list.items():
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):
*/
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_min_obs, __pyx_v_min_obs) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_max_obs, __pyx_v_max_obs) < (0)) __PYX_ERR(0, 1811, __pyx_L1_error)
  __pyx_v_arg_list = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1814
 *                     "min_trans":min_trans, "max_trans":max_trans,
 *                     "min_obs":min_obs, "max_obs":max_obs}
 *         for name, param in arg_list.items():             # <<<<<<<<<<<<<<
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):
 *                 none_kwargs = False
*/
  __pyx_t_7 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_arg_list, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4);
  __pyx_t_4 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_8, &__pyx_t_7, &__pyx_t_5, &__pyx_t_10, NULL, __pyx_t_9);
    if (unlikely(__pyx_t_11 == 0)) break;
    if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 1814, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_param, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "H2MM_C.pyx":1815
 *                     "min_obs":min_obs, "max_obs":max_obs}
 *         for name, param in arg_list.items():
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):
*/
    __pyx_t_2 = PyFloat_Check(__pyx_v_param); 
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_param, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1816
 *         for name, param in arg_list.items():
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):
 *                 none_kwargs = False             # <<<<<<<<<<<<<<
 *                 if isinstance(param, cnp.ndarray):
 *                     if nstate == 0:
*/
      __pyx_v_none_kwargs = 0;

      /* "H2MM_C.pyx":1817
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                     if nstate == 0:
 *                         nstate = param.shape[0]
*/
      __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_param, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
      if (__pyx_t_1) {

        /* "H2MM_C.pyx":1818
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):
 *                     if nstate == 0:             # <<<<<<<<<<<<<<
 *                         nstate = param.shape[0]
 *                     elif nstate != param.shape[0]:
*/
        __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1818, __pyx_L1_error)
        if (__pyx_t_1) {

          /* "H2MM_C.pyx":1819
 *                 if isinstance(param, cnp.ndarray):
 *                     if nstate == 0:
 *                         nstate = param.shape[0]             # <<<<<<<<<<<<<<
 *                     elif nstate != param.shape[0]:
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
*/
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1819, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1819, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF_SET(__pyx_v_nstate, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "H2MM_C.pyx":1818
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):
 *                     if nstate == 0:             # <<<<<<<<<<<<<<
 *                         nstate = param.shape[0]
 *                     elif nstate != param.shape[0]:
*/
          goto __pyx_L14;
        }

        /* "H2MM_C.pyx":1820
 *                     if nstate == 0:
 *                         nstate = param.shape[0]
 *                     elif nstate != param.shape[0]:             # <<<<<<<<<<<<<<
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':
*/
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1820, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1820, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_nstate, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1820, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1820, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__pyx_t_1)) {

          /* "H2MM_C.pyx":1821
 *                         nstate = param.shape[0]
 *                     elif nstate != param.shape[0]:
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")             # <<<<<<<<<<<<<<
 *                     if name == 'min_obs' or name == 'max_obs':
 *                         if ndet == 0:
*/
          __pyx_t_10 = NULL;
          __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1821, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u_Conflicting_values_for_numbers_o;
          __pyx_t_13[1] = __pyx_t_12;
          __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u_check_array_dimensions;
          __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, 56 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 24, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1821, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_6 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_14};
            __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1821, __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(0, 1821, __pyx_L1_error)

          /* "H2MM_C.pyx":1820
 *                     if nstate == 0:
 *                         nstate = param.shape[0]
 *                     elif nstate != param.shape[0]:             # <<<<<<<<<<<<<<
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':
*/
        }
        __pyx_L14:;

        /* "H2MM_C.pyx":1822
 *                     elif nstate != param.shape[0]:
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':             # <<<<<<<<<<<<<<
 *                         if ndet == 0:
 *                             ndet = param.shape[1]
*/
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_n_u_min_obs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1822, __pyx_L1_error)
        if (!__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L16_bool_binop_done;
        }
        __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_mstate_global->__pyx_n_u_max_obs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1822, __pyx_L1_error)
        __pyx_t_1 = __pyx_t_2;
        __pyx_L16_bool_binop_done:;
        if (__pyx_t_1) {

          /* "H2MM_C.pyx":1823
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':
 *                         if ndet == 0:             # <<<<<<<<<<<<<<
 *                             ndet = param.shape[1]
 *                         elif ndet != param.shape[1]:
*/
          __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_ndet, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1823, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "H2MM_C.pyx":1824
 *                     if name == 'min_obs' or name == 'max_obs':
 *                         if ndet == 0:
 *                             ndet = param.shape[1]             # <<<<<<<<<<<<<<
 *                         elif ndet != param.shape[1]:
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
*/
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1824, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1824, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF_SET(__pyx_v_ndet, __pyx_t_14);
            __pyx_t_14 = 0;

            /* "H2MM_C.pyx":1823
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':
 *                         if ndet == 0:             # <<<<<<<<<<<<<<
 *                             ndet = param.shape[1]
 *                         elif ndet != param.shape[1]:
*/
            goto __pyx_L18;
          }

          /* "H2MM_C.pyx":1825
 *                         if ndet == 0:
 *                             ndet = param.shape[1]
 *                         elif ndet != param.shape[1]:             # <<<<<<<<<<<<<<
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
 *             elif param is not None:
*/
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_param, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_14, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = PyObject_RichCompare(__pyx_v_ndet, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(__pyx_t_1)) {

            /* "H2MM_C.pyx":1826
 *                             ndet = param.shape[1]
 *                         elif ndet != param.shape[1]:
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")             # <<<<<<<<<<<<<<
 *             elif param is not None:
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
*/
            __pyx_t_5 = NULL;
            __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1826, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u_Conflicting_values_for_numbers_o_2;
            __pyx_t_13[1] = __pyx_t_10;
            __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u_check_array_dimensions;
            __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, 64 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 24, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1826, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_t_6 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
              __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1826, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
            }
            __Pyx_Raise(__pyx_t_14, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __PYX_ERR(0, 1826, __pyx_L1_error)

            /* "H2MM_C.pyx":1825
 *                         if ndet == 0:
 *                             ndet = param.shape[1]
 *                         elif ndet != param.shape[1]:             # <<<<<<<<<<<<<<
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
 *             elif param is not None:
*/
          }
          __pyx_L18:;

          /* "H2MM_C.pyx":1822
 *                     elif nstate != param.shape[0]:
 *                         raise ValueError(f"Conflicting values for numbers of states encountered at {name}, check array dimensions")
 *                     if name == 'min_obs' or name == 'max_obs':             # <<<<<<<<<<<<<<
 *                         if ndet == 0:
 *                             ndet = param.shape[1]
*/
        }

        /* "H2MM_C.pyx":1817
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                     if nstate == 0:
 *                         nstate = param.shape[0]
*/
      }

      /* "H2MM_C.pyx":1815
 *                     "min_obs":min_obs, "max_obs":max_obs}
 *         for name, param in arg_list.items():
 *             if isinstance(param,float) or isinstance(param, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 none_kwargs = False
 *                 if isinstance(param, cnp.ndarray):
*/
      goto __pyx_L10;
    }

    /* "H2MM_C.pyx":1827
 *                         elif ndet != param.shape[1]:
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
 *             elif param is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
 *         if none_kwargs:
*/
    __pyx_t_1 = (__pyx_v_param != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "H2MM_C.pyx":1828
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
 *             elif param is not None:
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")             # <<<<<<<<<<<<<<
 *         if none_kwargs:
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")
*/
      __pyx_t_12 = NULL;
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_param)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_13[0] = __pyx_t_5;
      __pyx_t_13[1] = __pyx_mstate_global->__pyx_kp_u_must_be_None_float_or_numpy_arr;
      __pyx_t_13[2] = __pyx_t_10;
      __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 41 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1828, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_15};
        __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1828, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
      }
      __Pyx_Raise(__pyx_t_14, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __PYX_ERR(0, 1828, __pyx_L1_error)

      /* "H2MM_C.pyx":1827
 *                         elif ndet != param.shape[1]:
 *                             raise ValueError(f"Conflicting values for numbers of photon streams encountered at {name}, check array dimensions")
 *             elif param is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
 *         if none_kwargs:
*/
    }
    __pyx_L10:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1829
 *             elif param is not None:
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
 *         if none_kwargs:             # <<<<<<<<<<<<<<
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")
 *         # check that limist and supplied model are compatible
*/
  if (__pyx_v_none_kwargs) {

    /* "H2MM_C.pyx":1830
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
 *         if none_kwargs:
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")             # <<<<<<<<<<<<<<
 *         # check that limist and supplied model are compatible
 *         if isinstance(model,h2mm_model):
*/
    __pyx_t_14 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
      assert(__pyx_t_14);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_No_limits_specified_this_is_a_no};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1830, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1829
 *             elif param is not None:
 *                 raise ValueError(f"{name} must be None, float or numpy array, got {type(param)}")
 *         if none_kwargs:             # <<<<<<<<<<<<<<
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")
 *         # check that limist and supplied model are compatible
*/
  }

  /* "H2MM_C.pyx":1832
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")
 *         # check that limist and supplied model are compatible
 *         if isinstance(model,h2mm_model):             # <<<<<<<<<<<<<<
 *             if nstate == 0:
 *                 nstate == model.nstate
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_model, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":1833
 *         # check that limist and supplied model are compatible
 *         if isinstance(model,h2mm_model):
 *             if nstate == 0:             # <<<<<<<<<<<<<<
 *                 nstate == model.nstate
 *             elif nstate != model.nstate:
*/
    __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1833, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1834
 *         if isinstance(model,h2mm_model):
 *             if nstate == 0:
 *                 nstate == model.nstate             # <<<<<<<<<<<<<<
 *             elif nstate != model.nstate:
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1834, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = PyObject_RichCompare(__pyx_v_nstate, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1834, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "H2MM_C.pyx":1833
 *         # check that limist and supplied model are compatible
 *         if isinstance(model,h2mm_model):
 *             if nstate == 0:             # <<<<<<<<<<<<<<
 *                 nstate == model.nstate
 *             elif nstate != model.nstate:
*/
      goto __pyx_L21;
    }

    /* "H2MM_C.pyx":1835
 *             if nstate == 0:
 *                 nstate == model.nstate
 *             elif nstate != model.nstate:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
 *             if ndet == 0:
*/
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_nstate, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1835, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1835, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_t_1)) {

      /* "H2MM_C.pyx":1836
 *                 nstate == model.nstate
 *             elif nstate != model.nstate:
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")             # <<<<<<<<<<<<<<
 *             if ndet == 0:
 *                 ndet = model.ndet
*/
      __pyx_t_12 = NULL;
      __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_v_nstate, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_15, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_Limits_and_model_have_different;
      __pyx_t_16[1] = __pyx_t_14;
      __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u_and;
      __pyx_t_16[3] = __pyx_t_10;
      __pyx_t_15 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 54 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_15};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1836, __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, 1836, __pyx_L1_error)

      /* "H2MM_C.pyx":1835
 *             if nstate == 0:
 *                 nstate == model.nstate
 *             elif nstate != model.nstate:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
 *             if ndet == 0:
*/
    }
    __pyx_L21:;

    /* "H2MM_C.pyx":1837
 *             elif nstate != model.nstate:
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
 *             if ndet == 0:             # <<<<<<<<<<<<<<
 *                 ndet = model.ndet
 *             elif ndet != model.ndet:
*/
    __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_ndet, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1837, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1838
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
 *             if ndet == 0:
 *                 ndet = model.ndet             # <<<<<<<<<<<<<<
 *             elif ndet != model.ndet:
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_ndet, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":1837
 *             elif nstate != model.nstate:
 *                 raise ValueError(f"Limits and model have different number of states, got {nstate} and {model.nstate}")
 *             if ndet == 0:             # <<<<<<<<<<<<<<
 *                 ndet = model.ndet
 *             elif ndet != model.ndet:
*/
      goto __pyx_L22;
    }

    /* "H2MM_C.pyx":1839
 *             if ndet == 0:
 *                 ndet = model.ndet
 *             elif ndet != model.ndet:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = PyObject_RichCompare(__pyx_v_ndet, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1839, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(__pyx_t_1)) {

      /* "H2MM_C.pyx":1840
 *                 ndet = model.ndet
 *             elif ndet != model.ndet:
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")             # <<<<<<<<<<<<<<
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
 *                 raise ValueError("model prior out of range of min/max prior values")
*/
      __pyx_t_4 = NULL;
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_ndet, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_14 = __Pyx_PyObject_FormatSimple(__pyx_t_10, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_16[0] = __pyx_mstate_global->__pyx_kp_u_Limits_and_model_have_different_2;
      __pyx_t_16[1] = __pyx_t_12;
      __pyx_t_16[2] = __pyx_mstate_global->__pyx_kp_u_and;
      __pyx_t_16[3] = __pyx_t_14;
      __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_16, 4, 62 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14));
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_10};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1840, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __Pyx_Raise(__pyx_t_15, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __PYX_ERR(0, 1840, __pyx_L1_error)

      /* "H2MM_C.pyx":1839
 *             if ndet == 0:
 *                 ndet = model.ndet
 *             elif ndet != model.ndet:             # <<<<<<<<<<<<<<
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
*/
    }
    __pyx_L22:;

    /* "H2MM_C.pyx":1841
 *             elif ndet != model.ndet:
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):
*/
    __pyx_t_2 = (__pyx_v_min_prior != Py_None);
    if (!__pyx_t_2) {
      goto __pyx_L25_next_or;
    } else {
    }
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = PyObject_RichCompare(__pyx_v_min_prior, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_12};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1841, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_L25_next_or:;
    __pyx_t_2 = (__pyx_v_max_prior != Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L24_bool_binop_done;
    }
    __pyx_t_14 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_max_prior, __pyx_t_12, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_14);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_4};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1841, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L24_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "H2MM_C.pyx":1842
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
 *                 raise ValueError("model prior out of range of min/max prior values")             # <<<<<<<<<<<<<<
 *             if isinstance(min_trans,float):
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
*/
      __pyx_t_10 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_model_prior_out_of_range_of_min};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1842, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __Pyx_Raise(__pyx_t_15, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __PYX_ERR(0, 1842, __pyx_L1_error)

      /* "H2MM_C.pyx":1841
 *             elif ndet != model.ndet:
 *                 raise ValueError(f"Limits and model have different number of photon streams, got {ndet} and {model.ndet}")
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):
*/
    }

    /* "H2MM_C.pyx":1843
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):             # <<<<<<<<<<<<<<
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    __pyx_t_1 = PyFloat_Check(__pyx_v_min_trans); 
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1844
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):
*/
      __pyx_t_10 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_18))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_18);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_18);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_18, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_17};
        __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_18, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1844, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_18 = __Pyx_PyLong_EqObjC(__pyx_t_12, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_18 = PyObject_RichCompare(__pyx_v_min_trans, __pyx_t_12, Py_GT); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
        assert(__pyx_t_10);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_18};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1844, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1844, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "H2MM_C.pyx":1845
 *             if isinstance(min_trans,float):
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")             # <<<<<<<<<<<<<<
 *             elif isinstance(min_trans, cnp.ndarray):
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
*/
        __pyx_t_14 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_model_trans_out_of_range_of_min};
          __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1845, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
        }
        __Pyx_Raise(__pyx_t_15, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __PYX_ERR(0, 1845, __pyx_L1_error)

        /* "H2MM_C.pyx":1844
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):
*/
      }

      /* "H2MM_C.pyx":1843
 *             if (min_prior is not None and np.any(min_prior > model.prior)) or (max_prior is not None and np.any(max_prior < model.prior)):
 *                 raise ValueError("model prior out of range of min/max prior values")
 *             if isinstance(min_trans,float):             # <<<<<<<<<<<<<<
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
      goto __pyx_L28;
    }

    /* "H2MM_C.pyx":1846
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_min_trans, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1847
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):
*/
      __pyx_t_14 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_12 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_17))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_17);
        assert(__pyx_t_12);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_17, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_4};
        __pyx_t_18 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_17, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1847, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_18);
      }
      __pyx_t_17 = __Pyx_PyLong_EqObjC(__pyx_t_18, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_v_min_trans, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_12 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_19))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_19);
        assert(__pyx_t_12);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_19);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_19, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_19, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1847, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_19 = __Pyx_PyLong_EqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_19 = PyObject_RichCompare(__pyx_t_18, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_19); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
        assert(__pyx_t_14);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_19};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1847, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1847, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "H2MM_C.pyx":1848
 *             elif isinstance(min_trans, cnp.ndarray):
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")             # <<<<<<<<<<<<<<
 *             if isinstance(max_trans,float):
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
*/
        __pyx_t_10 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_model_trans_out_of_range_of_min};
          __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1848, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
        }
        __Pyx_Raise(__pyx_t_15, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __PYX_ERR(0, 1848, __pyx_L1_error)

        /* "H2MM_C.pyx":1847
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):
*/
      }

      /* "H2MM_C.pyx":1846
 *                 if np.any(min_trans > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(min_trans, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    }
    __pyx_L28:;

    /* "H2MM_C.pyx":1849
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):             # <<<<<<<<<<<<<<
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    __pyx_t_1 = PyFloat_Check(__pyx_v_max_trans); 
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1850
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):
*/
      __pyx_t_10 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_18 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_18);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_18);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_17};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1850, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = __Pyx_PyLong_EqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_max_trans, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
        assert(__pyx_t_10);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_5};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1850, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "H2MM_C.pyx":1851
 *             if isinstance(max_trans,float):
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")             # <<<<<<<<<<<<<<
 *             elif isinstance(max_trans, cnp.ndarray):
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
*/
        __pyx_t_14 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_model_trans_out_of_range_of_min};
          __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1851, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
        }
        __Pyx_Raise(__pyx_t_15, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __PYX_ERR(0, 1851, __pyx_L1_error)

        /* "H2MM_C.pyx":1850
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):
*/
      }

      /* "H2MM_C.pyx":1849
 *                 if np.any(min_trans[np.eye(model.nstate)==0] > model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if isinstance(max_trans,float):             # <<<<<<<<<<<<<<
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
      goto __pyx_L31;
    }

    /* "H2MM_C.pyx":1852
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_max_trans, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":1853
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
*/
      __pyx_t_14 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_17))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_17);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_17, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_19};
        __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_17, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1853, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __pyx_t_17 = __Pyx_PyLong_EqObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_max_trans, __pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_18};
        __pyx_t_19 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1853, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
      }
      __pyx_t_12 = __Pyx_PyLong_EqObjC(__pyx_t_19, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_12); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_19, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
        assert(__pyx_t_14);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_12};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1853, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(__pyx_t_1)) {

        /* "H2MM_C.pyx":1854
 *             elif isinstance(max_trans, cnp.ndarray):
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")             # <<<<<<<<<<<<<<
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
 *                 raise ValueError("model obs out of range of min/max obs values")
*/
        __pyx_t_10 = NULL;
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_model_trans_out_of_range_of_min};
          __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1854, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
        }
        __Pyx_Raise(__pyx_t_15, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __PYX_ERR(0, 1854, __pyx_L1_error)

        /* "H2MM_C.pyx":1853
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):             # <<<<<<<<<<<<<<
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
*/
      }

      /* "H2MM_C.pyx":1852
 *                 if np.any(max_trans < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             elif isinstance(max_trans, cnp.ndarray):             # <<<<<<<<<<<<<<
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
*/
    }
    __pyx_L31:;

    /* "H2MM_C.pyx":1855
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("model obs out of range of min/max obs values")
 *         elif model is not None:
*/
    __pyx_t_2 = (__pyx_v_min_obs != Py_None);
    if (!__pyx_t_2) {
      goto __pyx_L36_next_or;
    } else {
    }
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_19 = PyObject_RichCompare(__pyx_v_min_obs, __pyx_t_12, Py_GT); __Pyx_XGOTREF(__pyx_t_19); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_19};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1855, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L35_bool_binop_done;
    }
    __pyx_L36_next_or:;
    __pyx_t_2 = (__pyx_v_max_obs != Py_None);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L35_bool_binop_done;
    }
    __pyx_t_14 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_12 = PyObject_RichCompare(__pyx_v_max_obs, __pyx_t_19, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_6 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_14);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_6 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_12};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1855, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1855, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L35_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "H2MM_C.pyx":1856
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
 *                 raise ValueError("model obs out of range of min/max obs values")             # <<<<<<<<<<<<<<
 *         elif model is not None:
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")
*/
      __pyx_t_10 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_model_obs_out_of_range_of_min_ma};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1856, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __Pyx_Raise(__pyx_t_15, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __PYX_ERR(0, 1856, __pyx_L1_error)

      /* "H2MM_C.pyx":1855
 *                 if np.any(max_trans[np.eye(model.nstate)==0] < model.trans[np.eye(model.nstate)==0]):
 *                     raise ValueError("model trans out of range of min/max trans values")
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):             # <<<<<<<<<<<<<<
 *                 raise ValueError("model obs out of range of min/max obs values")
 *         elif model is not None:
*/
    }

    /* "H2MM_C.pyx":1832
 *             warnings.warn("No limits specified, this is a non-limiting h2mm_limits object")
 *         # check that limist and supplied model are compatible
 *         if isinstance(model,h2mm_model):             # <<<<<<<<<<<<<<
 *             if nstate == 0:
 *                 nstate == model.nstate
*/
    goto __pyx_L20;
  }

  /* "H2MM_C.pyx":1857
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
 *                 raise ValueError("model obs out of range of min/max obs values")
 *         elif model is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")
 *         self.min_prior = min_prior if min_prior is not None else 0.0
*/
  __pyx_t_1 = (__pyx_v_model != Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1858
 *                 raise ValueError("model obs out of range of min/max obs values")
 *         elif model is not None:
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")             # <<<<<<<<<<<<<<
 *         self.min_prior = min_prior if min_prior is not None else 0.0
 *         self.max_prior = max_prior if max_prior is not None else 1.0
*/
    __pyx_t_10 = NULL;
    __pyx_t_12 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_model)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1858, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_model_must_be_h2mm_model_or_None, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1858, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_14};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __Pyx_Raise(__pyx_t_15, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __PYX_ERR(0, 1858, __pyx_L1_error)

    /* "H2MM_C.pyx":1857
 *             if (min_obs is not None and np.any(min_obs > model.obs)) or (max_obs is not None and np.any(max_obs < model.obs)):
 *                 raise ValueError("model obs out of range of min/max obs values")
 *         elif model is not None:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")
 *         self.min_prior = min_prior if min_prior is not None else 0.0
*/
  }
  __pyx_L20:;

  /* "H2MM_C.pyx":1859
 *         elif model is not None:
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")
 *         self.min_prior = min_prior if min_prior is not None else 0.0             # <<<<<<<<<<<<<<
 *         self.max_prior = max_prior if max_prior is not None else 1.0
 *         if np.any(self.min_prior > self.max_prior):
*/
  __pyx_t_1 = (__pyx_v_min_prior != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_min_prior);
    __pyx_t_15 = __pyx_v_min_prior;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_0_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior, __pyx_t_15) < (0)) __PYX_ERR(0, 1859, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1860
 *             raise ValueError(f"model must be h2mm_model or None, got {type(model)}")
 *         self.min_prior = min_prior if min_prior is not None else 0.0
 *         self.max_prior = max_prior if max_prior is not None else 1.0             # <<<<<<<<<<<<<<
 *         if np.any(self.min_prior > self.max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")
*/
  __pyx_t_1 = (__pyx_v_max_prior != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_max_prior);
    __pyx_t_15 = __pyx_v_max_prior;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_1_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_1_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior, __pyx_t_15) < (0)) __PYX_ERR(0, 1860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1861
 *         self.min_prior = min_prior if min_prior is not None else 0.0
 *         self.max_prior = max_prior if max_prior is not None else 1.0
 *         if np.any(self.min_prior > self.max_prior):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         self.min_trans = min_trans if min_trans is not None else 0.0
*/
  __pyx_t_14 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, __pyx_t_19, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
    assert(__pyx_t_14);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_5};
    __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1862
 *         self.max_prior = max_prior if max_prior is not None else 1.0
 *         if np.any(self.min_prior > self.max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")             # <<<<<<<<<<<<<<
 *         self.min_trans = min_trans if min_trans is not None else 0.0
 *         self.max_trans = max_trans if max_trans is not None else 1.0
*/
    __pyx_t_12 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_min_prior_cannot_be_greater_than};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1862, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __Pyx_Raise(__pyx_t_15, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __PYX_ERR(0, 1862, __pyx_L1_error)

    /* "H2MM_C.pyx":1861
 *         self.min_prior = min_prior if min_prior is not None else 0.0
 *         self.max_prior = max_prior if max_prior is not None else 1.0
 *         if np.any(self.min_prior > self.max_prior):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         self.min_trans = min_trans if min_trans is not None else 0.0
*/
  }

  /* "H2MM_C.pyx":1863
 *         if np.any(self.min_prior > self.max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         self.min_trans = min_trans if min_trans is not None else 0.0             # <<<<<<<<<<<<<<
 *         self.max_trans = max_trans if max_trans is not None else 1.0
 *         self.min_obs = min_obs if min_obs is not None else 0.0
*/
  __pyx_t_1 = (__pyx_v_min_trans != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_min_trans);
    __pyx_t_15 = __pyx_v_min_trans;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_0_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans, __pyx_t_15) < (0)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1864
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         self.min_trans = min_trans if min_trans is not None else 0.0
 *         self.max_trans = max_trans if max_trans is not None else 1.0             # <<<<<<<<<<<<<<
 *         self.min_obs = min_obs if min_obs is not None else 0.0
 *         self.max_obs = max_obs if max_obs is not None else 1.0
*/
  __pyx_t_1 = (__pyx_v_max_trans != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_max_trans);
    __pyx_t_15 = __pyx_v_max_trans;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_1_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_1_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans, __pyx_t_15) < (0)) __PYX_ERR(0, 1864, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1865
 *         self.min_trans = min_trans if min_trans is not None else 0.0
 *         self.max_trans = max_trans if max_trans is not None else 1.0
 *         self.min_obs = min_obs if min_obs is not None else 0.0             # <<<<<<<<<<<<<<
 *         self.max_obs = max_obs if max_obs is not None else 1.0
 *         if np.any(self.min_obs > self.max_obs):
*/
  __pyx_t_1 = (__pyx_v_min_obs != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_min_obs);
    __pyx_t_15 = __pyx_v_min_obs;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_0_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs, __pyx_t_15) < (0)) __PYX_ERR(0, 1865, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1866
 *         self.max_trans = max_trans if max_trans is not None else 1.0
 *         self.min_obs = min_obs if min_obs is not None else 0.0
 *         self.max_obs = max_obs if max_obs is not None else 1.0             # <<<<<<<<<<<<<<
 *         if np.any(self.min_obs > self.max_obs):
 *             raise ValueError("min_obs cannot be greater than max_obs")
*/
  __pyx_t_1 = (__pyx_v_max_obs != Py_None);
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_v_max_obs);
    __pyx_t_15 = __pyx_v_max_obs;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_float_1_0);
    __pyx_t_15 = __pyx_mstate_global->__pyx_float_1_0;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs, __pyx_t_15) < (0)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "H2MM_C.pyx":1867
 *         self.min_obs = min_obs if min_obs is not None else 0.0
 *         self.max_obs = max_obs if max_obs is not None else 1.0
 *         if np.any(self.min_obs > self.max_obs):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_obs cannot be greater than max_obs")
 *         self.ndet = ndet
*/
  __pyx_t_12 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_t_19, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
    assert(__pyx_t_12);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_10};
    __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":1868
 *         self.max_obs = max_obs if max_obs is not None else 1.0
 *         if np.any(self.min_obs > self.max_obs):
 *             raise ValueError("min_obs cannot be greater than max_obs")             # <<<<<<<<<<<<<<
 *         self.ndet = ndet
 *         self.nstate = nstate
*/
    __pyx_t_14 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_min_obs_cannot_be_greater_than_m};
      __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1868, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
    }
    __Pyx_Raise(__pyx_t_15, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __PYX_ERR(0, 1868, __pyx_L1_error)

    /* "H2MM_C.pyx":1867
 *         self.min_obs = min_obs if min_obs is not None else 0.0
 *         self.max_obs = max_obs if max_obs is not None else 1.0
 *         if np.any(self.min_obs > self.max_obs):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_obs cannot be greater than max_obs")
 *         self.ndet = ndet
*/
  }

  /* "H2MM_C.pyx":1869
 *         if np.any(self.min_obs > self.max_obs):
 *             raise ValueError("min_obs cannot be greater than max_obs")
 *         self.ndet = ndet             # <<<<<<<<<<<<<<
 *         self.nstate = nstate
 *         self.model = model
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ndet_2, __pyx_v_ndet) < (0)) __PYX_ERR(0, 1869, __pyx_L1_error)

  /* "H2MM_C.pyx":1870
 *             raise ValueError("min_obs cannot be greater than max_obs")
 *         self.ndet = ndet
 *         self.nstate = nstate             # <<<<<<<<<<<<<<
 *         self.model = model
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nstate, __pyx_v_nstate) < (0)) __PYX_ERR(0, 1870, __pyx_L1_error)

  /* "H2MM_C.pyx":1871
 *         self.ndet = ndet
 *         self.nstate = nstate
 *         self.model = model             # <<<<<<<<<<<<<<
 * 
 *     def make_model(self, model, warning=True):
*/
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_model, __pyx_v_model) < (0)) __PYX_ERR(0, 1871, __pyx_L1_error)

  /* "H2MM_C.pyx":1807
 * 
 *     """
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):             # <<<<<<<<<<<<<<
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_AddTraceback("H2MM_C.h2mm_limits.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg_list);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_param);
  __Pyx_XDECREF(__pyx_v_nstate);
  __Pyx_XDECREF(__pyx_v_ndet);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1873
 *         self.model = model
 * 
 *     def make_model(self, model, warning=True):             # <<<<<<<<<<<<<<
 *         """
 *         Method for checking the limits arrays generated from the input model
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_3make_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_11h2mm_limits_2make_model, "\n        Method for checking the limits arrays generated from the input model\n        \n        Parameters\n        ----------\n        model : h2mm_model\n            :class:`h2mm_model` for which the limits are to be specified.\n            Also, values are checked and a warning is raised if the model has\n            values that are out of the range of the limits\n        warning: bool optional\n            Whether or not to check of the initial model is within the bounds\n            generated by make_model\n            Default is True\n        Raises\n        ------\n        Exception\n            When user has reset a specific field so the field is no longer valid.\n        ValueError\n            Limits cannot be made for the given model.\n        \n        Returns\n        -------\n        model : h2mm_model\n            Model to be optimized with specified limits.\n        min_prior : 1D numpy float array\n            Minimum values for each element of the prior array\n        max_prior : 1D numpy float array\n            Maximum values for each element of the prior array\n        min_trans : 2D square numpy float array\n            Minimum values of each element of the trans array\n        max_trans : 2D square numpy float array\n            Maximum values of each element of the trans array\n        min_obs : 2D numpy float array\n            Minimum values of each element of the obs array\n        max_obs : 2D numpy float array\n            Maximum values of each element of the obs array\n        \n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_11h2mm_limits_3make_model = {"make_model", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_11h2mm_limits_3make_model, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_11h2mm_limits_2make_model};
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_3make_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_model = 0;
  PyObject *__pyx_v_warning = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_model (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_warning,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1873, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "make_model", 0) < (0)) __PYX_ERR(0, 1873, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("make_model", 0, 2, 3, i); __PYX_ERR(0, 1873, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1873, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1873, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1873, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
    }
    __pyx_v_self = values[0];
    __pyx_v_model = values[1];
    __pyx_v_warning = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_model", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1873, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_limits.make_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_11h2mm_limits_2make_model(__pyx_self, __pyx_v_self, __pyx_v_model, __pyx_v_warning);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits_2make_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, PyObject *__pyx_v_warning) {
  PyObject *__pyx_v_ndet = NULL;
  PyObject *__pyx_v_nstate = NULL;
  PyObject *__pyx_v_min_prior = NULL;
  PyObject *__pyx_v_max_prior = NULL;
  PyObject *__pyx_v_min_trans = NULL;
  PyObject *__pyx_v_max_trans = NULL;
  PyObject *__pyx_v_min_obs = NULL;
  PyObject *__pyx_v_max_obs = 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;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[5];
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_model", 0);

  /* "H2MM_C.pyx":1912
 * 
 *         """
 *         if not isinstance(model,h2mm_model):             # <<<<<<<<<<<<<<
 *             raise Exception("Must be h2mm_model")
 *         if self.nstate != 0 and self.nstate != model.nstate:
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_model, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1913
 *         """
 *         if not isinstance(model,h2mm_model):
 *             raise Exception("Must be h2mm_model")             # <<<<<<<<<<<<<<
 *         if self.nstate != 0 and self.nstate != model.nstate:
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Must_be_h2mm_model};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1913, __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(0, 1913, __pyx_L1_error)

    /* "H2MM_C.pyx":1912
 * 
 *         """
 *         if not isinstance(model,h2mm_model):             # <<<<<<<<<<<<<<
 *             raise Exception("Must be h2mm_model")
 *         if self.nstate != 0 and self.nstate != model.nstate:
*/
  }

  /* "H2MM_C.pyx":1914
 *         if not isinstance(model,h2mm_model):
 *             raise Exception("Must be h2mm_model")
 *         if self.nstate != 0 and self.nstate != model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
 *         if self.ndet != 0 and self.ndet != model.ndet:
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1914, __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_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1914, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1915
 *             raise Exception("Must be h2mm_model")
 *         if self.nstate != 0 and self.nstate != model.nstate:
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")             # <<<<<<<<<<<<<<
 *         if self.ndet != 0 and self.ndet != model.ndet:
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")
*/
    __pyx_t_4 = NULL;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_Mismatch_in_states_between_model;
    __pyx_t_9[1] = __pyx_t_7;
    __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_and_limits_object;
    __pyx_t_9[3] = __pyx_t_8;
    __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 34 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1915, __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, 1915, __pyx_L1_error)

    /* "H2MM_C.pyx":1914
 *         if not isinstance(model,h2mm_model):
 *             raise Exception("Must be h2mm_model")
 *         if self.nstate != 0 and self.nstate != model.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
 *         if self.ndet != 0 and self.ndet != model.ndet:
*/
  }

  /* "H2MM_C.pyx":1916
 *         if self.nstate != 0 and self.nstate != model.nstate:
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
 *         if self.ndet != 0 and self.ndet != model.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")
 *         ndet = model.ndet
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L8_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1917
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
 *         if self.ndet != 0 and self.ndet != model.ndet:
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")             # <<<<<<<<<<<<<<
 *         ndet = model.ndet
 *         nstate = model.nstate
*/
    __pyx_t_3 = NULL;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_Mismatch_in_photon_streams_betwe;
    __pyx_t_9[1] = __pyx_t_8;
    __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_and_limits_object;
    __pyx_t_9[3] = __pyx_t_7;
    __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 42 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7));
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1917, __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, 1917, __pyx_L1_error)

    /* "H2MM_C.pyx":1916
 *         if self.nstate != 0 and self.nstate != model.nstate:
 *             raise ValueError(f"Mismatch in states between model ({model.nstate}) and limits object ({self.nstate})")
 *         if self.ndet != 0 and self.ndet != model.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")
 *         ndet = model.ndet
*/
  }

  /* "H2MM_C.pyx":1918
 *         if self.ndet != 0 and self.ndet != model.ndet:
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")
 *         ndet = model.ndet             # <<<<<<<<<<<<<<
 *         nstate = model.nstate
 *         if self.min_prior is None:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_ndet = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1919
 *             raise ValueError(f"Mismatch in photon streams between model ({model.ndet}) and limits object ({self.ndet})")
 *         ndet = model.ndet
 *         nstate = model.nstate             # <<<<<<<<<<<<<<
 *         if self.min_prior is None:
 *             min_prior = np.zeros(nstate).astype('double')
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_nstate = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":1920
 *         ndet = model.ndet
 *         nstate = model.nstate
 *         if self.min_prior is None:             # <<<<<<<<<<<<<<
 *             min_prior = np.zeros(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1921
 *         nstate = model.nstate
 *         if self.min_prior is None:
 *             min_prior = np.zeros(nstate).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_prior,float):
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_nstate};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1921, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_6 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1921, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_min_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1920
 *         ndet = model.ndet
 *         nstate = model.nstate
 *         if self.min_prior is None:             # <<<<<<<<<<<<<<
 *             min_prior = np.zeros(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
*/
    goto __pyx_L10;
  }

  /* "H2MM_C.pyx":1922
 *         if self.min_prior is None:
 *             min_prior = np.zeros(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):             # <<<<<<<<<<<<<<
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_Check(__pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1923
 *             min_prior = np.zeros(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:
 *             min_prior = self.min_prior.astype('double')
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_nstate};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_11 = PyNumber_Multiply(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_3 = __pyx_t_11;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_min_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1922
 *         if self.min_prior is None:
 *             min_prior = np.zeros(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):             # <<<<<<<<<<<<<<
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:
*/
    goto __pyx_L10;
  }

  /* "H2MM_C.pyx":1924
 *         elif isinstance(self.min_prior,float):
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:             # <<<<<<<<<<<<<<
 *             min_prior = self.min_prior.astype('double')
 *         else:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_11, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_11, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L11_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1925
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:
 *             min_prior = self.min_prior.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of min_prior changed")
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1925, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_min_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1924
 *         elif isinstance(self.min_prior,float):
 *             min_prior = (self.min_prior * np.ones(nstate)).astype('double')
 *         elif isinstance(self.min_prior, cnp.ndarray) and self.min_prior.ndim == 1 and self.min_prior.shape[0] == nstate:             # <<<<<<<<<<<<<<
 *             min_prior = self.min_prior.astype('double')
 *         else:
*/
    goto __pyx_L10;
  }

  /* "H2MM_C.pyx":1927
 *             min_prior = self.min_prior.astype('double')
 *         else:
 *             raise Exception("Type of min_prior changed")             # <<<<<<<<<<<<<<
 *         if self.max_prior is None:
 *             max_prior = np.ones(nstate).astype('double')
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Type_of_min_prior_changed};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1927, __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, 1927, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "H2MM_C.pyx":1928
 *         else:
 *             raise Exception("Type of min_prior changed")
 *         if self.max_prior is None:             # <<<<<<<<<<<<<<
 *             max_prior = np.ones(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1929
 *             raise Exception("Type of min_prior changed")
 *         if self.max_prior is None:
 *             max_prior = np.ones(nstate).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_prior,float):
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
*/
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_nstate};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __pyx_t_3 = __pyx_t_11;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_max_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1928
 *         else:
 *             raise Exception("Type of min_prior changed")
 *         if self.max_prior is None:             # <<<<<<<<<<<<<<
 *             max_prior = np.ones(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
*/
    goto __pyx_L14;
  }

  /* "H2MM_C.pyx":1930
 *         if self.max_prior is None:
 *             max_prior = np.ones(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):             # <<<<<<<<<<<<<<
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_Check(__pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1931
 *             max_prior = np.ones(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:
 *             max_prior = self.max_prior.astype('double')
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_nstate};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_max_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1930
 *         if self.max_prior is None:
 *             max_prior = np.ones(nstate).astype('double')
 *         elif isinstance(self.min_prior,float):             # <<<<<<<<<<<<<<
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:
*/
    goto __pyx_L14;
  }

  /* "H2MM_C.pyx":1932
 *         elif isinstance(self.min_prior,float):
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:             # <<<<<<<<<<<<<<
 *             max_prior = self.max_prior.astype('double')
 *         else:
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L15_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1933
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:
 *             max_prior = self.max_prior.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of max_prior changed")
*/
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_8 = __pyx_t_11;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1933, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_max_prior = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1932
 *         elif isinstance(self.min_prior,float):
 *             max_prior = (self.max_prior *np.ones(nstate)).astype('double')
 *         elif isinstance(self.max_prior, cnp.ndarray) and self.max_prior.ndim == 1 and self.max_prior.shape[0] == nstate:             # <<<<<<<<<<<<<<
 *             max_prior = self.max_prior.astype('double')
 *         else:
*/
    goto __pyx_L14;
  }

  /* "H2MM_C.pyx":1935
 *             max_prior = self.max_prior.astype('double')
 *         else:
 *             raise Exception("Type of max_prior changed")             # <<<<<<<<<<<<<<
 *         if np.any(min_prior > max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")
*/
  /*else*/ {
    __pyx_t_11 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Type_of_max_prior_changed};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1935, __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, 1935, __pyx_L1_error)
  }
  __pyx_L14:;

  /* "H2MM_C.pyx":1936
 *         else:
 *             raise Exception("Type of max_prior changed")
 *         if np.any(min_prior > max_prior):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         if self.min_trans is None:
*/
  __pyx_t_11 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_min_prior, __pyx_v_max_prior, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_11);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_8};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1937
 *             raise Exception("Type of max_prior changed")
 *         if np.any(min_prior > max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")             # <<<<<<<<<<<<<<
 *         if self.min_trans is None:
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
*/
    __pyx_t_7 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_min_prior_cannot_be_greater_than};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1937, __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, 1937, __pyx_L1_error)

    /* "H2MM_C.pyx":1936
 *         else:
 *             raise Exception("Type of max_prior changed")
 *         if np.any(min_prior > max_prior):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         if self.min_trans is None:
*/
  }

  /* "H2MM_C.pyx":1938
 *         if np.any(min_prior > max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         if self.min_trans is None:             # <<<<<<<<<<<<<<
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
 *         elif isinstance(self.min_trans,float):
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1939
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         if self.min_trans is None:
 *             min_trans = np.zeros((nstate,nstate)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_trans,float):
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
*/
    __pyx_t_11 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1939, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1939, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_11);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_3};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_7 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_min_trans = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1938
 *         if np.any(min_prior > max_prior):
 *             raise ValueError("min_prior cannot be greater than max_prior")
 *         if self.min_trans is None:             # <<<<<<<<<<<<<<
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
 *         elif isinstance(self.min_trans,float):
*/
    goto __pyx_L19;
  }

  /* "H2MM_C.pyx":1940
 *         if self.min_trans is None:
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
 *         elif isinstance(self.min_trans,float):             # <<<<<<<<<<<<<<
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
 *             min_trans[np.eye(nstate)==1] = 0.0
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_Check(__pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1941
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
 *         elif isinstance(self.min_trans,float):
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')             # <<<<<<<<<<<<<<
 *             min_trans[np.eye(nstate)==1] = 0.0
 *         elif isinstance(self.min_trans, cnp.ndarray) and self.min_trans.ndim == 2 and self.min_trans.shape[0] == self.min_trans.shape[1] == nstate:
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1941, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1941, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_11};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_8 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_v_min_trans = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":1942
 *         elif isinstance(self.min_trans,float):
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
 *             min_trans[np.eye(nstate)==1] = 0.0             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_trans, cnp.ndarray) and self.min_trans.ndim == 2 and self.min_trans.shape[0] == self.min_trans.shape[1] == nstate:
 *             min_trans = self.min_trans.astype('double')
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_nstate};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_10 = __Pyx_PyLong_EqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely((PyObject_SetItem(__pyx_v_min_trans, __pyx_t_10, __pyx_mstate_global->__pyx_float_0_0) < 0))) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "H2MM_C.pyx":1940
 *         if self.min_trans is None:
 *             min_trans = np.zeros((nstate,nstate)).astype('double')
 *         elif isinstance(self.min_trans,float):             # <<<<<<<<<<<<<<
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
 *             min_trans[np.eye(nstate)==1] = 0.0
*/
    goto __pyx_L19;
  }

  /* "H2MM_C.pyx":1943
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
 *             min_trans[np.eye(nstate)==1] = 0.0
 *         elif isinstance(self.min_trans, cnp.ndarray) and self.min_trans.ndim == 2 and self.min_trans.shape[0] == self.min_trans.shape[1] == nstate:             # <<<<<<<<<<<<<<
 *             min_trans = self.min_trans.astype('double')
 *         else:
*/
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_10, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1943, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_6)) {
    __Pyx_DECREF(__pyx_t_6);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_10, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1943, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L20_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1944
 *             min_trans[np.eye(nstate)==1] = 0.0
 *         elif isinstance(self.min_trans, cnp.ndarray) and self.min_trans.ndim == 2 and self.min_trans.shape[0] == self.min_trans.shape[1] == nstate:
 *             min_trans = self.min_trans.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of min_trans changed")
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_v_min_trans = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":1943
 *             min_trans = (self.min_trans * np.ones((nstate,nstate))).astype('double')
 *             min_trans[np.eye(nstate)==1] = 0.0
 *         elif isinstance(self.min_trans, cnp.ndarray) and self.min_trans.ndim == 2 and self.min_trans.shape[0] == self.min_trans.shape[1] == nstate:             # <<<<<<<<<<<<<<
 *             min_trans = self.min_trans.astype('double')
 *         else:
*/
    goto __pyx_L19;
  }

  /* "H2MM_C.pyx":1946
 *             min_trans = self.min_trans.astype('double')
 *         else:
 *             raise Exception("Type of min_trans changed")             # <<<<<<<<<<<<<<
 *         if np.any(min_trans.sum(axis=1) > 1.0):
 *             raise Exception("min_trans disallows row stochastic matrix")
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Type_of_min_trans_changed};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1946, __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, 1946, __pyx_L1_error)
  }
  __pyx_L19:;

  /* "H2MM_C.pyx":1947
 *         else:
 *             raise Exception("Type of min_trans changed")
 *         if np.any(min_trans.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *             raise Exception("min_trans disallows row stochastic matrix")
 *         if self.max_trans is None:
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_7 = __pyx_v_min_trans;
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1947, __pyx_L1_error)
    __pyx_t_10 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  }
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, __pyx_mstate_global->__pyx_float_1_0, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11};
    __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1948
 *             raise Exception("Type of min_trans changed")
 *         if np.any(min_trans.sum(axis=1) > 1.0):
 *             raise Exception("min_trans disallows row stochastic matrix")             # <<<<<<<<<<<<<<
 *         if self.max_trans is None:
 *             max_trans = np.ones((nstate,nstate)).astype('double')
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_min_trans_disallows_row_stochast};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1948, __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, 1948, __pyx_L1_error)

    /* "H2MM_C.pyx":1947
 *         else:
 *             raise Exception("Type of min_trans changed")
 *         if np.any(min_trans.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *             raise Exception("min_trans disallows row stochastic matrix")
 *         if self.max_trans is None:
*/
  }

  /* "H2MM_C.pyx":1949
 *         if np.any(min_trans.sum(axis=1) > 1.0):
 *             raise Exception("min_trans disallows row stochastic matrix")
 *         if self.max_trans is None:             # <<<<<<<<<<<<<<
 *             max_trans = np.ones((nstate,nstate)).astype('double')
 *         elif isinstance(self.max_trans,float):
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = (__pyx_t_6 == Py_None);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1950
 *             raise Exception("min_trans disallows row stochastic matrix")
 *         if self.max_trans is None:
 *             max_trans = np.ones((nstate,nstate)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.max_trans,float):
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1950, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1950, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_10};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __pyx_t_8 = __pyx_t_11;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_v_max_trans = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":1949
 *         if np.any(min_trans.sum(axis=1) > 1.0):
 *             raise Exception("min_trans disallows row stochastic matrix")
 *         if self.max_trans is None:             # <<<<<<<<<<<<<<
 *             max_trans = np.ones((nstate,nstate)).astype('double')
 *         elif isinstance(self.max_trans,float):
*/
    goto __pyx_L24;
  }

  /* "H2MM_C.pyx":1951
 *         if self.max_trans is None:
 *             max_trans = np.ones((nstate,nstate)).astype('double')
 *         elif isinstance(self.max_trans,float):             # <<<<<<<<<<<<<<
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
 *             max_trans[np.eye(nstate)==1] = 1.0
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyFloat_Check(__pyx_t_6); 
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1952
 *             max_trans = np.ones((nstate,nstate)).astype('double')
 *         elif isinstance(self.max_trans,float):
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')             # <<<<<<<<<<<<<<
 *             max_trans[np.eye(nstate)==1] = 1.0
 *         elif isinstance(self.max_trans, cnp.ndarray) and self.max_trans.shape[0] == self.max_trans.shape[1] == nstate:
*/
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1952, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1952, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_10);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_v_max_trans = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":1953
 *         elif isinstance(self.max_trans,float):
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
 *             max_trans[np.eye(nstate)==1] = 1.0             # <<<<<<<<<<<<<<
 *         elif isinstance(self.max_trans, cnp.ndarray) and self.max_trans.shape[0] == self.max_trans.shape[1] == nstate:
 *             max_trans = self.max_trans.astype('double')
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_nstate};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_7 = __Pyx_PyLong_EqObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely((PyObject_SetItem(__pyx_v_max_trans, __pyx_t_7, __pyx_mstate_global->__pyx_float_1_0) < 0))) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":1951
 *         if self.max_trans is None:
 *             max_trans = np.ones((nstate,nstate)).astype('double')
 *         elif isinstance(self.max_trans,float):             # <<<<<<<<<<<<<<
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
 *             max_trans[np.eye(nstate)==1] = 1.0
*/
    goto __pyx_L24;
  }

  /* "H2MM_C.pyx":1954
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
 *             max_trans[np.eye(nstate)==1] = 1.0
 *         elif isinstance(self.max_trans, cnp.ndarray) and self.max_trans.shape[0] == self.max_trans.shape[1] == nstate:             # <<<<<<<<<<<<<<
 *             max_trans = self.max_trans.astype('double')
 *         else:
*/
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __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, 1954, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L25_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1955
 *             max_trans[np.eye(nstate)==1] = 1.0
 *         elif isinstance(self.max_trans, cnp.ndarray) and self.max_trans.shape[0] == self.max_trans.shape[1] == nstate:
 *             max_trans = self.max_trans.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of max_trans changed")
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_max_trans = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1954
 *             max_trans = (self.max_trans * np.ones((nstate,nstate))).astype('double')
 *             max_trans[np.eye(nstate)==1] = 1.0
 *         elif isinstance(self.max_trans, cnp.ndarray) and self.max_trans.shape[0] == self.max_trans.shape[1] == nstate:             # <<<<<<<<<<<<<<
 *             max_trans = self.max_trans.astype('double')
 *         else:
*/
    goto __pyx_L24;
  }

  /* "H2MM_C.pyx":1957
 *             max_trans = self.max_trans.astype('double')
 *         else:
 *             raise Exception("Type of max_trans changed")             # <<<<<<<<<<<<<<
 *         if np.any(min_trans > max_trans):
 *             raise ValueError("min_trans cannot be greater than max_trans")
*/
  /*else*/ {
    __pyx_t_7 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Type_of_max_trans_changed};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1957, __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(0, 1957, __pyx_L1_error)
  }
  __pyx_L24:;

  /* "H2MM_C.pyx":1958
 *         else:
 *             raise Exception("Type of max_trans changed")
 *         if np.any(min_trans > max_trans):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_trans cannot be greater than max_trans")
 *         if self.min_obs is None:
*/
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_v_min_trans, __pyx_v_max_trans, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1958, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1959
 *             raise Exception("Type of max_trans changed")
 *         if np.any(min_trans > max_trans):
 *             raise ValueError("min_trans cannot be greater than max_trans")             # <<<<<<<<<<<<<<
 *         if self.min_obs is None:
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
*/
    __pyx_t_11 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_min_trans_cannot_be_greater_than};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __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(0, 1959, __pyx_L1_error)

    /* "H2MM_C.pyx":1958
 *         else:
 *             raise Exception("Type of max_trans changed")
 *         if np.any(min_trans > max_trans):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_trans cannot be greater than max_trans")
 *         if self.min_obs is None:
*/
  }

  /* "H2MM_C.pyx":1960
 *         if np.any(min_trans > max_trans):
 *             raise ValueError("min_trans cannot be greater than max_trans")
 *         if self.min_obs is None:             # <<<<<<<<<<<<<<
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
 *         elif isinstance(self.min_obs,float):
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = (__pyx_t_3 == Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1961
 *             raise ValueError("min_trans cannot be greater than max_trans")
 *         if self.min_obs is None:
 *             min_obs = np.zeros((nstate,ndet)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_obs,float):
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1961, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 1961, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_11 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_min_obs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1960
 *         if np.any(min_trans > max_trans):
 *             raise ValueError("min_trans cannot be greater than max_trans")
 *         if self.min_obs is None:             # <<<<<<<<<<<<<<
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
 *         elif isinstance(self.min_obs,float):
*/
    goto __pyx_L28;
  }

  /* "H2MM_C.pyx":1962
 *         if self.min_obs is None:
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
 *         elif isinstance(self.min_obs,float):             # <<<<<<<<<<<<<<
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_Check(__pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1963
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
 *         elif isinstance(self.min_obs,float):
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:
 *             min_obs = self.min_obs.astype('double')
*/
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_8 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1963, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 1963, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_10 = PyNumber_Multiply(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_10;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_v_min_obs = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":1962
 *         if self.min_obs is None:
 *             min_obs = np.zeros((nstate,ndet)).astype('double')
 *         elif isinstance(self.min_obs,float):             # <<<<<<<<<<<<<<
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:
*/
    goto __pyx_L28;
  }

  /* "H2MM_C.pyx":1964
 *         elif isinstance(self.min_obs,float):
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:             # <<<<<<<<<<<<<<
 *             min_obs = self.min_obs.astype('double')
 *         else:
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_10, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1964, __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_L29_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_10, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_v_ndet, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1964, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L29_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1965
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:
 *             min_obs = self.min_obs.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of min_obs changed")
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_v_min_obs = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "H2MM_C.pyx":1964
 *         elif isinstance(self.min_obs,float):
 *             min_obs = (self.min_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.min_obs, cnp.ndarray) and self.min_obs.ndim == 2 and self.min_obs.shape[0] == nstate and self.min_obs.shape[1] == ndet:             # <<<<<<<<<<<<<<
 *             min_obs = self.min_obs.astype('double')
 *         else:
*/
    goto __pyx_L28;
  }

  /* "H2MM_C.pyx":1967
 *             min_obs = self.min_obs.astype('double')
 *         else:
 *             raise Exception("Type of min_obs changed")             # <<<<<<<<<<<<<<
 *         if np.any(min_obs.sum(axis=1) > 1.0):
 *             raise ValueError("min_obs disallows row stochastic matrix")
*/
  /*else*/ {
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Type_of_min_obs_changed};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1967, __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(0, 1967, __pyx_L1_error)
  }
  __pyx_L28:;

  /* "H2MM_C.pyx":1968
 *         else:
 *             raise Exception("Type of min_obs changed")
 *         if np.any(min_obs.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_obs disallows row stochastic matrix")
 *         if self.max_obs is None:
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_11 = __pyx_v_min_obs;
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_11, NULL};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_mstate_global->__pyx_float_1_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1968, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
    __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1968, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1968, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1969
 *             raise Exception("Type of min_obs changed")
 *         if np.any(min_obs.sum(axis=1) > 1.0):
 *             raise ValueError("min_obs disallows row stochastic matrix")             # <<<<<<<<<<<<<<
 *         if self.max_obs is None:
 *             min_obs = np.ones((nstate,ndet)).astype('double')
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_min_obs_disallows_row_stochastic};
      __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1969, __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(0, 1969, __pyx_L1_error)

    /* "H2MM_C.pyx":1968
 *         else:
 *             raise Exception("Type of min_obs changed")
 *         if np.any(min_obs.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *             raise ValueError("min_obs disallows row stochastic matrix")
 *         if self.max_obs is None:
*/
  }

  /* "H2MM_C.pyx":1970
 *         if np.any(min_obs.sum(axis=1) > 1.0):
 *             raise ValueError("min_obs disallows row stochastic matrix")
 *         if self.max_obs is None:             # <<<<<<<<<<<<<<
 *             min_obs = np.ones((nstate,ndet)).astype('double')
 *         elif isinstance(self.max_obs,float):
*/
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = (__pyx_t_10 == Py_None);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1971
 *             raise ValueError("min_obs disallows row stochastic matrix")
 *         if self.max_obs is None:
 *             min_obs = np.ones((nstate,ndet)).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.max_obs,float):
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1971, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 1971, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_3};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1971, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_4 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1971, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __Pyx_DECREF_SET(__pyx_v_min_obs, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "H2MM_C.pyx":1970
 *         if np.any(min_obs.sum(axis=1) > 1.0):
 *             raise ValueError("min_obs disallows row stochastic matrix")
 *         if self.max_obs is None:             # <<<<<<<<<<<<<<
 *             min_obs = np.ones((nstate,ndet)).astype('double')
 *         elif isinstance(self.max_obs,float):
*/
    goto __pyx_L34;
  }

  /* "H2MM_C.pyx":1972
 *         if self.max_obs is None:
 *             min_obs = np.ones((nstate,ndet)).astype('double')
 *         elif isinstance(self.max_obs,float):             # <<<<<<<<<<<<<<
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:
*/
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyFloat_Check(__pyx_t_10); 
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1973
 *             min_obs = np.ones((nstate,ndet)).astype('double')
 *         elif isinstance(self.max_obs,float):
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')             # <<<<<<<<<<<<<<
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:
 *             max_obs = self.max_obs.astype('double')
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 1973, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 1973, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    }
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_7 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_v_max_obs = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "H2MM_C.pyx":1972
 *         if self.max_obs is None:
 *             min_obs = np.ones((nstate,ndet)).astype('double')
 *         elif isinstance(self.max_obs,float):             # <<<<<<<<<<<<<<
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:
*/
    goto __pyx_L34;
  }

  /* "H2MM_C.pyx":1974
 *         elif isinstance(self.max_obs,float):
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:             # <<<<<<<<<<<<<<
 *             max_obs = self.max_obs.astype('double')
 *         else:
*/
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_10, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_8, __pyx_v_nstate, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_10, __pyx_v_ndet, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_2 = __pyx_t_1;
  __pyx_L35_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "H2MM_C.pyx":1975
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:
 *             max_obs = self.max_obs.astype('double')             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("Type of max_obs changed")
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_n_u_double};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_v_max_obs = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "H2MM_C.pyx":1974
 *         elif isinstance(self.max_obs,float):
 *             max_obs = (self.max_obs * np.ones((nstate,ndet))).astype('double')
 *         elif isinstance(self.max_obs, cnp.ndarray) and self.max_obs.ndim == 2 and self.max_obs.shape[0] == nstate and self.max_obs.shape[1] == ndet:             # <<<<<<<<<<<<<<
 *             max_obs = self.max_obs.astype('double')
 *         else:
*/
    goto __pyx_L34;
  }

  /* "H2MM_C.pyx":1977
 *             max_obs = self.max_obs.astype('double')
 *         else:
 *             raise Exception("Type of max_obs changed")             # <<<<<<<<<<<<<<
 *         # chekcing model bounds
 *         if warning:
*/
  /*else*/ {
    __pyx_t_7 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Type_of_max_obs_changed};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_Exception)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1977, __pyx_L1_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(0, 1977, __pyx_L1_error)
  }
  __pyx_L34:;

  /* "H2MM_C.pyx":1979
 *             raise Exception("Type of max_obs changed")
 *         # chekcing model bounds
 *         if warning:             # <<<<<<<<<<<<<<
 *             if np.any(max_obs.sum(axis=1) < 1.0):
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_warning); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1979, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":1980
 *         # chekcing model bounds
 *         if warning:
 *             if np.any(max_obs.sum(axis=1) < 1.0):             # <<<<<<<<<<<<<<
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
 *             if np.any(min_obs > max_obs):
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_v_max_obs)) { __Pyx_RaiseUnboundLocalError("max_obs"); __PYX_ERR(0, 1980, __pyx_L1_error) }
    __pyx_t_4 = __pyx_v_max_obs;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, NULL};
      __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1980, __pyx_L1_error)
      __pyx_t_10 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __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_10)) __PYX_ERR(0, 1980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_10, __pyx_mstate_global->__pyx_float_1_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "H2MM_C.pyx":1981
 *         if warning:
 *             if np.any(max_obs.sum(axis=1) < 1.0):
 *                 raise ValueError("max_obs dissallows row stochastic matrix")             # <<<<<<<<<<<<<<
 *             if np.any(min_obs > max_obs):
 *                 raise ValueError("min_obs cannot be greater than max_obs")
*/
      __pyx_t_11 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_max_obs_dissallows_row_stochasti};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1981, __pyx_L1_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(0, 1981, __pyx_L1_error)

      /* "H2MM_C.pyx":1980
 *         # chekcing model bounds
 *         if warning:
 *             if np.any(max_obs.sum(axis=1) < 1.0):             # <<<<<<<<<<<<<<
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
 *             if np.any(min_obs > max_obs):
*/
    }

    /* "H2MM_C.pyx":1982
 *             if np.any(max_obs.sum(axis=1) < 1.0):
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
 *             if np.any(min_obs > max_obs):             # <<<<<<<<<<<<<<
 *                 raise ValueError("min_obs cannot be greater than max_obs")
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
*/
    __pyx_t_11 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_v_max_obs)) { __Pyx_RaiseUnboundLocalError("max_obs"); __PYX_ERR(0, 1982, __pyx_L1_error) }
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_min_obs, __pyx_v_max_obs, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_11);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1982, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "H2MM_C.pyx":1983
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
 *             if np.any(min_obs > max_obs):
 *                 raise ValueError("min_obs cannot be greater than max_obs")             # <<<<<<<<<<<<<<
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
*/
      __pyx_t_7 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_min_obs_cannot_be_greater_than_m};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1983, __pyx_L1_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(0, 1983, __pyx_L1_error)

      /* "H2MM_C.pyx":1982
 *             if np.any(max_obs.sum(axis=1) < 1.0):
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
 *             if np.any(min_obs > max_obs):             # <<<<<<<<<<<<<<
 *                 raise ValueError("min_obs cannot be greater than max_obs")
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
*/
    }

    /* "H2MM_C.pyx":1984
 *             if np.any(min_obs > max_obs):
 *                 raise ValueError("min_obs cannot be greater than max_obs")
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_min_prior, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_10};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L43_bool_binop_done;
    }
    __pyx_t_11 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_prior); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_max_prior, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_11);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_6};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1984, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L43_bool_binop_done:;
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":1985
 *                 raise ValueError("min_obs cannot be greater than max_obs")
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")             # <<<<<<<<<<<<<<
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1985, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1985, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Initial_model_out_of_min_max_pri};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "H2MM_C.pyx":1984
 *             if np.any(min_obs > max_obs):
 *                 raise ValueError("min_obs cannot be greater than max_obs")
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
*/
    }

    /* "H2MM_C.pyx":1986
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):
*/
    __pyx_t_11 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_min_trans, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_11);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_10};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L46_bool_binop_done;
    }
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_trans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_max_trans, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L46_bool_binop_done:;
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":1987
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")             # <<<<<<<<<<<<<<
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):
 *                 warnings.warn("Initial model out of min/max obs range, will result in undefined behavior")
*/
      __pyx_t_11 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_11);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Initial_model_out_of_min_max_tra};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1987, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "H2MM_C.pyx":1986
 *             if np.any(min_prior > model.prior) or np.any(max_prior < model.prior):
 *                 warnings.warn("Initial model out of min/max prior range, will result in undefined behavior")
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):
*/
    }

    /* "H2MM_C.pyx":1988
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max obs range, will result in undefined behavior")
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_min_obs, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L49_bool_binop_done;
    }
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_v_max_obs)) { __Pyx_RaiseUnboundLocalError("max_obs"); __PYX_ERR(0, 1988, __pyx_L1_error) }
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_mstate_global->__pyx_n_u_obs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyObject_RichCompare(__pyx_v_max_obs, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_11};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1988, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L49_bool_binop_done:;
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":1989
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):
 *                 warnings.warn("Initial model out of min/max obs range, will result in undefined behavior")             # <<<<<<<<<<<<<<
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
 * 
*/
      __pyx_t_6 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_6);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Initial_model_out_of_min_max_obs};
        __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "H2MM_C.pyx":1988
 *             if np.any(min_trans > model.trans) or np.any(max_trans < model.trans):
 *                 warnings.warn("Initial model out of min/max trans range, will result in undefined behavior")
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):             # <<<<<<<<<<<<<<
 *                 warnings.warn("Initial model out of min/max obs range, will result in undefined behavior")
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
*/
    }

    /* "H2MM_C.pyx":1979
 *             raise Exception("Type of max_obs changed")
 *         # chekcing model bounds
 *         if warning:             # <<<<<<<<<<<<<<
 *             if np.any(max_obs.sum(axis=1) < 1.0):
 *                 raise ValueError("max_obs dissallows row stochastic matrix")
*/
  }

  /* "H2MM_C.pyx":1990
 *             if np.any(min_obs > model.obs) or np.any(max_obs < model.obs):
 *                 warnings.warn("Initial model out of min/max obs range, will result in undefined behavior")
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs             # <<<<<<<<<<<<<<
 * 
 *     def _make_model(self, h2mm_model model):
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_max_obs)) { __Pyx_RaiseUnboundLocalError("max_obs"); __PYX_ERR(0, 1990, __pyx_L1_error) }
  __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_min_prior);
  __Pyx_GIVEREF(__pyx_v_min_prior);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_min_prior) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_prior);
  __Pyx_GIVEREF(__pyx_v_max_prior);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_max_prior) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_min_trans);
  __Pyx_GIVEREF(__pyx_v_min_trans);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_min_trans) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_trans);
  __Pyx_GIVEREF(__pyx_v_max_trans);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_max_trans) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_min_obs);
  __Pyx_GIVEREF(__pyx_v_min_obs);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_min_obs) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_max_obs);
  __Pyx_GIVEREF(__pyx_v_max_obs);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_max_obs) != (0)) __PYX_ERR(0, 1990, __pyx_L1_error);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":1873
 *         self.model = model
 * 
 *     def make_model(self, model, warning=True):             # <<<<<<<<<<<<<<
 *         """
 *         Method for checking the limits arrays generated from the input model
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("H2MM_C.h2mm_limits.make_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ndet);
  __Pyx_XDECREF(__pyx_v_nstate);
  __Pyx_XDECREF(__pyx_v_min_prior);
  __Pyx_XDECREF(__pyx_v_max_prior);
  __Pyx_XDECREF(__pyx_v_min_trans);
  __Pyx_XDECREF(__pyx_v_max_trans);
  __Pyx_XDECREF(__pyx_v_min_obs);
  __Pyx_XDECREF(__pyx_v_max_obs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":1992
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
 * 
 *     def _make_model(self, h2mm_model model):             # <<<<<<<<<<<<<<
 *         """
 *         Hidden method identical to make_model, except returns the hidden class
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_5_make_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_11h2mm_limits_4_make_model, "\n        Hidden method identical to make_model, except returns the hidden class\n        _h2mm_lims, which is a wrapper for the C-level h2mm_minmax structure\n        that the C code uses\n        Parameters\n        ----------\n        model : h2mm_model\n            Model to be optimized with limits\n        Raises\n        ------\n        Exception\n            When there is a wrong type or other issue\n        ValueError\n            When mismatch between limits streams and model streams\n        Returns\n        -------\n        _h2mm_lims\n            wrapper for the C-level h2mm_minmax structure that does the limiting\n            of the model\n        ");
static PyMethodDef __pyx_mdef_6H2MM_C_11h2mm_limits_5_make_model = {"_make_model", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_11h2mm_limits_5_make_model, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_11h2mm_limits_4_make_model};
static PyObject *__pyx_pw_6H2MM_C_11h2mm_limits_5_make_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_self = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_model (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_self,&__pyx_mstate_global->__pyx_n_u_model,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1992, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1992, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1992, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_make_model", 0) < (0)) __PYX_ERR(0, 1992, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_make_model", 1, 2, 2, i); __PYX_ERR(0, 1992, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 2)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1992, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1992, __pyx_L3_error)
    }
    __pyx_v_self = values[0];
    __pyx_v_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[1]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_make_model", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1992, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.h2mm_limits._make_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "model", 0))) __PYX_ERR(0, 1992, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_11h2mm_limits_4_make_model(__pyx_self, __pyx_v_self, __pyx_v_model);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_11h2mm_limits_4_make_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_model", 0);

  /* "H2MM_C.pyx":2013
 *             of the model
 *         """
 *         return _h2mm_lims(model,  *self.make_model(model))             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF((PyObject *)__pyx_v_model);
  __Pyx_GIVEREF((PyObject *)__pyx_v_model);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_model)) != (0)) __PYX_ERR(0, 2013, __pyx_L1_error);
  __pyx_t_3 = __pyx_v_self;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_model)};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_make_model, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2013, __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, 2013, __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 = __Pyx_PyObject_Call(((PyObject *)__pyx_mstate_global->__pyx_ptype_6H2MM_C__h2mm_lims), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2013, __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;

  /* "H2MM_C.pyx":1992
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
 * 
 *     def _make_model(self, h2mm_model model):             # <<<<<<<<<<<<<<
 *         """
 *         Hidden method identical to make_model, except returns the hidden class
*/

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

/* "H2MM_C.pyx":2016
 * 
 * 
 * def factory_h2mm_model(nstate, ndet, bounds=None, trans_scale=1e-5,             # <<<<<<<<<<<<<<
 *                   prior_dist='equal', trans_dist='equal',obs_dist='equal'):
 *     """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_9factory_h2mm_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_8factory_h2mm_model, "\n    Function for generating a model of an arbitrary number of states/streams\n\n    Parameters\n    ----------\n    nstate : int\n        Number of states in the return model\n    ndet : int, optional\n        Number of photons streams in the return model\n    bounds : h2mm_limits or None, optional\n        The limits expected to be used when optimizing the model. For limits\n        are given, the model will always be within those limits, distribution of\n        states within the model will depend on how \n        The default is None.\n    trans_scale: float\n        Only used when no :class:`h2mm_limits` object is supplied to bounds, sets the\n        minimum (slowest) transition rates in the trans array\n    prior_dist : 'even' or 'random', optional\n        Define how to distribute prior states. options are 'equal' and 'random'\n        The default is 'equal'.\n    trans_dist : 'even' or 'random', optional\n        Define how to distribute trans states. options are 'equal' and 'random'\n        The default is 'equal'.\n    obs_dist : 'even' or 'random', optional\n        Define how to distribute obs states. options are 'equal' and 'random'\n        The default is 'equal'.\n\n    Returns\n    -------\n    model : h2MM_model\n        An :class:`h2mm_model` object ready for optimization\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_9factory_h2mm_model = {"factory_h2mm_model", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_9factory_h2mm_model, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_8factory_h2mm_model};
static PyObject *__pyx_pw_6H2MM_C_9factory_h2mm_model(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_nstate = 0;
  PyObject *__pyx_v_ndet = 0;
  PyObject *__pyx_v_bounds = 0;
  PyObject *__pyx_v_trans_scale = 0;
  PyObject *__pyx_v_prior_dist = 0;
  PyObject *__pyx_v_trans_dist = 0;
  PyObject *__pyx_v_obs_dist = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factory_h2mm_model (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_nstate,&__pyx_mstate_global->__pyx_n_u_ndet_2,&__pyx_mstate_global->__pyx_n_u_bounds,&__pyx_mstate_global->__pyx_n_u_trans_scale,&__pyx_mstate_global->__pyx_n_u_prior_dist,&__pyx_mstate_global->__pyx_n_u_trans_dist,&__pyx_mstate_global->__pyx_n_u_obs_dist,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2016, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "factory_h2mm_model", 0) < (0)) __PYX_ERR(0, 2016, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_5)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("factory_h2mm_model", 0, 2, 7, i); __PYX_ERR(0, 2016, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2016, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2016, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2016, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_5)));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)));
    }
    __pyx_v_nstate = values[0];
    __pyx_v_ndet = values[1];
    __pyx_v_bounds = values[2];
    __pyx_v_trans_scale = values[3];
    __pyx_v_prior_dist = values[4];
    __pyx_v_trans_dist = values[5];
    __pyx_v_obs_dist = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factory_h2mm_model", 0, 2, 7, __pyx_nargs); __PYX_ERR(0, 2016, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.factory_h2mm_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_8factory_h2mm_model(__pyx_self, __pyx_v_nstate, __pyx_v_ndet, __pyx_v_bounds, __pyx_v_trans_scale, __pyx_v_prior_dist, __pyx_v_trans_dist, __pyx_v_obs_dist);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_8factory_h2mm_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nstate, PyObject *__pyx_v_ndet, PyObject *__pyx_v_bounds, PyObject *__pyx_v_trans_scale, PyObject *__pyx_v_prior_dist, PyObject *__pyx_v_trans_dist, PyObject *__pyx_v_obs_dist) {
  PyArrayObject *__pyx_v_prior = 0;
  PyArrayObject *__pyx_v_min_prior = 0;
  PyArrayObject *__pyx_v_max_prior = 0;
  PyArrayObject *__pyx_v_trans = 0;
  PyArrayObject *__pyx_v_min_trans = 0;
  PyArrayObject *__pyx_v_max_trans = 0;
  PyArrayObject *__pyx_v_obs = 0;
  PyArrayObject *__pyx_v_min_obs = 0;
  PyArrayObject *__pyx_v_max_obs = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_const_obs = NULL;
  PyObject *__pyx_v_prior_alpha = NULL;
  PyObject *__pyx_v_prior_beta = NULL;
  PyObject *__pyx_v_prior_sigma = NULL;
  PyObject *__pyx_v_obs_alpha = NULL;
  PyObject *__pyx_v_obs_beta = NULL;
  PyObject *__pyx_v_obs_sigma = NULL;
  PyObject *__pyx_v_sort = NULL;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_obs;
  __Pyx_Buffer __pyx_pybuffer_max_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_prior;
  __Pyx_Buffer __pyx_pybuffer_max_prior;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_max_trans;
  __Pyx_Buffer __pyx_pybuffer_max_trans;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_obs;
  __Pyx_Buffer __pyx_pybuffer_min_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_prior;
  __Pyx_Buffer __pyx_pybuffer_min_prior;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_min_trans;
  __Pyx_Buffer __pyx_pybuffer_min_trans;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_obs;
  __Pyx_Buffer __pyx_pybuffer_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_prior;
  __Pyx_Buffer __pyx_pybuffer_prior;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_trans;
  __Pyx_Buffer __pyx_pybuffer_trans;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  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 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("factory_h2mm_model", 0);
  __pyx_pybuffer_prior.pybuffer.buf = NULL;
  __pyx_pybuffer_prior.refcount = 0;
  __pyx_pybuffernd_prior.data = NULL;
  __pyx_pybuffernd_prior.rcbuffer = &__pyx_pybuffer_prior;
  __pyx_pybuffer_min_prior.pybuffer.buf = NULL;
  __pyx_pybuffer_min_prior.refcount = 0;
  __pyx_pybuffernd_min_prior.data = NULL;
  __pyx_pybuffernd_min_prior.rcbuffer = &__pyx_pybuffer_min_prior;
  __pyx_pybuffer_max_prior.pybuffer.buf = NULL;
  __pyx_pybuffer_max_prior.refcount = 0;
  __pyx_pybuffernd_max_prior.data = NULL;
  __pyx_pybuffernd_max_prior.rcbuffer = &__pyx_pybuffer_max_prior;
  __pyx_pybuffer_trans.pybuffer.buf = NULL;
  __pyx_pybuffer_trans.refcount = 0;
  __pyx_pybuffernd_trans.data = NULL;
  __pyx_pybuffernd_trans.rcbuffer = &__pyx_pybuffer_trans;
  __pyx_pybuffer_min_trans.pybuffer.buf = NULL;
  __pyx_pybuffer_min_trans.refcount = 0;
  __pyx_pybuffernd_min_trans.data = NULL;
  __pyx_pybuffernd_min_trans.rcbuffer = &__pyx_pybuffer_min_trans;
  __pyx_pybuffer_max_trans.pybuffer.buf = NULL;
  __pyx_pybuffer_max_trans.refcount = 0;
  __pyx_pybuffernd_max_trans.data = NULL;
  __pyx_pybuffernd_max_trans.rcbuffer = &__pyx_pybuffer_max_trans;
  __pyx_pybuffer_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_obs.refcount = 0;
  __pyx_pybuffernd_obs.data = NULL;
  __pyx_pybuffernd_obs.rcbuffer = &__pyx_pybuffer_obs;
  __pyx_pybuffer_min_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_min_obs.refcount = 0;
  __pyx_pybuffernd_min_obs.data = NULL;
  __pyx_pybuffernd_min_obs.rcbuffer = &__pyx_pybuffer_min_obs;
  __pyx_pybuffer_max_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_max_obs.refcount = 0;
  __pyx_pybuffernd_max_obs.data = NULL;
  __pyx_pybuffernd_max_obs.rcbuffer = &__pyx_pybuffer_max_obs;

  /* "H2MM_C.pyx":2056
 *     cdef cnp.ndarray[double,ndim=2] obs, min_obs, max_obs
 *     cdef Py_ssize_t i
 *     if prior_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("prior_dist must be 'equal' or 'random'")
 *     if trans_dist not in ['equal', 'random']:
*/
  __Pyx_INCREF(__pyx_v_prior_dist);
  __pyx_t_1 = __pyx_v_prior_dist;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_equal, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2056, __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_mstate_global->__pyx_n_u_random, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2056, __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;
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2057
 *     cdef Py_ssize_t i
 *     if prior_dist not in ['equal', 'random']:
 *         raise TypeError("prior_dist must be 'equal' or 'random'")             # <<<<<<<<<<<<<<
 *     if trans_dist not in ['equal', 'random']:
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_prior_dist_must_be_equal_or_rand};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2057, __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, 2057, __pyx_L1_error)

    /* "H2MM_C.pyx":2056
 *     cdef cnp.ndarray[double,ndim=2] obs, min_obs, max_obs
 *     cdef Py_ssize_t i
 *     if prior_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("prior_dist must be 'equal' or 'random'")
 *     if trans_dist not in ['equal', 'random']:
*/
  }

  /* "H2MM_C.pyx":2058
 *     if prior_dist not in ['equal', 'random']:
 *         raise TypeError("prior_dist must be 'equal' or 'random'")
 *     if trans_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
 *     if obs_dist not in ['equal', 'random']:
*/
  __Pyx_INCREF(__pyx_v_trans_dist);
  __pyx_t_1 = __pyx_v_trans_dist;
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_equal, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2058, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_random, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2058, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  if (unlikely(__pyx_t_2)) {

    /* "H2MM_C.pyx":2059
 *         raise TypeError("prior_dist must be 'equal' or 'random'")
 *     if trans_dist not in ['equal', 'random']:
 *         raise TypeError("trans_dist must be 'equal' or 'random'")             # <<<<<<<<<<<<<<
 *     if obs_dist not in ['equal', 'random']:
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_trans_dist_must_be_equal_or_rand};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2059, __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, 2059, __pyx_L1_error)

    /* "H2MM_C.pyx":2058
 *     if prior_dist not in ['equal', 'random']:
 *         raise TypeError("prior_dist must be 'equal' or 'random'")
 *     if trans_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
 *     if obs_dist not in ['equal', 'random']:
*/
  }

  /* "H2MM_C.pyx":2060
 *     if trans_dist not in ['equal', 'random']:
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
 *     if obs_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:
*/
  __Pyx_INCREF(__pyx_v_obs_dist);
  __pyx_t_1 = __pyx_v_obs_dist;
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_equal, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2060, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_random, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2060, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2061
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
 *     if obs_dist not in ['equal', 'random']:
 *         raise TypeError("obs_dist must be 'equal' or 'random'")             # <<<<<<<<<<<<<<
 *     if type(bounds) == h2mm_limits:
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_obs_dist_must_be_equal_or_random};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __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, 2061, __pyx_L1_error)

    /* "H2MM_C.pyx":2060
 *     if trans_dist not in ['equal', 'random']:
 *         raise TypeError("trans_dist must be 'equal' or 'random'")
 *     if obs_dist not in ['equal', 'random']:             # <<<<<<<<<<<<<<
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:
*/
  }

  /* "H2MM_C.pyx":2062
 *     if obs_dist not in ['equal', 'random']:
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:             # <<<<<<<<<<<<<<
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
 *             raise ValueError("bounds streams incompatible with model")
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_h2mm_limits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_bounds)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2062, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2062, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2063
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError("bounds streams incompatible with model")
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:
*/
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;
    if (unlikely(__pyx_t_3)) {

      /* "H2MM_C.pyx":2064
 *     if type(bounds) == h2mm_limits:
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
 *             raise ValueError("bounds streams incompatible with model")             # <<<<<<<<<<<<<<
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:
 *             raise ValueError("bounds states incompatible with model")
*/
      __pyx_t_1 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_bounds_streams_incompatible_with};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2064, __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, 2064, __pyx_L1_error)

      /* "H2MM_C.pyx":2063
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:             # <<<<<<<<<<<<<<
 *             raise ValueError("bounds streams incompatible with model")
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:
*/
    }

    /* "H2MM_C.pyx":2065
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
 *             raise ValueError("bounds streams incompatible with model")
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("bounds states incompatible with model")
 *         # setup min/max arrays from limits
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_2;
    __pyx_L17_bool_binop_done:;
    if (unlikely(__pyx_t_3)) {

      /* "H2MM_C.pyx":2066
 *             raise ValueError("bounds streams incompatible with model")
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:
 *             raise ValueError("bounds states incompatible with model")             # <<<<<<<<<<<<<<
 *         # setup min/max arrays from limits
 *         min_prior = np.ones(nstate) * bounds.min_prior
*/
      __pyx_t_1 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_bounds_states_incompatible_with};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2066, __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, 2066, __pyx_L1_error)

      /* "H2MM_C.pyx":2065
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
 *             raise ValueError("bounds streams incompatible with model")
 *         if bounds.nstate != 0 and bounds.nstate != bounds.nstate:             # <<<<<<<<<<<<<<
 *             raise ValueError("bounds states incompatible with model")
 *         # setup min/max arrays from limits
*/
    }

    /* "H2MM_C.pyx":2068
 *             raise ValueError("bounds states incompatible with model")
 *         # setup min/max arrays from limits
 *         min_prior = np.ones(nstate) * bounds.min_prior             # <<<<<<<<<<<<<<
 *         max_prior = np.ones(nstate) * bounds.max_prior
 *         min_trans = np.ones((nstate,nstate)) * bounds.min_trans
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_nstate};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_min_prior); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2068, __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;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2068, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, 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_min_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_prior, &__Pyx_TypeInfo_double, 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_min_prior.diminfo[0].strides = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_prior.diminfo[0].shape = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2068, __pyx_L1_error)
    }
    __pyx_v_min_prior = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2069
 *         # setup min/max arrays from limits
 *         min_prior = np.ones(nstate) * bounds.min_prior
 *         max_prior = np.ones(nstate) * bounds.max_prior             # <<<<<<<<<<<<<<
 *         min_trans = np.ones((nstate,nstate)) * bounds.min_trans
 *         min_trans[min_trans==0.0] = trans_scale
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_nstate};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2069, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_max_prior); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2069, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_prior.diminfo[0].strides = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_prior.diminfo[0].shape = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2069, __pyx_L1_error)
    }
    __pyx_v_max_prior = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2070
 *         min_prior = np.ones(nstate) * bounds.min_prior
 *         max_prior = np.ones(nstate) * bounds.max_prior
 *         min_trans = np.ones((nstate,nstate)) * bounds.min_trans             # <<<<<<<<<<<<<<
 *         min_trans[min_trans==0.0] = trans_scale
 *         max_trans = np.ones((nstate,nstate)) * bounds.max_trans
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2070, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2070, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2070, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_min_trans); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2070, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_trans.diminfo[0].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_trans.diminfo[0].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_trans.diminfo[1].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_trans.diminfo[1].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2070, __pyx_L1_error)
    }
    __pyx_v_min_trans = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2071
 *         max_prior = np.ones(nstate) * bounds.max_prior
 *         min_trans = np.ones((nstate,nstate)) * bounds.min_trans
 *         min_trans[min_trans==0.0] = trans_scale             # <<<<<<<<<<<<<<
 *         max_trans = np.ones((nstate,nstate)) * bounds.max_trans
 *         max_trans[max_trans==1.0] = trans_scale
*/
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_min_trans), __pyx_mstate_global->__pyx_float_0_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2071, __pyx_L1_error)
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_min_trans), __pyx_t_1, __pyx_v_trans_scale) < 0))) __PYX_ERR(0, 2071, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2072
 *         min_trans = np.ones((nstate,nstate)) * bounds.min_trans
 *         min_trans[min_trans==0.0] = trans_scale
 *         max_trans = np.ones((nstate,nstate)) * bounds.max_trans             # <<<<<<<<<<<<<<
 *         max_trans[max_trans==1.0] = trans_scale
 *         min_obs = np.ones((nstate,ndet)) * bounds.min_obs
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2072, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2072, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2072, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_max_trans); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2072, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_trans.diminfo[0].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_trans.diminfo[0].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_trans.diminfo[1].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_trans.diminfo[1].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2072, __pyx_L1_error)
    }
    __pyx_v_max_trans = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2073
 *         min_trans[min_trans==0.0] = trans_scale
 *         max_trans = np.ones((nstate,nstate)) * bounds.max_trans
 *         max_trans[max_trans==1.0] = trans_scale             # <<<<<<<<<<<<<<
 *         min_obs = np.ones((nstate,ndet)) * bounds.min_obs
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs
*/
    __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_max_trans), __pyx_mstate_global->__pyx_float_1_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2073, __pyx_L1_error)
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_max_trans), __pyx_t_7, __pyx_v_trans_scale) < 0))) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2074
 *         max_trans = np.ones((nstate,nstate)) * bounds.max_trans
 *         max_trans[max_trans==1.0] = trans_scale
 *         min_obs = np.ones((nstate,ndet)) * bounds.min_obs             # <<<<<<<<<<<<<<
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2074, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 2074, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2074, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_obs.diminfo[0].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_obs.diminfo[0].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_obs.diminfo[1].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_obs.diminfo[1].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2074, __pyx_L1_error)
    }
    __pyx_v_min_obs = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2075
 *         max_trans[max_trans==1.0] = trans_scale
 *         min_obs = np.ones((nstate,ndet)) * bounds.min_obs
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs             # <<<<<<<<<<<<<<
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float
 *     elif bounds is not None:
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2075, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 2075, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2075, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2075, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_obs.diminfo[0].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_obs.diminfo[0].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_obs.diminfo[1].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_obs.diminfo[1].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2075, __pyx_L1_error)
    }
    __pyx_v_max_obs = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2076
 *         min_obs = np.ones((nstate,ndet)) * bounds.min_obs
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float             # <<<<<<<<<<<<<<
 *     elif bounds is not None:
 *         raise TypeError("bounds must be None or h2mm_limits object")
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_min_obs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_6)), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2076, __pyx_L1_error)
    if (__pyx_t_3) {
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_7 = __pyx_t_1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_bounds, __pyx_mstate_global->__pyx_n_u_max_obs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_1)), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_L19_bool_binop_done:;
    __pyx_v_const_obs = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2062
 *     if obs_dist not in ['equal', 'random']:
 *         raise TypeError("obs_dist must be 'equal' or 'random'")
 *     if type(bounds) == h2mm_limits:             # <<<<<<<<<<<<<<
 *         if bounds.ndet != 0 and bounds.ndet != bounds.ndet:
 *             raise ValueError("bounds streams incompatible with model")
*/
    goto __pyx_L12;
  }

  /* "H2MM_C.pyx":2077
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float
 *     elif bounds is not None:             # <<<<<<<<<<<<<<
 *         raise TypeError("bounds must be None or h2mm_limits object")
 *     else:
*/
  __pyx_t_3 = (__pyx_v_bounds != Py_None);
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2078
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float
 *     elif bounds is not None:
 *         raise TypeError("bounds must be None or h2mm_limits object")             # <<<<<<<<<<<<<<
 *     else:
 *         # setup min/max arrays with 0/1 as bounds
*/
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_bounds_must_be_None_or_h2mm_limi};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 2078, __pyx_L1_error)

    /* "H2MM_C.pyx":2077
 *         max_obs = np.ones((nstate,ndet)) * bounds.max_obs
 *         const_obs = type(bounds.min_obs) == float and type(bounds.max_obs) == float
 *     elif bounds is not None:             # <<<<<<<<<<<<<<
 *         raise TypeError("bounds must be None or h2mm_limits object")
 *     else:
*/
  }

  /* "H2MM_C.pyx":2081
 *     else:
 *         # setup min/max arrays with 0/1 as bounds
 *         min_prior = np.zeros(nstate)             # <<<<<<<<<<<<<<
 *         max_prior = np.ones(nstate)
 *         min_trans = np.ones((nstate,nstate)) * trans_scale
*/
  /*else*/ {
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_nstate};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2081, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, 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_min_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_prior, &__Pyx_TypeInfo_double, 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_min_prior.diminfo[0].strides = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_prior.diminfo[0].shape = __pyx_pybuffernd_min_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2081, __pyx_L1_error)
    }
    __pyx_v_min_prior = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2082
 *         # setup min/max arrays with 0/1 as bounds
 *         min_prior = np.zeros(nstate)
 *         max_prior = np.ones(nstate)             # <<<<<<<<<<<<<<
 *         min_trans = np.ones((nstate,nstate)) * trans_scale
 *         max_trans = np.ones((nstate,nstate)) * trans_scale
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_nstate};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2082, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_prior.diminfo[0].strides = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_prior.diminfo[0].shape = __pyx_pybuffernd_max_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2082, __pyx_L1_error)
    }
    __pyx_v_max_prior = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2083
 *         min_prior = np.zeros(nstate)
 *         max_prior = np.ones(nstate)
 *         min_trans = np.ones((nstate,nstate)) * trans_scale             # <<<<<<<<<<<<<<
 *         max_trans = np.ones((nstate,nstate)) * trans_scale
 *         min_obs = np.zeros((nstate,ndet))
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2083, __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, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2083, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2083, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_7, __pyx_v_trans_scale); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2083, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_trans.diminfo[0].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_trans.diminfo[0].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_trans.diminfo[1].strides = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_trans.diminfo[1].shape = __pyx_pybuffernd_min_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2083, __pyx_L1_error)
    }
    __pyx_v_min_trans = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":2084
 *         max_prior = np.ones(nstate)
 *         min_trans = np.ones((nstate,nstate)) * trans_scale
 *         max_trans = np.ones((nstate,nstate)) * trans_scale             # <<<<<<<<<<<<<<
 *         min_obs = np.zeros((nstate,ndet))
 *         max_obs = np.ones((nstate,ndet))
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2084, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2084, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2084, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_v_trans_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2084, __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_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2084, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_trans.diminfo[0].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_trans.diminfo[0].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_trans.diminfo[1].strides = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_trans.diminfo[1].shape = __pyx_pybuffernd_max_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2084, __pyx_L1_error)
    }
    __pyx_v_max_trans = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2085
 *         min_trans = np.ones((nstate,nstate)) * trans_scale
 *         max_trans = np.ones((nstate,nstate)) * trans_scale
 *         min_obs = np.zeros((nstate,ndet))             # <<<<<<<<<<<<<<
 *         max_obs = np.ones((nstate,ndet))
 *         const_obs = True
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2085, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 2085, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2085, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_min_obs.diminfo[0].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_obs.diminfo[0].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_min_obs.diminfo[1].strides = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_min_obs.diminfo[1].shape = __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2085, __pyx_L1_error)
    }
    __pyx_v_min_obs = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2086
 *         max_trans = np.ones((nstate,nstate)) * trans_scale
 *         min_obs = np.zeros((nstate,ndet))
 *         max_obs = np.ones((nstate,ndet))             # <<<<<<<<<<<<<<
 *         const_obs = True
 *     # check min/max values are valid
*/
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2086, __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, 2086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nstate);
    __Pyx_GIVEREF(__pyx_v_nstate);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2086, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_ndet);
    __Pyx_GIVEREF(__pyx_v_ndet);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 2086, __pyx_L1_error);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2086, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_max_obs.diminfo[0].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_obs.diminfo[0].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_max_obs.diminfo[1].strides = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_max_obs.diminfo[1].shape = __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2086, __pyx_L1_error)
    }
    __pyx_v_max_obs = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2087
 *         min_obs = np.zeros((nstate,ndet))
 *         max_obs = np.ones((nstate,ndet))
 *         const_obs = True             # <<<<<<<<<<<<<<
 *     # check min/max values are valid
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:
*/
    __Pyx_INCREF(Py_True);
    __pyx_v_const_obs = Py_True;
  }
  __pyx_L12:;

  /* "H2MM_C.pyx":2089
 *         const_obs = True
 *     # check min/max values are valid
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:             # <<<<<<<<<<<<<<
 *         raise ValueError("prior bounds not valid for the number of states")
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
*/
  __pyx_t_6 = ((PyObject *)__pyx_v_min_prior);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_mstate_global->__pyx_float_1_0, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_max_prior);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
    __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_mstate_global->__pyx_float_1_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L22_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2090
 *     # check min/max values are valid
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:
 *         raise ValueError("prior bounds not valid for the number of states")             # <<<<<<<<<<<<<<
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
 *         raise ValueError("obs bounds not valid for this number of streams")
*/
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_prior_bounds_not_valid_for_the_n};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2090, __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, 2090, __pyx_L1_error)

    /* "H2MM_C.pyx":2089
 *         const_obs = True
 *     # check min/max values are valid
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:             # <<<<<<<<<<<<<<
 *         raise ValueError("prior bounds not valid for the number of states")
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
*/
  }

  /* "H2MM_C.pyx":2091
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:
 *         raise ValueError("prior bounds not valid for the number of states")
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):             # <<<<<<<<<<<<<<
 *         raise ValueError("obs bounds not valid for this number of streams")
 *     if np.any(min_trans.sum(axis=1) > 1.0):
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = ((PyObject *)__pyx_v_min_obs);
  __Pyx_INCREF(__pyx_t_12);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL};
    __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_13, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_mstate_global->__pyx_float_1_0, Py_GT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_13};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2091, __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_L25_bool_binop_done;
  }
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_v_max_obs);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, NULL};
    __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __pyx_t_13 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
  }
  __pyx_t_12 = PyObject_RichCompare(__pyx_t_13, __pyx_mstate_global->__pyx_float_1_0, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_12};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2091, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_2;
  __pyx_L25_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2092
 *         raise ValueError("prior bounds not valid for the number of states")
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
 *         raise ValueError("obs bounds not valid for this number of streams")             # <<<<<<<<<<<<<<
 *     if np.any(min_trans.sum(axis=1) > 1.0):
 *         raise ValueError("trans bounds not valid for this number of states")
*/
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_obs_bounds_not_valid_for_this_nu};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2092, __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, 2092, __pyx_L1_error)

    /* "H2MM_C.pyx":2091
 *     if min_prior.sum() > 1.0 or max_prior.sum() < 1.0:
 *         raise ValueError("prior bounds not valid for the number of states")
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):             # <<<<<<<<<<<<<<
 *         raise ValueError("obs bounds not valid for this number of streams")
 *     if np.any(min_trans.sum(axis=1) > 1.0):
*/
  }

  /* "H2MM_C.pyx":2093
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
 *         raise ValueError("obs bounds not valid for this number of streams")
 *     if np.any(min_trans.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *         raise ValueError("trans bounds not valid for this number of states")
 *     # setup actual arrays based on even/random selections
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_13 = ((PyObject *)__pyx_v_min_trans);
  __Pyx_INCREF(__pyx_t_13);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_13, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2093, __pyx_L1_error)
    __pyx_t_12 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  }
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_mstate_global->__pyx_float_1_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __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, 2093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "H2MM_C.pyx":2094
 *         raise ValueError("obs bounds not valid for this number of streams")
 *     if np.any(min_trans.sum(axis=1) > 1.0):
 *         raise ValueError("trans bounds not valid for this number of states")             # <<<<<<<<<<<<<<
 *     # setup actual arrays based on even/random selections
 *     if prior_dist == 'equal':
*/
    __pyx_t_7 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_trans_bounds_not_valid_for_this};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2094, __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, 2094, __pyx_L1_error)

    /* "H2MM_C.pyx":2093
 *     if np.any(min_obs.sum(axis=1) > 1.0) or np.any(max_obs.sum(axis=1) < 1.0):
 *         raise ValueError("obs bounds not valid for this number of streams")
 *     if np.any(min_trans.sum(axis=1) > 1.0):             # <<<<<<<<<<<<<<
 *         raise ValueError("trans bounds not valid for this number of states")
 *     # setup actual arrays based on even/random selections
*/
  }

  /* "H2MM_C.pyx":2096
 *         raise ValueError("trans bounds not valid for this number of states")
 *     # setup actual arrays based on even/random selections
 *     if prior_dist == 'equal':             # <<<<<<<<<<<<<<
 *         prior_alpha, prior_beta, prior_sigma = max_prior.sum(), min_prior.sum(), max_prior - min_prior
 *         prior = min_prior + ((1-prior_beta)/(prior_alpha-prior_beta)*prior_sigma)
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_prior_dist, __pyx_mstate_global->__pyx_n_u_equal, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2096, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2097
 *     # setup actual arrays based on even/random selections
 *     if prior_dist == 'equal':
 *         prior_alpha, prior_beta, prior_sigma = max_prior.sum(), min_prior.sum(), max_prior - min_prior             # <<<<<<<<<<<<<<
 *         prior = min_prior + ((1-prior_beta)/(prior_alpha-prior_beta)*prior_sigma)
 *     else:
*/
    __pyx_t_7 = ((PyObject *)__pyx_v_max_prior);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_4 = ((PyObject *)__pyx_v_min_prior);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_max_prior), ((PyObject *)__pyx_v_min_prior)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_prior_alpha = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_prior_beta = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_prior_sigma = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":2098
 *     if prior_dist == 'equal':
 *         prior_alpha, prior_beta, prior_sigma = max_prior.sum(), min_prior.sum(), max_prior - min_prior
 *         prior = min_prior + ((1-prior_beta)/(prior_alpha-prior_beta)*prior_sigma)             # <<<<<<<<<<<<<<
 *     else:
 *         prior = np.random.uniform(min_prior,max_prior)
*/
    __pyx_t_4 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_prior_beta, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_prior_alpha, __pyx_v_prior_beta); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2098, __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_7 = PyNumber_Multiply(__pyx_t_1, __pyx_v_prior_sigma); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_min_prior), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2098, __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_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2098, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, 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_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_prior, &__Pyx_TypeInfo_double, 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_prior.diminfo[0].strides = __pyx_pybuffernd_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prior.diminfo[0].shape = __pyx_pybuffernd_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2098, __pyx_L1_error)
    }
    __pyx_v_prior = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2096
 *         raise ValueError("trans bounds not valid for this number of states")
 *     # setup actual arrays based on even/random selections
 *     if prior_dist == 'equal':             # <<<<<<<<<<<<<<
 *         prior_alpha, prior_beta, prior_sigma = max_prior.sum(), min_prior.sum(), max_prior - min_prior
 *         prior = min_prior + ((1-prior_beta)/(prior_alpha-prior_beta)*prior_sigma)
*/
    goto __pyx_L28;
  }

  /* "H2MM_C.pyx":2100
 *         prior = min_prior + ((1-prior_beta)/(prior_alpha-prior_beta)*prior_sigma)
 *     else:
 *         prior = np.random.uniform(min_prior,max_prior)             # <<<<<<<<<<<<<<
 *         prior /= prior.sum()
 *         while np.any(prior < min_prior) or np.any(prior > max_prior):
*/
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_random); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_v_min_prior), ((PyObject *)__pyx_v_max_prior)};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_uniform, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2100, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_prior.diminfo[0].strides = __pyx_pybuffernd_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prior.diminfo[0].shape = __pyx_pybuffernd_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2100, __pyx_L1_error)
    }
    __pyx_v_prior = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2101
 *     else:
 *         prior = np.random.uniform(min_prior,max_prior)
 *         prior /= prior.sum()             # <<<<<<<<<<<<<<
 *         while np.any(prior < min_prior) or np.any(prior > max_prior):
 *             prior = np.random.uniform(min_prior,max_prior)
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_prior);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_prior), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2101, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo_double, 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_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_prior, &__Pyx_TypeInfo_double, 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_prior.diminfo[0].strides = __pyx_pybuffernd_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prior.diminfo[0].shape = __pyx_pybuffernd_prior.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2101, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_prior, ((PyArrayObject *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":2102
 *         prior = np.random.uniform(min_prior,max_prior)
 *         prior /= prior.sum()
 *         while np.any(prior < min_prior) or np.any(prior > max_prior):             # <<<<<<<<<<<<<<
 *             prior = np.random.uniform(min_prior,max_prior)
 *             prior /= prior.sum()
*/
    while (1) {
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_prior), ((PyObject *)__pyx_v_min_prior), Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_2) {
      } else {
        __pyx_t_3 = __pyx_t_2;
        goto __pyx_L31_bool_binop_done;
      }
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_prior), ((PyObject *)__pyx_v_max_prior), Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_L31_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "H2MM_C.pyx":2103
 *         prior /= prior.sum()
 *         while np.any(prior < min_prior) or np.any(prior > max_prior):
 *             prior = np.random.uniform(min_prior,max_prior)             # <<<<<<<<<<<<<<
 *             prior /= prior.sum()
 *     if trans_dist == 'equal':
*/
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_random); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = __pyx_t_4;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_min_prior), ((PyObject *)__pyx_v_max_prior)};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_uniform, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2103, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2103, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_prior, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          }
          __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
        }
        __pyx_pybuffernd_prior.diminfo[0].strides = __pyx_pybuffernd_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prior.diminfo[0].shape = __pyx_pybuffernd_prior.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2103, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_prior, ((PyArrayObject *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "H2MM_C.pyx":2104
 *         while np.any(prior < min_prior) or np.any(prior > max_prior):
 *             prior = np.random.uniform(min_prior,max_prior)
 *             prior /= prior.sum()             # <<<<<<<<<<<<<<
 *     if trans_dist == 'equal':
 *         min_trans[min_trans==0.0] = np.min(max_trans)*trans_scale
*/
      __pyx_t_4 = ((PyObject *)__pyx_v_prior);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_4 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_prior), __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2104, __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_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2104, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prior.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_double, 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_prior.rcbuffer->pybuffer, (PyObject*)__pyx_v_prior, &__Pyx_TypeInfo_double, 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_prior.diminfo[0].strides = __pyx_pybuffernd_prior.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prior.diminfo[0].shape = __pyx_pybuffernd_prior.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2104, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_prior, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;
    }
  }
  __pyx_L28:;

  /* "H2MM_C.pyx":2105
 *             prior = np.random.uniform(min_prior,max_prior)
 *             prior /= prior.sum()
 *     if trans_dist == 'equal':             # <<<<<<<<<<<<<<
 *         min_trans[min_trans==0.0] = np.min(max_trans)*trans_scale
 *         trans = np.exp((np.log(min_trans)+np.log(max_trans))/2)
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_trans_dist, __pyx_mstate_global->__pyx_n_u_equal, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2106
 *             prior /= prior.sum()
 *     if trans_dist == 'equal':
 *         min_trans[min_trans==0.0] = np.min(max_trans)*trans_scale             # <<<<<<<<<<<<<<
 *         trans = np.exp((np.log(min_trans)+np.log(max_trans))/2)
 *     else:
*/
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_min); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_max_trans)};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_v_trans_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_min_trans), __pyx_mstate_global->__pyx_float_0_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_min_trans), __pyx_t_4, __pyx_t_7) < 0))) __PYX_ERR(0, 2106, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2107
 *     if trans_dist == 'equal':
 *         min_trans[min_trans==0.0] = np.min(max_trans)*trans_scale
 *         trans = np.exp((np.log(min_trans)+np.log(max_trans))/2)             # <<<<<<<<<<<<<<
 *     else:
 *         trans = np.random.uniform(min_trans,max_trans)
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_exp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_12 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, ((PyObject *)__pyx_v_min_trans)};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_12 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_15);
      assert(__pyx_t_12);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, ((PyObject *)__pyx_v_max_trans)};
      __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
    }
    __pyx_t_15 = PyNumber_Add(__pyx_t_6, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2107, __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 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_15, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_14};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2107, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_trans.diminfo[0].strides = __pyx_pybuffernd_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_trans.diminfo[0].shape = __pyx_pybuffernd_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_trans.diminfo[1].strides = __pyx_pybuffernd_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_trans.diminfo[1].shape = __pyx_pybuffernd_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2107, __pyx_L1_error)
    }
    __pyx_v_trans = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2105
 *             prior = np.random.uniform(min_prior,max_prior)
 *             prior /= prior.sum()
 *     if trans_dist == 'equal':             # <<<<<<<<<<<<<<
 *         min_trans[min_trans==0.0] = np.min(max_trans)*trans_scale
 *         trans = np.exp((np.log(min_trans)+np.log(max_trans))/2)
*/
    goto __pyx_L33;
  }

  /* "H2MM_C.pyx":2109
 *         trans = np.exp((np.log(min_trans)+np.log(max_trans))/2)
 *     else:
 *         trans = np.random.uniform(min_trans,max_trans)             # <<<<<<<<<<<<<<
 *     trans[np.eye(nstate)==1] = 0.0
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
*/
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_random); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_1 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_min_trans), ((PyObject *)__pyx_v_max_trans)};
      __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_uniform, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2109, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_trans.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_trans.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_trans.rcbuffer->pybuffer, (PyObject*)__pyx_v_trans, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_trans.diminfo[0].strides = __pyx_pybuffernd_trans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_trans.diminfo[0].shape = __pyx_pybuffernd_trans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_trans.diminfo[1].strides = __pyx_pybuffernd_trans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_trans.diminfo[1].shape = __pyx_pybuffernd_trans.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2109, __pyx_L1_error)
    }
    __pyx_v_trans = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L33:;

  /* "H2MM_C.pyx":2110
 *     else:
 *         trans = np.random.uniform(min_trans,max_trans)
 *     trans[np.eye(nstate)==1] = 0.0             # <<<<<<<<<<<<<<
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
 *     if obs_dist == 'equal':
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_14, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_nstate};
    __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  }
  __pyx_t_14 = __Pyx_PyLong_EqObjC(__pyx_t_7, __pyx_mstate_global->__pyx_int_1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_trans), __pyx_t_14, __pyx_mstate_global->__pyx_float_0_0) < 0))) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":2111
 *         trans = np.random.uniform(min_trans,max_trans)
 *     trans[np.eye(nstate)==1] = 0.0
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)             # <<<<<<<<<<<<<<
 *     if obs_dist == 'equal':
 *         if const_obs:
*/
  __pyx_t_7 = ((PyObject *)__pyx_v_trans);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_5 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
    __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __pyx_t_14 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
  }
  __pyx_t_4 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_t_14, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_7 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_eye); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_15))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
    assert(__pyx_t_7);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_nstate};
    __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
  }
  __pyx_t_15 = __Pyx_PyLong_EqObjC(__pyx_t_14, __pyx_mstate_global->__pyx_int_1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_trans), __pyx_t_15, __pyx_t_4) < 0))) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":2112
 *     trans[np.eye(nstate)==1] = 0.0
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
 *     if obs_dist == 'equal':             # <<<<<<<<<<<<<<
 *         if const_obs:
 *             obs = np.zeros((nstate,ndet))
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_obs_dist, __pyx_mstate_global->__pyx_n_u_equal, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2112, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2113
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
 *     if obs_dist == 'equal':
 *         if const_obs:             # <<<<<<<<<<<<<<
 *             obs = np.zeros((nstate,ndet))
 *             for i in range(ndet):
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_const_obs); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2113, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":2114
 *     if obs_dist == 'equal':
 *         if const_obs:
 *             obs = np.zeros((nstate,ndet))             # <<<<<<<<<<<<<<
 *             for i in range(ndet):
 *                 if i % 2 == 0:
*/
      __pyx_t_15 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_v_nstate);
      __Pyx_GIVEREF(__pyx_v_nstate);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_nstate) != (0)) __PYX_ERR(0, 2114, __pyx_L1_error);
      __Pyx_INCREF(__pyx_v_ndet);
      __Pyx_GIVEREF(__pyx_v_ndet);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_ndet) != (0)) __PYX_ERR(0, 2114, __pyx_L1_error);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_15);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_14};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2114, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          }
          __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
        }
        __pyx_pybuffernd_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2114, __pyx_L1_error)
      }
      __pyx_v_obs = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":2115
 *         if const_obs:
 *             obs = np.zeros((nstate,ndet))
 *             for i in range(ndet):             # <<<<<<<<<<<<<<
 *                 if i % 2 == 0:
 *                     obs[:,i] = np.linspace(min_obs[0,i],max_obs[0,i],num=nstate+2)[1:nstate+1]
*/
      __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_v_ndet); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2115, __pyx_L1_error)
      __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;

        /* "H2MM_C.pyx":2116
 *             obs = np.zeros((nstate,ndet))
 *             for i in range(ndet):
 *                 if i % 2 == 0:             # <<<<<<<<<<<<<<
 *                     obs[:,i] = np.linspace(min_obs[0,i],max_obs[0,i],num=nstate+2)[1:nstate+1]
 *                 else :
*/
        __pyx_t_3 = (__Pyx_mod_Py_ssize_t(__pyx_v_i, 2, 1) == 0);
        if (__pyx_t_3) {

          /* "H2MM_C.pyx":2117
 *             for i in range(ndet):
 *                 if i % 2 == 0:
 *                     obs[:,i] = np.linspace(min_obs[0,i],max_obs[0,i],num=nstate+2)[1:nstate+1]             # <<<<<<<<<<<<<<
 *                 else :
 *                     obs[:,i] = np.linspace(max_obs[0,i],min_obs[0,i],num=nstate+2)[1:nstate+1]
*/
          __pyx_t_7 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_linspace); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_19 = 0;
          __pyx_t_20 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_pybuffernd_min_obs.diminfo[0].shape;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_min_obs.diminfo[0].shape)) __pyx_t_8 = 0;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_min_obs.diminfo[1].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 1;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_min_obs.diminfo[1].shape)) __pyx_t_8 = 1;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            __PYX_ERR(0, 2117, __pyx_L1_error)
          }
          __pyx_t_14 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_min_obs.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_min_obs.diminfo[1].strides))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_20 = 0;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_max_obs.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_max_obs.diminfo[0].shape)) __pyx_t_8 = 0;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_pybuffernd_max_obs.diminfo[1].shape;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1;
          } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_max_obs.diminfo[1].shape)) __pyx_t_8 = 1;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            __PYX_ERR(0, 2117, __pyx_L1_error)
          }
          __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_max_obs.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_max_obs.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
            assert(__pyx_t_7);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
            __pyx_t_5 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_t_14, __pyx_t_1};
            __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2117, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num, __pyx_t_6, __pyx_t_12, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2117, __pyx_L1_error)
            __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2117, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __pyx_t_15 = __Pyx_PyLong_AddObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_t_4, 1, 0, NULL, &__pyx_t_15, NULL, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = PyLong_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 2117, __pyx_L1_error);
          __Pyx_GIVEREF(__pyx_t_15);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_15) != (0)) __PYX_ERR(0, 2117, __pyx_L1_error);
          __pyx_t_15 = 0;
          if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_obs), __pyx_t_4, __pyx_t_12) < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":2116
 *             obs = np.zeros((nstate,ndet))
 *             for i in range(ndet):
 *                 if i % 2 == 0:             # <<<<<<<<<<<<<<
 *                     obs[:,i] = np.linspace(min_obs[0,i],max_obs[0,i],num=nstate+2)[1:nstate+1]
 *                 else :
*/
          goto __pyx_L38;
        }

        /* "H2MM_C.pyx":2119
 *                     obs[:,i] = np.linspace(min_obs[0,i],max_obs[0,i],num=nstate+2)[1:nstate+1]
 *                 else :
 *                     obs[:,i] = np.linspace(max_obs[0,i],min_obs[0,i],num=nstate+2)[1:nstate+1]             # <<<<<<<<<<<<<<
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         else:
*/
        /*else*/ {
          __pyx_t_4 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_linspace); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_19 = 0;
          __pyx_t_20 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_pybuffernd_max_obs.diminfo[0].shape;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_max_obs.diminfo[0].shape)) __pyx_t_8 = 0;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_max_obs.diminfo[1].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 1;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_max_obs.diminfo[1].shape)) __pyx_t_8 = 1;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            __PYX_ERR(0, 2119, __pyx_L1_error)
          }
          __pyx_t_15 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_max_obs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_max_obs.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_max_obs.diminfo[1].strides))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_20 = 0;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_8 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_min_obs.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_min_obs.diminfo[0].shape)) __pyx_t_8 = 0;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_pybuffernd_min_obs.diminfo[1].shape;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1;
          } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_min_obs.diminfo[1].shape)) __pyx_t_8 = 1;
          if (unlikely(__pyx_t_8 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_8);
            __PYX_ERR(0, 2119, __pyx_L1_error)
          }
          __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_min_obs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_min_obs.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_min_obs.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = __Pyx_PyLong_AddObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_5 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
            assert(__pyx_t_4);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
            __pyx_t_5 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_15, __pyx_t_1};
            __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2119, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num, __pyx_t_14, __pyx_t_7, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 2119, __pyx_L1_error)
            __pyx_t_12 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2119, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          __pyx_t_6 = __Pyx_PyLong_AddObjC(__pyx_v_nstate, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_t_12, 1, 0, NULL, &__pyx_t_6, NULL, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyLong_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 2119, __pyx_L1_error);
          __Pyx_GIVEREF(__pyx_t_6);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 2119, __pyx_L1_error);
          __pyx_t_6 = 0;
          if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_obs), __pyx_t_12, __pyx_t_7) < 0))) __PYX_ERR(0, 2119, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_L38:;
      }

      /* "H2MM_C.pyx":2120
 *                 else :
 *                     obs[:,i] = np.linspace(max_obs[0,i],min_obs[0,i],num=nstate+2)[1:nstate+1]
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)             # <<<<<<<<<<<<<<
 *         else:
 *             obs_alpha, obs_beta, obs_sigma = max_obs.sum(axis=1), min_obs.sum(axis=1), max_obs - min_obs
*/
      __pyx_t_14 = ((PyObject *)__pyx_v_obs);
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_14, NULL};
        __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_12 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_v_nstate, __pyx_mstate_global->__pyx_int_1};
        __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_6 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_obs), __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2120, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2120, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "H2MM_C.pyx":2113
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
 *     if obs_dist == 'equal':
 *         if const_obs:             # <<<<<<<<<<<<<<
 *             obs = np.zeros((nstate,ndet))
 *             for i in range(ndet):
*/
      goto __pyx_L35;
    }

    /* "H2MM_C.pyx":2122
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         else:
 *             obs_alpha, obs_beta, obs_sigma = max_obs.sum(axis=1), min_obs.sum(axis=1), max_obs - min_obs             # <<<<<<<<<<<<<<
 *             obs = min_obs + (((1-obs_beta)/(obs_alpha-obs_beta)).reshape(nstate,1)*obs_sigma)
 *     else:
*/
    /*else*/ {
      __pyx_t_7 = ((PyObject *)__pyx_v_max_obs);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
        __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_7 = ((PyObject *)__pyx_v_min_obs);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
        __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __pyx_t_12 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_max_obs), ((PyObject *)__pyx_v_min_obs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_obs_alpha = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_obs_beta = __pyx_t_12;
      __pyx_t_12 = 0;
      __pyx_v_obs_sigma = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "H2MM_C.pyx":2123
 *         else:
 *             obs_alpha, obs_beta, obs_sigma = max_obs.sum(axis=1), min_obs.sum(axis=1), max_obs - min_obs
 *             obs = min_obs + (((1-obs_beta)/(obs_alpha-obs_beta)).reshape(nstate,1)*obs_sigma)             # <<<<<<<<<<<<<<
 *     else:
 *         # setup for random obs
*/
      __pyx_t_6 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_obs_beta, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyNumber_Subtract(__pyx_v_obs_alpha, __pyx_v_obs_beta); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = __pyx_t_14;
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_v_nstate, __pyx_mstate_global->__pyx_int_1};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_14 = PyNumber_Multiply(__pyx_t_1, __pyx_v_obs_sigma); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_min_obs), __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2123, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          }
          __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
        }
        __pyx_pybuffernd_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2123, __pyx_L1_error)
      }
      __pyx_v_obs = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L35:;

    /* "H2MM_C.pyx":2112
 *     trans[np.eye(nstate)==1] = 0.0
 *     trans[np.eye(nstate)==1] = 1 - trans.sum(axis=1)
 *     if obs_dist == 'equal':             # <<<<<<<<<<<<<<
 *         if const_obs:
 *             obs = np.zeros((nstate,ndet))
*/
    goto __pyx_L34;
  }

  /* "H2MM_C.pyx":2126
 *     else:
 *         # setup for random obs
 *         obs = np.random.uniform(min_obs,max_obs)             # <<<<<<<<<<<<<<
 *         obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         while np.any(obs < min_obs) or np.any(obs > max_obs):
*/
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_random); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_14 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_14);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_14, ((PyObject *)__pyx_v_min_obs), ((PyObject *)__pyx_v_max_obs)};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_uniform, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2126, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2126, __pyx_L1_error)
    }
    __pyx_v_obs = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":2127
 *         # setup for random obs
 *         obs = np.random.uniform(min_obs,max_obs)
 *         obs = obs / obs.sum(axis=1).reshape(nstate,1)             # <<<<<<<<<<<<<<
 *         while np.any(obs < min_obs) or np.any(obs > max_obs):
 *             obs = np.random.uniform(min_obs,max_obs)
*/
    __pyx_t_12 = ((PyObject *)__pyx_v_obs);
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL};
      __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2127, __pyx_L1_error)
      __pyx_t_14 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __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_14)) __PYX_ERR(0, 2127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
    }
    __pyx_t_7 = __pyx_t_14;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_nstate, __pyx_mstate_global->__pyx_int_1};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_14 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_obs), __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2127, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_14), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
        __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
      }
      __pyx_pybuffernd_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2127, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "H2MM_C.pyx":2128
 *         obs = np.random.uniform(min_obs,max_obs)
 *         obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         while np.any(obs < min_obs) or np.any(obs > max_obs):             # <<<<<<<<<<<<<<
 *             obs = np.random.uniform(min_obs,max_obs)
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
*/
    while (1) {
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_obs), ((PyObject *)__pyx_v_min_obs), Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
        __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
      }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (!__pyx_t_2) {
      } else {
        __pyx_t_3 = __pyx_t_2;
        goto __pyx_L41_bool_binop_done;
      }
      __pyx_t_6 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_obs), ((PyObject *)__pyx_v_max_obs), Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        assert(__pyx_t_6);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
        __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
      }
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_L41_bool_binop_done:;
      if (!__pyx_t_3) break;

      /* "H2MM_C.pyx":2129
 *         obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         while np.any(obs < min_obs) or np.any(obs > max_obs):
 *             obs = np.random.uniform(min_obs,max_obs)             # <<<<<<<<<<<<<<
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         if const_obs:
*/
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_random); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_1, ((PyObject *)__pyx_v_min_obs), ((PyObject *)__pyx_v_max_obs)};
        __pyx_t_14 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_uniform, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
      }
      if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2129, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_14), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2129, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_14));
      __pyx_t_14 = 0;

      /* "H2MM_C.pyx":2130
 *         while np.any(obs < min_obs) or np.any(obs > max_obs):
 *             obs = np.random.uniform(min_obs,max_obs)
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)             # <<<<<<<<<<<<<<
 *         if const_obs:
 *             sort = np.argsort(obs[:,0])
*/
      __pyx_t_7 = ((PyObject *)__pyx_v_obs);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL};
        __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2130, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 2130, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2130, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_6 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_nstate, __pyx_mstate_global->__pyx_int_1};
        __pyx_t_14 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2130, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
      }
      __pyx_t_1 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_obs), __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2130, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_8 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
          }
          __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
        }
        __pyx_pybuffernd_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2130, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;
    }

    /* "H2MM_C.pyx":2131
 *             obs = np.random.uniform(min_obs,max_obs)
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         if const_obs:             # <<<<<<<<<<<<<<
 *             sort = np.argsort(obs[:,0])
 *             obs = obs[sort,:]
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_const_obs); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2131, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":2132
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         if const_obs:
 *             sort = np.argsort(obs[:,0])             # <<<<<<<<<<<<<<
 *             obs = obs[sort,:]
 *     model = h2mm_model(prior,trans,obs)
*/
      __pyx_t_14 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_argsort); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_obs), __pyx_mstate_global->__pyx_tuple[11]); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
        assert(__pyx_t_14);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_sort = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "H2MM_C.pyx":2133
 *         if const_obs:
 *             sort = np.argsort(obs[:,0])
 *             obs = obs[sort,:]             # <<<<<<<<<<<<<<
 *     model = h2mm_model(prior,trans,obs)
 *     return model
*/
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_sort);
      __Pyx_GIVEREF(__pyx_v_sort);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sort) != (0)) __PYX_ERR(0, 2133, __pyx_L1_error);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 2133, __pyx_L1_error);
      __pyx_t_12 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_obs), __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2133, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2133, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_obs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_obs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 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_obs.diminfo[0].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_obs.diminfo[0].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_obs.diminfo[1].strides = __pyx_pybuffernd_obs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_obs.diminfo[1].shape = __pyx_pybuffernd_obs.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2133, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_obs, ((PyArrayObject *)__pyx_t_12));
      __pyx_t_12 = 0;

      /* "H2MM_C.pyx":2131
 *             obs = np.random.uniform(min_obs,max_obs)
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         if const_obs:             # <<<<<<<<<<<<<<
 *             sort = np.argsort(obs[:,0])
 *             obs = obs[sort,:]
*/
    }
  }
  __pyx_L34:;

  /* "H2MM_C.pyx":2134
 *             sort = np.argsort(obs[:,0])
 *             obs = obs[sort,:]
 *     model = h2mm_model(prior,trans,obs)             # <<<<<<<<<<<<<<
 *     return model
 * 
*/
  __pyx_t_1 = NULL;
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_1, ((PyObject *)__pyx_v_prior), ((PyObject *)__pyx_v_trans), ((PyObject *)__pyx_v_obs)};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2134, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_12);
  }
  __pyx_v_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":2135
 *             obs = obs[sort,:]
 *     model = h2mm_model(prior,trans,obs)
 *     return model             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_model);
  __pyx_r = ((PyObject *)__pyx_v_model);
  goto __pyx_L0;

  /* "H2MM_C.pyx":2016
 * 
 * 
 * def factory_h2mm_model(nstate, ndet, bounds=None, trans_scale=1e-5,             # <<<<<<<<<<<<<<
 *                   prior_dist='equal', trans_dist='equal',obs_dist='equal'):
 *     """
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  { 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_max_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_trans.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.factory_h2mm_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_prior.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_trans.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_prior.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_trans.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prior.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_trans.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prior);
  __Pyx_XDECREF((PyObject *)__pyx_v_min_prior);
  __Pyx_XDECREF((PyObject *)__pyx_v_max_prior);
  __Pyx_XDECREF((PyObject *)__pyx_v_trans);
  __Pyx_XDECREF((PyObject *)__pyx_v_min_trans);
  __Pyx_XDECREF((PyObject *)__pyx_v_max_trans);
  __Pyx_XDECREF((PyObject *)__pyx_v_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_min_obs);
  __Pyx_XDECREF((PyObject *)__pyx_v_max_obs);
  __Pyx_XDECREF(__pyx_v_const_obs);
  __Pyx_XDECREF(__pyx_v_prior_alpha);
  __Pyx_XDECREF(__pyx_v_prior_beta);
  __Pyx_XDECREF(__pyx_v_prior_sigma);
  __Pyx_XDECREF(__pyx_v_obs_alpha);
  __Pyx_XDECREF(__pyx_v_obs_beta);
  __Pyx_XDECREF(__pyx_v_obs_sigma);
  __Pyx_XDECREF(__pyx_v_sort);
  __Pyx_XDECREF((PyObject *)__pyx_v_model);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2138
 * 
 * 
 * cdef h2mm_model model_copy_from_ptr(h2mm_mod *model):             # <<<<<<<<<<<<<<
 *     # function for copying the values h2mm_mod C structure into an new h2mm_model object
 *     # this is slower that model_from _ptr, but the copy makes sure that changes
*/

static struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_f_6H2MM_C_model_copy_from_ptr(h2mm_mod *__pyx_v_model) {
  h2mm_mod *__pyx_v_ret_model;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  h2mm_mod *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("model_copy_from_ptr", 0);

  /* "H2MM_C.pyx":2144
 *     # primarily used in the cy_limit function to create the model objects handed
 *     # to the user supplied python function
 *     cdef h2mm_mod *ret_model = Py_allocate_models(1, model.nstate, model.ndet, model.nphot)             # <<<<<<<<<<<<<<
 *     copy_model(model, ret_model)
 *     return h2mm_model.from_ptr(ret_model)
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_Py_allocate_models(1, __pyx_v_model->nstate, __pyx_v_model->ndet, __pyx_v_model->nphot); if (unlikely(__pyx_t_1 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 2144, __pyx_L1_error)
  __pyx_v_ret_model = __pyx_t_1;

  /* "H2MM_C.pyx":2145
 *     # to the user supplied python function
 *     cdef h2mm_mod *ret_model = Py_allocate_models(1, model.nstate, model.ndet, model.nphot)
 *     copy_model(model, ret_model)             # <<<<<<<<<<<<<<
 *     return h2mm_model.from_ptr(ret_model)
 * 
*/
  (void)(copy_model(__pyx_v_model, __pyx_v_ret_model));

  /* "H2MM_C.pyx":2146
 *     cdef h2mm_mod *ret_model = Py_allocate_models(1, model.nstate, model.ndet, model.nphot)
 *     copy_model(model, ret_model)
 *     return h2mm_model.from_ptr(ret_model)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_10h2mm_model_from_ptr(__pyx_v_ret_model)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2138
 * 
 * 
 * cdef h2mm_model model_copy_from_ptr(h2mm_mod *model):             # <<<<<<<<<<<<<<
 *     # function for copying the values h2mm_mod C structure into an new h2mm_model object
 *     # this is slower that model_from _ptr, but the copy makes sure that changes
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.model_copy_from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2150
 * 
 * # The wrapper for the user supplied python limits function
 * cdef int cy_limit(h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double time, lm* limits, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # initial checks ensuring model does not optimize too long or have loglik error
 *     new.niter = current.niter + 1
*/

static int __pyx_f_6H2MM_C_cy_limit(h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, double __pyx_v_time, lm *__pyx_v_limits, void *__pyx_v_instruct) {
  int __pyx_v_ret;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_limit_model = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_old_mod = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_cur_mod = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_new_mod = 0;
  __pyx_t_6H2MM_C_BoundStruct *__pyx_v_bound;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_v_limit_res = NULL;
  PyObject *__pyx_v_e = 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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("cy_limit", 0);

  /* "H2MM_C.pyx":2152
 * cdef int cy_limit(h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double time, lm* limits, void *instruct) noexcept with gil:
 *     # initial checks ensuring model does not optimize too long or have loglik error
 *     new.niter = current.niter + 1             # <<<<<<<<<<<<<<
 *     h2mm_normalize(new)
 *     if current.conv & CONVCODE_ERROR:
*/
  __pyx_v_new->niter = (__pyx_v_current->niter + 1);

  /* "H2MM_C.pyx":2153
 *     # initial checks ensuring model does not optimize too long or have loglik error
 *     new.niter = current.niter + 1
 *     h2mm_normalize(new)             # <<<<<<<<<<<<<<
 *     if current.conv & CONVCODE_ERROR:
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT
*/
  h2mm_normalize(__pyx_v_new);

  /* "H2MM_C.pyx":2154
 *     new.niter = current.niter + 1
 *     h2mm_normalize(new)
 *     if current.conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT
 *         current.conv |= CONVCODE_POSTMODEL
*/
  __pyx_t_1 = ((__pyx_v_current->conv & CONVCODE_ERROR) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2155
 *     h2mm_normalize(new)
 *     if current.conv & CONVCODE_ERROR:
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_POSTMODEL
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL
*/
    __pyx_v_old->conv = (__pyx_v_old->conv | (CONVCODE_ERROR | CONVCODE_OUTPUT));

    /* "H2MM_C.pyx":2156
 *     if current.conv & CONVCODE_ERROR:
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT
 *         current.conv |= CONVCODE_POSTMODEL             # <<<<<<<<<<<<<<
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL
 *         return 1
*/
    __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_POSTMODEL);

    /* "H2MM_C.pyx":2157
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT
 *         current.conv |= CONVCODE_POSTMODEL
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL             # <<<<<<<<<<<<<<
 *         return 1
 *     if current.niter >= limits.max_iter:
*/
    __pyx_v_new->conv = (__pyx_v_new->conv | (CONVCODE_ERROR | CONVCODE_POSTMODEL));

    /* "H2MM_C.pyx":2158
 *         current.conv |= CONVCODE_POSTMODEL
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL
 *         return 1             # <<<<<<<<<<<<<<
 *     if current.niter >= limits.max_iter:
 *         current.conv |= CONVCODE_OUTPUT_MAXITER
*/
    __pyx_r = 1;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2154
 *     new.niter = current.niter + 1
 *     h2mm_normalize(new)
 *     if current.conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         old.conv |= CONVCODE_ERROR | CONVCODE_OUTPUT
 *         current.conv |= CONVCODE_POSTMODEL
*/
  }

  /* "H2MM_C.pyx":2159
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL
 *         return 1
 *     if current.niter >= limits.max_iter:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_OUTPUT_MAXITER
 *         new.conv |= CONVCODE_POST_MAXITER
*/
  __pyx_t_1 = (__pyx_v_current->niter >= __pyx_v_limits->max_iter);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2160
 *         return 1
 *     if current.niter >= limits.max_iter:
 *         current.conv |= CONVCODE_OUTPUT_MAXITER             # <<<<<<<<<<<<<<
 *         new.conv |= CONVCODE_POST_MAXITER
 *         return 2
*/
    __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_OUTPUT_MAXITER);

    /* "H2MM_C.pyx":2161
 *     if current.niter >= limits.max_iter:
 *         current.conv |= CONVCODE_OUTPUT_MAXITER
 *         new.conv |= CONVCODE_POST_MAXITER             # <<<<<<<<<<<<<<
 *         return 2
 *     if time > limits.max_time:
*/
    __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_MAXITER);

    /* "H2MM_C.pyx":2162
 *         current.conv |= CONVCODE_OUTPUT_MAXITER
 *         new.conv |= CONVCODE_POST_MAXITER
 *         return 2             # <<<<<<<<<<<<<<
 *     if time > limits.max_time:
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME
*/
    __pyx_r = 2;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2159
 *         new.conv |= CONVCODE_ERROR | CONVCODE_POSTMODEL
 *         return 1
 *     if current.niter >= limits.max_iter:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_OUTPUT_MAXITER
 *         new.conv |= CONVCODE_POST_MAXITER
*/
  }

  /* "H2MM_C.pyx":2163
 *         new.conv |= CONVCODE_POST_MAXITER
 *         return 2
 *     if time > limits.max_time:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME
 *         new.conv |= CONVCODE_POST_MAXTIME
*/
  __pyx_t_1 = (__pyx_v_time > __pyx_v_limits->max_time);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2164
 *         return 2
 *     if time > limits.max_time:
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME             # <<<<<<<<<<<<<<
 *         new.conv |= CONVCODE_POST_MAXTIME
 *         return 2
*/
    __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_OUTPUT_MAXTIME);

    /* "H2MM_C.pyx":2165
 *     if time > limits.max_time:
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME
 *         new.conv |= CONVCODE_POST_MAXTIME             # <<<<<<<<<<<<<<
 *         return 2
 *     cdef int ret
*/
    __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_MAXTIME);

    /* "H2MM_C.pyx":2166
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME
 *         new.conv |= CONVCODE_POST_MAXTIME
 *         return 2             # <<<<<<<<<<<<<<
 *     cdef int ret
 *     cdef h2mm_model limit_model
*/
    __pyx_r = 2;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2163
 *         new.conv |= CONVCODE_POST_MAXITER
 *         return 2
 *     if time > limits.max_time:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_OUTPUT_MAXTIME
 *         new.conv |= CONVCODE_POST_MAXTIME
*/
  }

  /* "H2MM_C.pyx":2169
 *     cdef int ret
 *     cdef h2mm_model limit_model
 *     cdef h2mm_model old_mod = model_copy_from_ptr(old)             # <<<<<<<<<<<<<<
 *     cdef h2mm_model cur_mod = model_copy_from_ptr(current)
 *     cdef h2mm_model new_mod = model_copy_from_ptr(new)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_old)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_old_mod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2170
 *     cdef h2mm_model limit_model
 *     cdef h2mm_model old_mod = model_copy_from_ptr(old)
 *     cdef h2mm_model cur_mod = model_copy_from_ptr(current)             # <<<<<<<<<<<<<<
 *     cdef h2mm_model new_mod = model_copy_from_ptr(new)
 *     cdef BoundStruct *bound = <BoundStruct*> instruct
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_current)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_cur_mod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2171
 *     cdef h2mm_model old_mod = model_copy_from_ptr(old)
 *     cdef h2mm_model cur_mod = model_copy_from_ptr(current)
 *     cdef h2mm_model new_mod = model_copy_from_ptr(new)             # <<<<<<<<<<<<<<
 *     cdef BoundStruct *bound = <BoundStruct*> instruct
 *     cdef object func = <object> bound.func
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_new)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_new_mod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2172
 *     cdef h2mm_model cur_mod = model_copy_from_ptr(current)
 *     cdef h2mm_model new_mod = model_copy_from_ptr(new)
 *     cdef BoundStruct *bound = <BoundStruct*> instruct             # <<<<<<<<<<<<<<
 *     cdef object func = <object> bound.func
 *     cdef object args = <object> bound.args
*/
  __pyx_v_bound = ((__pyx_t_6H2MM_C_BoundStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2173
 *     cdef h2mm_model new_mod = model_copy_from_ptr(new)
 *     cdef BoundStruct *bound = <BoundStruct*> instruct
 *     cdef object func = <object> bound.func             # <<<<<<<<<<<<<<
 *     cdef object args = <object> bound.args
 *     cdef object kwargs = <object> bound.kwargs
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bound->func);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_func = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2174
 *     cdef BoundStruct *bound = <BoundStruct*> instruct
 *     cdef object func = <object> bound.func
 *     cdef object args = <object> bound.args             # <<<<<<<<<<<<<<
 *     cdef object kwargs = <object> bound.kwargs
 *     # execute the limit function
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bound->args);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_args = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2175
 *     cdef object func = <object> bound.func
 *     cdef object args = <object> bound.args
 *     cdef object kwargs = <object> bound.kwargs             # <<<<<<<<<<<<<<
 *     # execute the limit function
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bound->kwargs);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_kwargs = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2177
 *     cdef object kwargs = <object> bound.kwargs
 *     # execute the limit function
 *     try:             # <<<<<<<<<<<<<<
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2178
 *     # execute the limit function
 *     try:
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         current.conv |= CONVCODE_ERROR
*/
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF((PyObject *)__pyx_v_new_mod);
      __Pyx_GIVEREF((PyObject *)__pyx_v_new_mod);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_new_mod)) != (0)) __PYX_ERR(0, 2178, __pyx_L6_error);
      __Pyx_INCREF((PyObject *)__pyx_v_cur_mod);
      __Pyx_GIVEREF((PyObject *)__pyx_v_cur_mod);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_cur_mod)) != (0)) __PYX_ERR(0, 2178, __pyx_L6_error);
      __Pyx_INCREF((PyObject *)__pyx_v_old_mod);
      __Pyx_GIVEREF((PyObject *)__pyx_v_old_mod);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_old_mod)) != (0)) __PYX_ERR(0, 2178, __pyx_L6_error);
      __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2178, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2178, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__pyx_v_kwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2178, __pyx_L6_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
        __pyx_t_6 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2178, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2178, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_func, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L6_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_v_limit_res = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2177
 *     cdef object kwargs = <object> bound.kwargs
 *     # execute the limit function
 *     try:             # <<<<<<<<<<<<<<
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:
*/
    }
    __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_L11_try_end;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2179
 *     try:
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_ERROR
 *         Py_INCREF(e)
*/
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_8) {
      __Pyx_AddTraceback("H2MM_C.cy_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2179, __pyx_L8_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_e = __pyx_t_6;
      /*try:*/ {

        /* "H2MM_C.pyx":2180
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:
 *         current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         bound.error = <PyObject*> e
*/
        __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

        /* "H2MM_C.pyx":2181
 *     except Exception as e:
 *         current.conv |= CONVCODE_ERROR
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         bound.error = <PyObject*> e
 *         return -5
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2182
 *         current.conv |= CONVCODE_ERROR
 *         Py_INCREF(e)
 *         bound.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         return -5
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):
*/
        __pyx_v_bound->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2183
 *         Py_INCREF(e)
 *         bound.error = <PyObject*> e
 *         return -5             # <<<<<<<<<<<<<<
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):
 *         current.conv |= CONVCODE_ERROR
*/
        __pyx_r = -5;
        __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;
        goto __pyx_L16_return;
      }

      /* "H2MM_C.pyx":2179
 *     try:
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_ERROR
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        __pyx_L16_return: {
          __pyx_t_8 = __pyx_r;
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          __pyx_r = __pyx_t_8;
          goto __pyx_L9_except_return;
        }
      }
    }
    goto __pyx_L8_except_error;

    /* "H2MM_C.pyx":2177
 *     cdef object kwargs = <object> bound.kwargs
 *     # execute the limit function
 *     try:             # <<<<<<<<<<<<<<
 *         limit_res = func(new_mod, cur_mod, old_mod, *args, **kwargs)
 *     except Exception as e:
*/
    __pyx_L8_except_error:;
    __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_L9_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_L11_try_end:;
  }

  /* "H2MM_C.pyx":2184
 *         bound.error = <PyObject*> e
 *         return -5
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_ERROR
 *         return -4
*/
  __pyx_t_9 = PyList_Check(__pyx_v_limit_res); 
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_9 = PyTuple_Check(__pyx_v_limit_res); 
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_limit_res, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_limit_res, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_9 = PyLong_Check(__pyx_v_limit_res); 
  __pyx_t_1 = __pyx_t_9;
  __pyx_L20_bool_binop_done:;
  __pyx_t_9 = (!__pyx_t_1);
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":2185
 *         return -5
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):
 *         current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *         return -4
 *     elif isinstance(limit_res, bool):
*/
    __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

    /* "H2MM_C.pyx":2186
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):
 *         current.conv |= CONVCODE_ERROR
 *         return -4             # <<<<<<<<<<<<<<
 *     elif isinstance(limit_res, bool):
 *         if limit_res:
*/
    __pyx_r = -4;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2184
 *         bound.error = <PyObject*> e
 *         return -5
 *     if not isinstance(limit_res, (list, tuple, h2mm_model, cnp.ndarray, int)):             # <<<<<<<<<<<<<<
 *         current.conv |= CONVCODE_ERROR
 *         return -4
*/
  }

  /* "H2MM_C.pyx":2187
 *         current.conv |= CONVCODE_ERROR
 *         return -4
 *     elif isinstance(limit_res, bool):             # <<<<<<<<<<<<<<
 *         if limit_res:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
*/
  __pyx_t_9 = PyBool_Check(__pyx_v_limit_res); 
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":2188
 *         return -4
 *     elif isinstance(limit_res, bool):
 *         if limit_res:             # <<<<<<<<<<<<<<
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
*/
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_limit_res); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2188, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2189
 *     elif isinstance(limit_res, bool):
 *         if limit_res:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_POST_CONVERGED
 *             return 1
*/
      __pyx_v_old->conv = (__pyx_v_old->conv | CONVCODE_OUTPUT_CONVERGED);

      /* "H2MM_C.pyx":2190
 *         if limit_res:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             return 1
 *         else:
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_POST_CONVERGED);

      /* "H2MM_C.pyx":2191
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
 *             return 1             # <<<<<<<<<<<<<<
 *         else:
 *             return 0
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2188
 *         return -4
 *     elif isinstance(limit_res, bool):
 *         if limit_res:             # <<<<<<<<<<<<<<
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
*/
    }

    /* "H2MM_C.pyx":2193
 *             return 1
 *         else:
 *             return 0             # <<<<<<<<<<<<<<
 *     elif isinstance(limit_res, int):
 *         if limit_res == 0:
*/
    /*else*/ {
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "H2MM_C.pyx":2187
 *         current.conv |= CONVCODE_ERROR
 *         return -4
 *     elif isinstance(limit_res, bool):             # <<<<<<<<<<<<<<
 *         if limit_res:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
*/
  }

  /* "H2MM_C.pyx":2194
 *         else:
 *             return 0
 *     elif isinstance(limit_res, int):             # <<<<<<<<<<<<<<
 *         if limit_res == 0:
 *             return 0
*/
  __pyx_t_9 = PyLong_Check(__pyx_v_limit_res); 
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":2195
 *             return 0
 *     elif isinstance(limit_res, int):
 *         if limit_res == 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         elif limit_res == 1:
*/
    __pyx_t_9 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_limit_res, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2195, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2196
 *     elif isinstance(limit_res, int):
 *         if limit_res == 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         elif limit_res == 1:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
*/
      __pyx_r = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2195
 *             return 0
 *     elif isinstance(limit_res, int):
 *         if limit_res == 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         elif limit_res == 1:
*/
    }

    /* "H2MM_C.pyx":2197
 *         if limit_res == 0:
 *             return 0
 *         elif limit_res == 1:             # <<<<<<<<<<<<<<
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
*/
    __pyx_t_9 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_limit_res, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2197, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2198
 *             return 0
 *         elif limit_res == 1:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_POST_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED
*/
      __pyx_v_old->conv = (__pyx_v_old->conv | CONVCODE_OUTPUT_CONVERGED);

      /* "H2MM_C.pyx":2199
 *         elif limit_res == 1:
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 1
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_POST_CONVERGED);

      /* "H2MM_C.pyx":2200
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             return 1
 *         elif limit_res == 2:
*/
      __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_CONVERGED);

      /* "H2MM_C.pyx":2201
 *             current.conv |= CONVCODE_POST_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 1             # <<<<<<<<<<<<<<
 *         elif limit_res == 2:
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED
*/
      __pyx_r = 1;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2197
 *         if limit_res == 0:
 *             return 0
 *         elif limit_res == 1:             # <<<<<<<<<<<<<<
 *             old.conv |= CONVCODE_OUTPUT_CONVERGED
 *             current.conv |= CONVCODE_POST_CONVERGED
*/
    }

    /* "H2MM_C.pyx":2202
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 1
 *         elif limit_res == 2:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED
*/
    __pyx_t_9 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_limit_res, __pyx_mstate_global->__pyx_int_2, 2, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2202, __pyx_L1_error)
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2203
 *             return 1
 *         elif limit_res == 2:
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 2
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_OUTPUT_CONVERGED);

      /* "H2MM_C.pyx":2204
 *         elif limit_res == 2:
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             return 2
 *         else:
*/
      __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_CONVERGED);

      /* "H2MM_C.pyx":2205
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 2             # <<<<<<<<<<<<<<
 *         else:
 *             current.conv |= CONVCODE_ERROR
*/
      __pyx_r = 2;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2202
 *             new.conv |= CONVCODE_POST_CONVERGED
 *             return 1
 *         elif limit_res == 2:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_OUTPUT_CONVERGED
 *             new.conv |= CONVCODE_POST_CONVERGED
*/
    }

    /* "H2MM_C.pyx":2207
 *             return 2
 *         else:
 *             current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             return -4
 *     elif isinstance(limit_res, h2mm_model): # when limit function only returns h2mm_model
*/
    /*else*/ {
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2208
 *         else:
 *             current.conv |= CONVCODE_ERROR
 *             return -4             # <<<<<<<<<<<<<<
 *     elif isinstance(limit_res, h2mm_model): # when limit function only returns h2mm_model
 *         limit_model = limit_res
*/
      __pyx_r = -4;
      goto __pyx_L0;
    }

    /* "H2MM_C.pyx":2194
 *         else:
 *             return 0
 *     elif isinstance(limit_res, int):             # <<<<<<<<<<<<<<
 *         if limit_res == 0:
 *             return 0
*/
  }

  /* "H2MM_C.pyx":2209
 *             current.conv |= CONVCODE_ERROR
 *             return -4
 *     elif isinstance(limit_res, h2mm_model): # when limit function only returns h2mm_model             # <<<<<<<<<<<<<<
 *         limit_model = limit_res
 *         # check that return model is valid
*/
  __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_limit_res, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":2210
 *             return -4
 *     elif isinstance(limit_res, h2mm_model): # when limit function only returns h2mm_model
 *         limit_model = limit_res             # <<<<<<<<<<<<<<
 *         # check that return model is valid
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate:
*/
    __pyx_t_7 = __pyx_v_limit_res;
    __Pyx_INCREF(__pyx_t_7);
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 2210, __pyx_L1_error)
    __pyx_v_limit_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":2212
 *         limit_model = limit_res
 *         # check that return model is valid
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    __pyx_t_1 = (__pyx_v_limit_model->model->ndet != __pyx_v_current->ndet);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L28_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_limit_model->model->nstate != __pyx_v_current->nstate);
    __pyx_t_9 = __pyx_t_1;
    __pyx_L28_bool_binop_done:;
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2213
 *         # check that return model is valid
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate:
 *             current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             new.conv |= CONVCODE_ERROR
 *             return -3
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2214
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate:
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             return -3
 *         ret = h2mm_check_converged(new, current, old, time, limits)
*/
      __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2215
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
 *             return -3             # <<<<<<<<<<<<<<
 *         ret = h2mm_check_converged(new, current, old, time, limits)
 *         if ret != 0:
*/
      __pyx_r = -3;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2212
 *         limit_model = limit_res
 *         # check that return model is valid
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    }

    /* "H2MM_C.pyx":2216
 *             new.conv |= CONVCODE_ERROR
 *             return -3
 *         ret = h2mm_check_converged(new, current, old, time, limits)             # <<<<<<<<<<<<<<
 *         if ret != 0:
 *             return ret
*/
    __pyx_v_ret = h2mm_check_converged(__pyx_v_new, __pyx_v_current, __pyx_v_old, __pyx_v_time, __pyx_v_limits);

    /* "H2MM_C.pyx":2217
 *             return -3
 *         ret = h2mm_check_converged(new, current, old, time, limits)
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             return ret
 *         else:
*/
    __pyx_t_9 = (__pyx_v_ret != 0);
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2218
 *         ret = h2mm_check_converged(new, current, old, time, limits)
 *         if ret != 0:
 *             return ret             # <<<<<<<<<<<<<<
 *         else:
 *             copy_model_vals(limit_model.model, new)
*/
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2217
 *             return -3
 *         ret = h2mm_check_converged(new, current, old, time, limits)
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             return ret
 *         else:
*/
    }

    /* "H2MM_C.pyx":2220
 *             return ret
 *         else:
 *             copy_model_vals(limit_model.model, new)             # <<<<<<<<<<<<<<
 *             return ret
 *     # if the function returns 2 values, run longer processing code
*/
    /*else*/ {
      (void)(copy_model_vals(__pyx_v_limit_model->model, __pyx_v_new));

      /* "H2MM_C.pyx":2221
 *         else:
 *             copy_model_vals(limit_model.model, new)
 *             return ret             # <<<<<<<<<<<<<<
 *     # if the function returns 2 values, run longer processing code
 *     elif isinstance(limit_res, (list, tuple, cnp.ndarray)):
*/
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
    }

    /* "H2MM_C.pyx":2209
 *             current.conv |= CONVCODE_ERROR
 *             return -4
 *     elif isinstance(limit_res, h2mm_model): # when limit function only returns h2mm_model             # <<<<<<<<<<<<<<
 *         limit_model = limit_res
 *         # check that return model is valid
*/
  }

  /* "H2MM_C.pyx":2223
 *             return ret
 *     # if the function returns 2 values, run longer processing code
 *     elif isinstance(limit_res, (list, tuple, cnp.ndarray)):             # <<<<<<<<<<<<<<
 *         # check deeper validity of return value
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:
*/
  __pyx_t_1 = PyList_Check(__pyx_v_limit_res); 
  if (!__pyx_t_1) {
  } else {
    __pyx_t_9 = __pyx_t_1;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_1 = PyTuple_Check(__pyx_v_limit_res); 
  if (!__pyx_t_1) {
  } else {
    __pyx_t_9 = __pyx_t_1;
    goto __pyx_L31_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_limit_res, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  __pyx_t_9 = __pyx_t_1;
  __pyx_L31_bool_binop_done:;
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":2225
 *     elif isinstance(limit_res, (list, tuple, cnp.ndarray)):
 *         # check deeper validity of return value
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    __pyx_t_10 = PyObject_Length(__pyx_v_limit_res); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2225, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_10 != 2);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L35_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_limit_res, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = (!__pyx_t_1);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_9 = __pyx_t_11;
      goto __pyx_L35_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_limit_res, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyBool_Check(__pyx_t_7); 
    if (!__pyx_t_1) {
    } else {
      __pyx_t_11 = __pyx_t_1;
      goto __pyx_L39_bool_binop_done;
    }
    __pyx_t_1 = PyLong_Check(__pyx_t_7); 
    __pyx_t_11 = __pyx_t_1;
    __pyx_L39_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = (!__pyx_t_11);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L35_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_limit_res, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_mstate_global->__pyx_int_2, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2225, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2225, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = __pyx_t_1;
    __pyx_L35_bool_binop_done:;
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2226
 *         # check deeper validity of return value
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:
 *             current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             new.conv |= CONVCODE_ERROR
 *             return -4
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2227
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             return -4
 *         limit_model = limit_res[0]
*/
      __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2228
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
 *             return -4             # <<<<<<<<<<<<<<
 *         limit_model = limit_res[0]
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model
*/
      __pyx_r = -4;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2225
 *     elif isinstance(limit_res, (list, tuple, cnp.ndarray)):
 *         # check deeper validity of return value
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    }

    /* "H2MM_C.pyx":2229
 *             new.conv |= CONVCODE_ERROR
 *             return -4
 *         limit_model = limit_res[0]             # <<<<<<<<<<<<<<
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model
 *             current.conv |= CONVCODE_ERROR
*/
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_limit_res, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 2229, __pyx_L1_error)
    __pyx_v_limit_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":2230
 *             return -4
 *         limit_model = limit_res[0]
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    __pyx_t_1 = (__pyx_v_limit_model->model->ndet != __pyx_v_current->ndet);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L42_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_limit_model->model->nstate != __pyx_v_current->nstate);
    __pyx_t_9 = __pyx_t_1;
    __pyx_L42_bool_binop_done:;
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2231
 *         limit_model = limit_res[0]
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model
 *             current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             new.conv |= CONVCODE_ERROR
 *             return -3
*/
      __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2232
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *             return -3
 *         copy_model_vals(limit_model.model, new)
*/
      __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_ERROR);

      /* "H2MM_C.pyx":2233
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
 *             return -3             # <<<<<<<<<<<<<<
 *         copy_model_vals(limit_model.model, new)
 *         if isinstance(limit_res[1], bool):
*/
      __pyx_r = -3;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2230
 *             return -4
 *         limit_model = limit_res[0]
 *         if limit_model.model.ndet != current.ndet or limit_model.model.nstate != current.nstate: # bad return model             # <<<<<<<<<<<<<<
 *             current.conv |= CONVCODE_ERROR
 *             new.conv |= CONVCODE_ERROR
*/
    }

    /* "H2MM_C.pyx":2234
 *             new.conv |= CONVCODE_ERROR
 *             return -3
 *         copy_model_vals(limit_model.model, new)             # <<<<<<<<<<<<<<
 *         if isinstance(limit_res[1], bool):
 *             if limit_res[1]:
*/
    (void)(copy_model_vals(__pyx_v_limit_model->model, __pyx_v_new));

    /* "H2MM_C.pyx":2235
 *             return -3
 *         copy_model_vals(limit_model.model, new)
 *         if isinstance(limit_res[1], bool):             # <<<<<<<<<<<<<<
 *             if limit_res[1]:
 *                 return 0
*/
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_limit_res, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyBool_Check(__pyx_t_6); 
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":2236
 *         copy_model_vals(limit_model.model, new)
 *         if isinstance(limit_res[1], bool):
 *             if limit_res[1]:             # <<<<<<<<<<<<<<
 *                 return 0
 *             else:
*/
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_limit_res, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2236, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_9) {

        /* "H2MM_C.pyx":2237
 *         if isinstance(limit_res[1], bool):
 *             if limit_res[1]:
 *                 return 0             # <<<<<<<<<<<<<<
 *             else:
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
*/
        __pyx_r = 0;
        goto __pyx_L0;

        /* "H2MM_C.pyx":2236
 *         copy_model_vals(limit_model.model, new)
 *         if isinstance(limit_res[1], bool):
 *             if limit_res[1]:             # <<<<<<<<<<<<<<
 *                 return 0
 *             else:
*/
      }

      /* "H2MM_C.pyx":2239
 *                 return 0
 *             else:
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *                 current.conv |= CONVCODE_POST_CONVERGED
 *                 return 1
*/
      /*else*/ {
        __pyx_v_old->conv = (__pyx_v_old->conv | CONVCODE_OUTPUT_CONVERGED);

        /* "H2MM_C.pyx":2240
 *             else:
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 current.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *                 return 1
 *         else:
*/
        __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_POST_CONVERGED);

        /* "H2MM_C.pyx":2241
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 current.conv |= CONVCODE_POST_CONVERGED
 *                 return 1             # <<<<<<<<<<<<<<
 *         else:
 *             ret = limit_res[1]
*/
        __pyx_r = 1;
        goto __pyx_L0;
      }

      /* "H2MM_C.pyx":2235
 *             return -3
 *         copy_model_vals(limit_model.model, new)
 *         if isinstance(limit_res[1], bool):             # <<<<<<<<<<<<<<
 *             if limit_res[1]:
 *                 return 0
*/
    }

    /* "H2MM_C.pyx":2243
 *                 return 1
 *         else:
 *             ret = limit_res[1]             # <<<<<<<<<<<<<<
 *             if ret == 0:
 *                 pass
*/
    /*else*/ {
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_limit_res, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2243, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_ret = __pyx_t_8;

      /* "H2MM_C.pyx":2244
 *         else:
 *             ret = limit_res[1]
 *             if ret == 0:             # <<<<<<<<<<<<<<
 *                 pass
 *             elif ret == 1:
*/
      switch (__pyx_v_ret) {
        case 0:
        break;
        case 1:

        /* "H2MM_C.pyx":2247
 *                 pass
 *             elif ret == 1:
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *                 current.conv |= CONVCODE_POST_CONVERGED
 *                 new.conv |= CONVCODE_POST_CONVERGED
*/
        __pyx_v_old->conv = (__pyx_v_old->conv | CONVCODE_OUTPUT_CONVERGED);

        /* "H2MM_C.pyx":2248
 *             elif ret == 1:
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 current.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *                 new.conv |= CONVCODE_POST_CONVERGED
 *             elif ret == 2:
*/
        __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_POST_CONVERGED);

        /* "H2MM_C.pyx":2249
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 current.conv |= CONVCODE_POST_CONVERGED
 *                 new.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             elif ret == 2:
 *                 current.conv |= CONVCODE_OUTPUT_CONVERGED
*/
        __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_CONVERGED);

        /* "H2MM_C.pyx":2246
 *             if ret == 0:
 *                 pass
 *             elif ret == 1:             # <<<<<<<<<<<<<<
 *                 old.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 current.conv |= CONVCODE_POST_CONVERGED
*/
        break;
        case 2:

        /* "H2MM_C.pyx":2251
 *                 new.conv |= CONVCODE_POST_CONVERGED
 *             elif ret == 2:
 *                 current.conv |= CONVCODE_OUTPUT_CONVERGED             # <<<<<<<<<<<<<<
 *                 new.conv |= CONVCODE_POST_CONVERGED
 *             else:
*/
        __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_OUTPUT_CONVERGED);

        /* "H2MM_C.pyx":2252
 *             elif ret == 2:
 *                 current.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 new.conv |= CONVCODE_POST_CONVERGED             # <<<<<<<<<<<<<<
 *             else:
 *                 current.conv |= CONVCODE_ERROR
*/
        __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_POST_CONVERGED);

        /* "H2MM_C.pyx":2250
 *                 current.conv |= CONVCODE_POST_CONVERGED
 *                 new.conv |= CONVCODE_POST_CONVERGED
 *             elif ret == 2:             # <<<<<<<<<<<<<<
 *                 current.conv |= CONVCODE_OUTPUT_CONVERGED
 *                 new.conv |= CONVCODE_POST_CONVERGED
*/
        break;
        default:

        /* "H2MM_C.pyx":2254
 *                 new.conv |= CONVCODE_POST_CONVERGED
 *             else:
 *                 current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *                 new.conv |= CONVCODE_ERROR
 *                 return -3
*/
        __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

        /* "H2MM_C.pyx":2255
 *             else:
 *                 current.conv |= CONVCODE_ERROR
 *                 new.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *                 return -3
 *             return ret
*/
        __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_ERROR);

        /* "H2MM_C.pyx":2256
 *                 current.conv |= CONVCODE_ERROR
 *                 new.conv |= CONVCODE_ERROR
 *                 return -3             # <<<<<<<<<<<<<<
 *             return ret
 *     # invalid return value of limits func
*/
        __pyx_r = -3;
        goto __pyx_L0;
        break;
      }

      /* "H2MM_C.pyx":2257
 *                 new.conv |= CONVCODE_ERROR
 *                 return -3
 *             return ret             # <<<<<<<<<<<<<<
 *     # invalid return value of limits func
 *     current.conv |= CONVCODE_ERROR
*/
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
    }

    /* "H2MM_C.pyx":2223
 *             return ret
 *     # if the function returns 2 values, run longer processing code
 *     elif isinstance(limit_res, (list, tuple, cnp.ndarray)):             # <<<<<<<<<<<<<<
 *         # check deeper validity of return value
 *         if len(limit_res) != 2 or not isinstance(limit_res[0], h2mm_model) or not isinstance(limit_res[1], (bool, int)) or limit_res[1] > 2:
*/
  }

  /* "H2MM_C.pyx":2259
 *             return ret
 *     # invalid return value of limits func
 *     current.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *     new.conv |= CONVCODE_ERROR
 *     return -4
*/
  __pyx_v_current->conv = (__pyx_v_current->conv | CONVCODE_ERROR);

  /* "H2MM_C.pyx":2260
 *     # invalid return value of limits func
 *     current.conv |= CONVCODE_ERROR
 *     new.conv |= CONVCODE_ERROR             # <<<<<<<<<<<<<<
 *     return -4
 * 
*/
  __pyx_v_new->conv = (__pyx_v_new->conv | CONVCODE_ERROR);

  /* "H2MM_C.pyx":2261
 *     current.conv |= CONVCODE_ERROR
 *     new.conv |= CONVCODE_ERROR
 *     return -4             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = -4;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2150
 * 
 * # The wrapper for the user supplied python limits function
 * cdef int cy_limit(h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double time, lm* limits, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     # initial checks ensuring model does not optimize too long or have loglik error
 *     new.niter = current.niter + 1
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("H2MM_C.cy_limit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_limit_model);
  __Pyx_XDECREF((PyObject *)__pyx_v_old_mod);
  __Pyx_XDECREF((PyObject *)__pyx_v_cur_mod);
  __Pyx_XDECREF((PyObject *)__pyx_v_new_mod);
  __Pyx_XDECREF(__pyx_v_func);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_limit_res);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2265
 * 
 * # The wrapper for the user supplied print function that displays a string
 * cdef int model_print_call(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_call(int64_t __pyx_v_niter, h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, double __pyx_v_t_iter, double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  PyObject *__pyx_v_pfunc = 0;
  PyObject *__pyx_v_pargs = 0;
  PyObject *__pyx_v_pkwargs = 0;
  int __pyx_v_ret;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_new_model = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_current_model = 0;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_old_model = 0;
  PyObject *__pyx_v_e = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __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;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_call", 0);

  /* "H2MM_C.pyx":2266
 * # The wrapper for the user supplied print function that displays a string
 * cdef int model_print_call(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2267
 * cdef int model_print_call(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2267, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2268
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef object pfunc = <object> prnt_strct.func
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2267
 * cdef int model_print_call(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2269
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef object pfunc = <object> prnt_strct.func
 *     cdef object pargs = <object> prnt_strct.args
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2270
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef object pfunc = <object> prnt_strct.func             # <<<<<<<<<<<<<<
 *     cdef object pargs = <object> prnt_strct.args
 *     cdef object pkwargs = <object> prnt_strct.kwargs
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->func);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pfunc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2271
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef object pfunc = <object> prnt_strct.func
 *     cdef object pargs = <object> prnt_strct.args             # <<<<<<<<<<<<<<
 *     cdef object pkwargs = <object> prnt_strct.kwargs
 *     cdef int ret = 0
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->args);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pargs = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2272
 *     cdef object pfunc = <object> prnt_strct.func
 *     cdef object pargs = <object> prnt_strct.args
 *     cdef object pkwargs = <object> prnt_strct.kwargs             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     cdef h2mm_model new_model = model_copy_from_ptr(new)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->kwargs);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pkwargs = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2273
 *     cdef object pargs = <object> prnt_strct.args
 *     cdef object pkwargs = <object> prnt_strct.kwargs
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     cdef h2mm_model new_model = model_copy_from_ptr(new)
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2274
 *     cdef object pkwargs = <object> prnt_strct.kwargs
 *     cdef int ret = 0
 *     cdef h2mm_model new_model = model_copy_from_ptr(new)             # <<<<<<<<<<<<<<
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_new)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_new_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2275
 *     cdef int ret = 0
 *     cdef h2mm_model new_model = model_copy_from_ptr(new)
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)             # <<<<<<<<<<<<<<
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
 *     new_model.normalize()
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_current)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_current_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2276
 *     cdef h2mm_model new_model = model_copy_from_ptr(new)
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)             # <<<<<<<<<<<<<<
 *     new_model.normalize()
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_old)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_old_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2277
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
 *     new_model.normalize()             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_new_model);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2278
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
 *     new_model.normalize()
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "H2MM_C.pyx":2279
 *     new_model.normalize()
 *     try:
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_3 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyLong_From_int64_t(__pyx_v_niter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_t_iter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyFloat_FromDouble(__pyx_v_t_total); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __Pyx_INCREF((PyObject *)__pyx_v_new_model);
      __Pyx_GIVEREF((PyObject *)__pyx_v_new_model);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_new_model)) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __Pyx_INCREF((PyObject *)__pyx_v_current_model);
      __Pyx_GIVEREF((PyObject *)__pyx_v_current_model);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_v_current_model)) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __Pyx_INCREF((PyObject *)__pyx_v_old_model);
      __Pyx_GIVEREF((PyObject *)__pyx_v_old_model);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)__pyx_v_old_model)) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __Pyx_GIVEREF(__pyx_t_9);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_9) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __Pyx_GIVEREF(__pyx_t_10);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_10) != (0)) __PYX_ERR(0, 2279, __pyx_L4_error);
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PySequence_Tuple(__pyx_v_pargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__pyx_v_pkwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 2279, __pyx_L4_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_pkwargs))) {
        __pyx_t_10 = PyDict_Copy(__pyx_v_pkwargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2279, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_10);
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_v_pkwargs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2279, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_v_pfunc, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2279, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_11};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2279, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2278
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
 *     new_model.normalize()
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:
*/
    }
    __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;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2280
 *     try:
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_12) {
      __Pyx_AddTraceback("H2MM_C.model_print_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_11, &__pyx_t_3) < 0) __PYX_ERR(0, 2280, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_11);
      __pyx_v_e = __pyx_t_11;
      /*try:*/ {

        /* "H2MM_C.pyx":2281
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2282
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2283
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2280
 *     try:
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2278
 *     cdef h2mm_model old_model = model_copy_from_ptr(old)
 *     new_model.normalize()
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(pfunc(niter, new_model, current_model, old_model, t_iter, t_total, *pargs, **pkwargs))
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L9_try_end:;
  }

  /* "H2MM_C.pyx":2284
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2265
 * 
 * # The wrapper for the user supplied print function that displays a string
 * cdef int model_print_call(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_WriteUnraisable("H2MM_C.model_print_call", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_pfunc);
  __Pyx_XDECREF(__pyx_v_pargs);
  __Pyx_XDECREF(__pyx_v_pkwargs);
  __Pyx_XDECREF((PyObject *)__pyx_v_new_model);
  __Pyx_XDECREF((PyObject *)__pyx_v_current_model);
  __Pyx_XDECREF((PyObject *)__pyx_v_old_model);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2287
 * 
 * 
 * cdef int model_print_all(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_all(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, CYTHON_UNUSED h2mm_mod *__pyx_v_old, double __pyx_v_t_iter, double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_current_model = 0;
  PyObject *__pyx_v_e = 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;
  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[4];
  size_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_all", 0);

  /* "H2MM_C.pyx":2288
 * 
 * cdef int model_print_all(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2289
 * cdef int model_print_all(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2289, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2290
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2289
 * cdef int model_print_all(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2291
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2292
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     try:
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2293
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
*/
  __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_current)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_current_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2294
 *     cdef int ret = 0
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2295
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     try:
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = PyObject_Repr(((PyObject *)__pyx_v_current_model)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_iter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Iteration_time;
      __pyx_t_11[1] = __pyx_t_9;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_Total;
      __pyx_t_11[3] = __pyx_t_10;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_11, 4, 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2295, __pyx_L4_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_t_10 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2295, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2295, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2294
 *     cdef int ret = 0
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:
*/
    }
    __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_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2296
 *     try:
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_13) {
      __Pyx_AddTraceback("H2MM_C.model_print_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_6) < 0) __PYX_ERR(0, 2296, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_v_e = __pyx_t_10;
      /*try:*/ {

        /* "H2MM_C.pyx":2297
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2298
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2299
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2296
 *     try:
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2294
 *     cdef int ret = 0
 *     cdef h2mm_model current_model = model_copy_from_ptr(current)
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(repr(current_model)+f"\nIteration time:{t_iter}, Total:{t_total}")
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2300
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2287
 * 
 * 
 * cdef int model_print_all(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_WriteUnraisable("H2MM_C.model_print_all", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF((PyObject *)__pyx_v_current_model);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2303
 * 
 * 
 * cdef int model_print_diff(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_diff(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, CYTHON_UNUSED double __pyx_v_t_iter, CYTHON_UNUSED double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  PyObject *__pyx_v_e = 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;
  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[6];
  size_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_diff", 0);

  /* "H2MM_C.pyx":2304
 * 
 * cdef int model_print_diff(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2305
 * cdef int model_print_diff(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2305, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2306
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2305
 * cdef int model_print_diff(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2307
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2308
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2309
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2310
 *     cdef int ret = 0
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 5, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_current->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble((__pyx_v_current->loglik - __pyx_v_old->loglik)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_6e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Iteration;
      __pyx_t_11[1] = __pyx_t_7;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_loglik_3;
      __pyx_t_11[3] = __pyx_t_9;
      __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u_improvement;
      __pyx_t_11[5] = __pyx_t_10;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_11, 6, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2310, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2309
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:
*/
    }
    __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_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2311
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_13) {
      __Pyx_AddTraceback("H2MM_C.model_print_diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 2311, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_e = __pyx_t_8;
      /*try:*/ {

        /* "H2MM_C.pyx":2312
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2313
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2314
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2311
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2309
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e}')
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2315
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2303
 * 
 * 
 * cdef int model_print_diff(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_WriteUnraisable("H2MM_C.model_print_diff", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2318
 * 
 * 
 * cdef int model_print_diff_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_diff_time(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, double __pyx_v_t_iter, double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  PyObject *__pyx_v_e = 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;
  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;
  PyObject *__pyx_t_13[10];
  size_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_diff_time", 0);

  /* "H2MM_C.pyx":2319
 * 
 * cdef int model_print_diff_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2320
 * cdef int model_print_diff_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2320, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2321
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2320
 * cdef int model_print_diff_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2322
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2323
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2324
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2325
 *     cdef int ret = 0
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 5, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_current->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble((__pyx_v_current->loglik - __pyx_v_old->loglik)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_6e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_iter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u_Iteration;
      __pyx_t_13[1] = __pyx_t_7;
      __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u_loglik_3;
      __pyx_t_13[3] = __pyx_t_9;
      __pyx_t_13[4] = __pyx_mstate_global->__pyx_kp_u_improvement;
      __pyx_t_13[5] = __pyx_t_10;
      __pyx_t_13[6] = __pyx_mstate_global->__pyx_kp_u_iteration_time;
      __pyx_t_13[7] = __pyx_t_11;
      __pyx_t_13[8] = __pyx_mstate_global->__pyx_kp_u_total;
      __pyx_t_13[9] = __pyx_t_12;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_13, 10, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 14 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2325, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __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_t_14 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2325, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2324
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:
*/
    }
    __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_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_6); __pyx_t_6 = 0;
    __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;

    /* "H2MM_C.pyx":2326
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_15) {
      __Pyx_AddTraceback("H2MM_C.model_print_diff_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 2326, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_e = __pyx_t_8;
      /*try:*/ {

        /* "H2MM_C.pyx":2327
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2328
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2329
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2326
 *     try:
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2324
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f'Iteration:{niter:5d}, loglik:{current.loglik:12e}, improvement:{current.loglik - old.loglik:6e} iteration time:{t_iter}, total:{t_total}')
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2330
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2318
 * 
 * 
 * cdef int model_print_diff_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_WriteUnraisable("H2MM_C.model_print_diff_time", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2333
 * 
 * 
 * cdef int model_print_comp(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_comp(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, CYTHON_UNUSED double __pyx_v_t_iter, CYTHON_UNUSED double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  PyObject *__pyx_v_e = 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;
  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[6];
  size_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_comp", 0);

  /* "H2MM_C.pyx":2334
 * 
 * cdef int model_print_comp(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2335
 * cdef int model_print_comp(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2335, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2336
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2335
 * cdef int model_print_comp(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2337
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2338
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2339
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2340
 *     cdef int ret = 0
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 5, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_current->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_old->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Iteration;
      __pyx_t_11[1] = __pyx_t_7;
      __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_loglik_3;
      __pyx_t_11[3] = __pyx_t_9;
      __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u_previous_loglik;
      __pyx_t_11[5] = __pyx_t_10;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_11, 6, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2340, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2340, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2339
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:
*/
    }
    __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_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2341
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_13) {
      __Pyx_AddTraceback("H2MM_C.model_print_comp", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 2341, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_e = __pyx_t_8;
      /*try:*/ {

        /* "H2MM_C.pyx":2342
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2343
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2344
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2341
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2339
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e}")
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2345
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2333
 * 
 * 
 * cdef int model_print_comp(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_WriteUnraisable("H2MM_C.model_print_comp", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2348
 * 
 * 
 * cdef int model_print_comp_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_comp_time(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, h2mm_mod *__pyx_v_current, h2mm_mod *__pyx_v_old, double __pyx_v_t_iter, double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  PyObject *__pyx_v_e = 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;
  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;
  PyObject *__pyx_t_13[10];
  size_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_comp_time", 0);

  /* "H2MM_C.pyx":2349
 * 
 * cdef int model_print_comp_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2350
 * cdef int model_print_comp_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2350, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2351
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2350
 * cdef int model_print_comp_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2352
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2353
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2354
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2355
 *     cdef int ret = 0
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 5, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_current->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_old->loglik); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_12e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_iter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_t_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_13[0] = __pyx_mstate_global->__pyx_kp_u_Iteration;
      __pyx_t_13[1] = __pyx_t_7;
      __pyx_t_13[2] = __pyx_mstate_global->__pyx_kp_u_loglik_3;
      __pyx_t_13[3] = __pyx_t_9;
      __pyx_t_13[4] = __pyx_mstate_global->__pyx_kp_u_previous_loglik;
      __pyx_t_13[5] = __pyx_t_10;
      __pyx_t_13[6] = __pyx_mstate_global->__pyx_kp_u_iteration_time;
      __pyx_t_13[7] = __pyx_t_11;
      __pyx_t_13[8] = __pyx_mstate_global->__pyx_kp_u_total;
      __pyx_t_13[9] = __pyx_t_12;
      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_13, 10, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 16 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2355, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __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_t_14 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2355, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2354
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:
*/
    }
    __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_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_6); __pyx_t_6 = 0;
    __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;

    /* "H2MM_C.pyx":2356
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_15) {
      __Pyx_AddTraceback("H2MM_C.model_print_comp_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 2356, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __pyx_v_e = __pyx_t_8;
      /*try:*/ {

        /* "H2MM_C.pyx":2357
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2358
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2359
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2356
 *     try:
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2354
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration:{niter:5d}, loglik:{current.loglik:12e}, previous loglik:{old.loglik:12e} iteration time:{t_iter}, total:{t_total}")
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2360
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2348
 * 
 * 
 * cdef int model_print_comp_time(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_WriteUnraisable("H2MM_C.model_print_comp_time", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2363
 * 
 * 
 * cdef int model_print_iter(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

static int __pyx_f_6H2MM_C_model_print_iter(int64_t __pyx_v_niter, CYTHON_UNUSED h2mm_mod *__pyx_v_new, CYTHON_UNUSED h2mm_mod *__pyx_v_current, CYTHON_UNUSED h2mm_mod *__pyx_v_old, CYTHON_UNUSED double __pyx_v_t_iter, CYTHON_UNUSED double __pyx_v_t_total, void *__pyx_v_instruct) {
  __pyx_t_6H2MM_C_PrintStruct *__pyx_v_prnt_strct;
  PyObject *__pyx_v_formatter = 0;
  int __pyx_v_ret;
  PyObject *__pyx_v_e = 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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[5];
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  __Pyx_RefNannySetupContext("model_print_iter", 0);

  /* "H2MM_C.pyx":2364
 * 
 * cdef int model_print_iter(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct             # <<<<<<<<<<<<<<
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
*/
  __pyx_v_prnt_strct = ((__pyx_t_6H2MM_C_PrintStruct *)__pyx_v_instruct);

  /* "H2MM_C.pyx":2365
 * cdef int model_print_iter(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  if (unlikely(__pyx_v_prnt_strct->disp_freq == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 2365, __pyx_L1_error)
  }
  __pyx_t_1 = (__Pyx_mod_int64_t(__pyx_v_niter, __pyx_v_prnt_strct->disp_freq, 0) != 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2366
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2365
 * cdef int model_print_iter(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
*/
  }

  /* "H2MM_C.pyx":2367
 *     if niter % prnt_strct.disp_freq != 0:
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter             # <<<<<<<<<<<<<<
 *     cdef int ret = 0
 *     try:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_prnt_strct->formatter);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_formatter = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2368
 *         return 0
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0             # <<<<<<<<<<<<<<
 *     try:
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
*/
  __pyx_v_ret = 0;

  /* "H2MM_C.pyx":2369
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2370
 *     cdef int ret = 0
 *     try:
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
*/
      __pyx_t_6 = __pyx_v_formatter;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 5, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2370, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyUnicode_From_int64_t(__pyx_v_prnt_strct->max_iter, 5, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2370, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_Iteration_2;
      __pyx_t_9[1] = __pyx_t_7;
      __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_Max;
      __pyx_t_9[3] = __pyx_t_8;
      __pyx_t_9[4] = __pyx_mstate_global->__pyx_kp_u__5;
      __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 1, 127);
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2370, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2370, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "H2MM_C.pyx":2369
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:
*/
    }
    __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_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;

    /* "H2MM_C.pyx":2371
 *     try:
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_12) {
      __Pyx_AddTraceback("H2MM_C.model_print_iter", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_6) < 0) __PYX_ERR(0, 2371, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_10);
      __pyx_v_e = __pyx_t_10;
      /*try:*/ {

        /* "H2MM_C.pyx":2372
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e             # <<<<<<<<<<<<<<
 *         Py_INCREF(e)
 *         ret = -1
*/
        __pyx_v_prnt_strct->error = ((PyObject *)__pyx_v_e);

        /* "H2MM_C.pyx":2373
 *     except Exception as e:
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)             # <<<<<<<<<<<<<<
 *         ret = -1
 *     return ret
*/
        Py_INCREF(__pyx_v_e);

        /* "H2MM_C.pyx":2374
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
 *         ret = -1             # <<<<<<<<<<<<<<
 *     return ret
 * 
*/
        __pyx_v_ret = -1;
      }

      /* "H2MM_C.pyx":2371
 *     try:
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         prnt_strct.error = <PyObject*> e
 *         Py_INCREF(e)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2369
 *     cdef object formatter = <object> prnt_strct.formatter
 *     cdef int ret = 0
 *     try:             # <<<<<<<<<<<<<<
 *         formatter.update(f"Iteration {niter:5d} (Max:{prnt_strct.max_iter:5d})")
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __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_L5_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_L9_try_end:;
  }

  /* "H2MM_C.pyx":2375
 *         Py_INCREF(e)
 *         ret = -1
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2363
 * 
 * 
 * cdef int model_print_iter(int64_t niter, h2mm_mod *new, h2mm_mod *current, h2mm_mod *old, double t_iter, double t_total, void *instruct) noexcept with gil:             # <<<<<<<<<<<<<<
 *     cdef PrintStruct *prnt_strct = <PrintStruct*> instruct
 *     if niter % prnt_strct.disp_freq != 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("H2MM_C.model_print_iter", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formatter);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_RefNannyFinishContext();
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  return __pyx_r;
}

/* "H2MM_C.pyx":2381
 * #################### Casting burst input arrays funcstions ####################
 * ###############################################################################
 * cdef int free_deltas(int64_t nbursts, int32_t **data):             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         return 0
*/

static int __pyx_f_6H2MM_C_free_deltas(int64_t __pyx_v_nbursts, int32_t **__pyx_v_data) {
  int64_t __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  int64_t __pyx_t_4;

  /* "H2MM_C.pyx":2382
 * ###############################################################################
 * cdef int free_deltas(int64_t nbursts, int32_t **data):
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i
*/
  __pyx_t_1 = (__pyx_v_data == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2383
 * cdef int free_deltas(int64_t nbursts, int32_t **data):
 *     if data is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     for i in range(nbursts):
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2382
 * ###############################################################################
 * cdef int free_deltas(int64_t nbursts, int32_t **data):
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i
*/
  }

  /* "H2MM_C.pyx":2385
 *         return 0
 *     cdef int64_t i
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         if data[i] is not NULL:
 *             PyMem_Free(data[i])
*/
  __pyx_t_2 = __pyx_v_nbursts;
  __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;

    /* "H2MM_C.pyx":2386
 *     cdef int64_t i
 *     for i in range(nbursts):
 *         if data[i] is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(data[i])
 *             data[i] = NULL
*/
    __pyx_t_1 = ((__pyx_v_data[__pyx_v_i]) != NULL);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":2387
 *     for i in range(nbursts):
 *         if data[i] is not NULL:
 *             PyMem_Free(data[i])             # <<<<<<<<<<<<<<
 *             data[i] = NULL
 *     PyMem_Free(data)
*/
      PyMem_Free((__pyx_v_data[__pyx_v_i]));

      /* "H2MM_C.pyx":2388
 *         if data[i] is not NULL:
 *             PyMem_Free(data[i])
 *             data[i] = NULL             # <<<<<<<<<<<<<<
 *     PyMem_Free(data)
 *     return 0
*/
      (__pyx_v_data[__pyx_v_i]) = NULL;

      /* "H2MM_C.pyx":2386
 *     cdef int64_t i
 *     for i in range(nbursts):
 *         if data[i] is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(data[i])
 *             data[i] = NULL
*/
    }
  }

  /* "H2MM_C.pyx":2389
 *             PyMem_Free(data[i])
 *             data[i] = NULL
 *     PyMem_Free(data)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  PyMem_Free(__pyx_v_data);

  /* "H2MM_C.pyx":2390
 *             data[i] = NULL
 *     PyMem_Free(data)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int free_idx_diffs_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2381
 * #################### Casting burst input arrays funcstions ####################
 * ###############################################################################
 * cdef int free_deltas(int64_t nbursts, int32_t **data):             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":2392
 *     return 0
 * 
 * cdef int free_idx_diffs_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs):             # <<<<<<<<<<<<<<
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
*/

static int __pyx_f_6H2MM_C_free_idx_diffs_arrays(int64_t __pyx_v_i, int64_t *__pyx_v_ilens, uint8_t **__pyx_v_iidxs, int32_t **__pyx_v_idiffs) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":2393
 * 
 * cdef int free_idx_diffs_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs):
 *     free_deltas(i, idiffs)             # <<<<<<<<<<<<<<
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_free_deltas(__pyx_v_i, __pyx_v_idiffs); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2393, __pyx_L1_error)

  /* "H2MM_C.pyx":2394
 * cdef int free_idx_diffs_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs):
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)             # <<<<<<<<<<<<<<
 *     PyMem_Free(ilens)
 *     return 0
*/
  PyMem_Free(__pyx_v_iidxs);

  /* "H2MM_C.pyx":2395
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  PyMem_Free(__pyx_v_ilens);

  /* "H2MM_C.pyx":2396
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef tuple reshape_burst_arrays(burst_array, str name):
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2392
 *     return 0
 * 
 * cdef int free_idx_diffs_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs):             # <<<<<<<<<<<<<<
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.free_idx_diffs_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":2398
 *     return 0
 * 
 * cdef tuple reshape_burst_arrays(burst_array, str name):             # <<<<<<<<<<<<<<
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
*/

static PyObject *__pyx_f_6H2MM_C_reshape_burst_arrays(PyObject *__pyx_v_burst_array, PyObject *__pyx_v_name) {
  int __pyx_v_single;
  PyObject *__pyx_v_shape = 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;
  size_t __pyx_t_5;
  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;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reshape_burst_arrays", 0);
  __Pyx_INCREF(__pyx_v_burst_array);

  /* "H2MM_C.pyx":2399
 * 
 * cdef tuple reshape_burst_arrays(burst_array, str name):
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
 *     cdef bint single = False
*/
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_burst_array, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_burst_array, __pyx_t_1); 
  __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);
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2400
 * cdef tuple reshape_burst_arrays(burst_array, str name):
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")             # <<<<<<<<<<<<<<
 *     cdef bint single = False
 *     if isinstance(burst_array, cnp.ndarray):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_7 = NULL;
    __pyx_t_8 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_must_be_readable_as_sequence_or); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 2400, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 2400, __pyx_L1_error);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, Py_False) != (0)) __PYX_ERR(0, 2400, __pyx_L1_error);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 3, Py_True) != (0)) __PYX_ERR(0, 2400, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_6) != (0)) __PYX_ERR(0, 2400, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_r = ((PyObject*)__pyx_t_9);
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2399
 * 
 * cdef tuple reshape_burst_arrays(burst_array, str name):
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
 *     cdef bint single = False
*/
  }

  /* "H2MM_C.pyx":2401
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
 *     cdef bint single = False             # <<<<<<<<<<<<<<
 *     if isinstance(burst_array, cnp.ndarray):
 *         if burst_array.dtype != np.object_:
*/
  __pyx_v_single = 0;

  /* "H2MM_C.pyx":2402
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
 *     cdef bint single = False
 *     if isinstance(burst_array, cnp.ndarray):             # <<<<<<<<<<<<<<
 *         if burst_array.dtype != np.object_:
 *             single = True
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_burst_array, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2403
 *     cdef bint single = False
 *     if isinstance(burst_array, cnp.ndarray):
 *         if burst_array.dtype != np.object_:             # <<<<<<<<<<<<<<
 *             single = True
 *             burst_array = (burst_array, )
*/
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_burst_array, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2403, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":2404
 *     if isinstance(burst_array, cnp.ndarray):
 *         if burst_array.dtype != np.object_:
 *             single = True             # <<<<<<<<<<<<<<
 *             burst_array = (burst_array, )
 *             shape = (1, )
*/
      __pyx_v_single = 1;

      /* "H2MM_C.pyx":2405
 *         if burst_array.dtype != np.object_:
 *             single = True
 *             burst_array = (burst_array, )             # <<<<<<<<<<<<<<
 *             shape = (1, )
 *         else:
*/
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2405, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_burst_array);
      __Pyx_GIVEREF(__pyx_v_burst_array);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_burst_array) != (0)) __PYX_ERR(0, 2405, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_burst_array, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "H2MM_C.pyx":2406
 *             single = True
 *             burst_array = (burst_array, )
 *             shape = (1, )             # <<<<<<<<<<<<<<
 *         else:
 *             shape = burst_array.shape
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[12]);
      __pyx_v_shape = __pyx_mstate_global->__pyx_tuple[12];

      /* "H2MM_C.pyx":2403
 *     cdef bint single = False
 *     if isinstance(burst_array, cnp.ndarray):
 *         if burst_array.dtype != np.object_:             # <<<<<<<<<<<<<<
 *             single = True
 *             burst_array = (burst_array, )
*/
      goto __pyx_L7;
    }

    /* "H2MM_C.pyx":2408
 *             shape = (1, )
 *         else:
 *             shape = burst_array.shape             # <<<<<<<<<<<<<<
 *             burst_array = burst_array.reshape(-1)
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):
*/
    /*else*/ {
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_burst_array, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2408, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_shape = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "H2MM_C.pyx":2409
 *         else:
 *             shape = burst_array.shape
 *             burst_array = burst_array.reshape(-1)             # <<<<<<<<<<<<<<
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):
 *         single = True
*/
      __pyx_t_4 = __pyx_v_burst_array;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_neg_1};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_DECREF_SET(__pyx_v_burst_array, __pyx_t_6);
      __pyx_t_6 = 0;
    }
    __pyx_L7:;

    /* "H2MM_C.pyx":2402
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
 *     cdef bint single = False
 *     if isinstance(burst_array, cnp.ndarray):             # <<<<<<<<<<<<<<
 *         if burst_array.dtype != np.object_:
 *             single = True
*/
    goto __pyx_L6;
  }

  /* "H2MM_C.pyx":2410
 *             shape = burst_array.shape
 *             burst_array = burst_array.reshape(-1)
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         single = True
 *         burst_array = (burst_array, )
*/
  __pyx_t_10 = PyObject_Length(__pyx_v_burst_array); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2410, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_10 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_burst_array, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_TypeCheck(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (!__pyx_t_11) {
  } else {
    __pyx_t_2 = __pyx_t_11;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_11 = PyObject_IsInstance(__pyx_t_6, __pyx_t_4); 
  __pyx_t_2 = __pyx_t_11;
  __pyx_L10_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_11 = (!__pyx_t_2);
  __pyx_t_3 = __pyx_t_11;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":2411
 *             burst_array = burst_array.reshape(-1)
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):
 *         single = True             # <<<<<<<<<<<<<<
 *         burst_array = (burst_array, )
 *         shape = (1, )
*/
    __pyx_v_single = 1;

    /* "H2MM_C.pyx":2412
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):
 *         single = True
 *         burst_array = (burst_array, )             # <<<<<<<<<<<<<<
 *         shape = (1, )
 *     else:
*/
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_burst_array);
    __Pyx_GIVEREF(__pyx_v_burst_array);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_burst_array) != (0)) __PYX_ERR(0, 2412, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_burst_array, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":2413
 *         single = True
 *         burst_array = (burst_array, )
 *         shape = (1, )             # <<<<<<<<<<<<<<
 *     else:
 *         shape = (len(burst_array), )
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[12]);
    __pyx_v_shape = __pyx_mstate_global->__pyx_tuple[12];

    /* "H2MM_C.pyx":2410
 *             shape = burst_array.shape
 *             burst_array = burst_array.reshape(-1)
 *     elif len(burst_array) != 0 and not isinstance(burst_array[0], (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         single = True
 *         burst_array = (burst_array, )
*/
    goto __pyx_L6;
  }

  /* "H2MM_C.pyx":2415
 *         shape = (1, )
 *     else:
 *         shape = (len(burst_array), )             # <<<<<<<<<<<<<<
 *     return burst_array, shape, single, False, False
 * 
*/
  /*else*/ {
    __pyx_t_10 = PyObject_Length(__pyx_v_burst_array); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2415, __pyx_L1_error)
    __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 2415, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_v_shape = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L6:;

  /* "H2MM_C.pyx":2416
 *     else:
 *         shape = (len(burst_array), )
 *     return burst_array, shape, single, False, False             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_single); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_burst_array);
  __Pyx_GIVEREF(__pyx_v_burst_array);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_burst_array) != (0)) __PYX_ERR(0, 2416, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_shape);
  __Pyx_GIVEREF(__pyx_v_shape);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_shape) != (0)) __PYX_ERR(0, 2416, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 2416, __pyx_L1_error);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, Py_False) != (0)) __PYX_ERR(0, 2416, __pyx_L1_error);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, Py_False) != (0)) __PYX_ERR(0, 2416, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2398
 *     return 0
 * 
 * cdef tuple reshape_burst_arrays(burst_array, str name):             # <<<<<<<<<<<<<<
 *     if not isinstance(burst_array, (cnp.ndarray, Sequence)):
 *         return tuple(), tuple(), False, True, TypeError(f"{name} must be readable as sequence or numpy array of 1D arrays")
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("H2MM_C.reshape_burst_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_burst_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2419
 * 
 * 
 * cdef object cast_burst_uint8(bursts, str name, int64_t *nbursts, int64_t **len_bursts, uint8_t ***dout):             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     cdef bint err = False
*/

static PyObject *__pyx_f_6H2MM_C_cast_burst_uint8(PyObject *__pyx_v_bursts, PyObject *__pyx_v_name, int64_t *__pyx_v_nbursts, int64_t **__pyx_v_len_bursts, uint8_t ***__pyx_v_dout) {
  int64_t __pyx_v_i;
  int __pyx_v_err;
  PyObject *__pyx_v_e = NULL;
  PyArrayObject *__pyx_v_out = 0;
  int __pyx_v_firstarray;
  PyObject *__pyx_v_otemp = 0;
  PyArrayObject *__pyx_v_temp = 0;
  uint8_t **__pyx_v_data;
  int64_t *__pyx_v_lbursts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __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[7];
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int64_t *__pyx_t_18;
  int64_t __pyx_t_19;
  int64_t __pyx_t_20;
  int64_t __pyx_t_21;
  PyObject *__pyx_t_22[5];
  PyObject *__pyx_t_23[6];
  PyObject *__pyx_t_24[8];
  PyObject *__pyx_t_25 = NULL;
  Py_ssize_t __pyx_t_26;
  PyObject **__pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_burst_uint8", 0);
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;

  /* "H2MM_C.pyx":2421
 * cdef object cast_burst_uint8(bursts, str name, int64_t *nbursts, int64_t **len_bursts, uint8_t ***dout):
 *     cdef int64_t i
 *     cdef bint err = False             # <<<<<<<<<<<<<<
 *     e = None
 *     #### check lens are consistent ####
*/
  __pyx_v_err = 0;

  /* "H2MM_C.pyx":2422
 *     cdef int64_t i
 *     cdef bint err = False
 *     e = None             # <<<<<<<<<<<<<<
 *     #### check lens are consistent ####
 *     if nbursts[0] == 0:
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_e = ((PyObject*)Py_None);

  /* "H2MM_C.pyx":2424
 *     e = None
 *     #### check lens are consistent ####
 *     if nbursts[0] == 0:             # <<<<<<<<<<<<<<
 *         nbursts[0] = len(bursts)
 *     elif nbursts[0] != len(bursts):
*/
  __pyx_t_1 = ((__pyx_v_nbursts[0]) == 0);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2425
 *     #### check lens are consistent ####
 *     if nbursts[0] == 0:
 *         nbursts[0] = len(bursts)             # <<<<<<<<<<<<<<
 *     elif nbursts[0] != len(bursts):
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
*/
    __pyx_t_2 = PyObject_Length(__pyx_v_bursts); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2425, __pyx_L1_error)
    (__pyx_v_nbursts[0]) = __pyx_t_2;

    /* "H2MM_C.pyx":2424
 *     e = None
 *     #### check lens are consistent ####
 *     if nbursts[0] == 0:             # <<<<<<<<<<<<<<
 *         nbursts[0] = len(bursts)
 *     elif nbursts[0] != len(bursts):
*/
    goto __pyx_L3;
  }

  /* "H2MM_C.pyx":2426
 *     if nbursts[0] == 0:
 *         nbursts[0] = len(bursts)
 *     elif nbursts[0] != len(bursts):             # <<<<<<<<<<<<<<
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
 *     cdef cnp.ndarray[object, ndim=1] out
*/
  __pyx_t_2 = PyObject_Length(__pyx_v_bursts); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2426, __pyx_L1_error)
  __pyx_t_1 = ((__pyx_v_nbursts[0]) != __pyx_t_2);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2427
 *         nbursts[0] = len(bursts)
 *     elif nbursts[0] != len(bursts):
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] out
 *     try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Length(__pyx_v_bursts); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2427, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_2, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyUnicode_From_int64_t((__pyx_v_nbursts[0]), 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_nubmer_of_bursts_in;
    __pyx_t_8[1] = __pyx_t_5;
    __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__22;
    __pyx_t_8[3] = __pyx_t_6;
    __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_different_from_others_specified;
    __pyx_t_8[5] = __pyx_t_7;
    __pyx_t_8[6] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 7, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 34 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5));
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __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_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2426
 *     if nbursts[0] == 0:
 *         nbursts[0] = len(bursts)
 *     elif nbursts[0] != len(bursts):             # <<<<<<<<<<<<<<
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
 *     cdef cnp.ndarray[object, ndim=1] out
*/
  }
  __pyx_L3:;

  /* "H2MM_C.pyx":2429
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
 *     cdef cnp.ndarray[object, ndim=1] out
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    /*try:*/ {

      /* "H2MM_C.pyx":2430
 *     cdef cnp.ndarray[object, ndim=1] out
 *     try:
 *         out = np.empty(nbursts[0], dtype=np.object_)             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         err = True
*/
      __pyx_t_9 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2430, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2430, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyLong_From_int64_t((__pyx_v_nbursts[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2430, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2430, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2430, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_10 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_9);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_10 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_9, __pyx_t_4};
        __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2430, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2430, __pyx_L4_error)
        __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2430, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2430, __pyx_L4_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_14 < 0)) {
          PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
          }
          __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
        }
        __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 2430, __pyx_L4_error)
      }
      __pyx_v_out = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "H2MM_C.pyx":2429
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
 *     cdef cnp.ndarray[object, ndim=1] out
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:
*/
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __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_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2431
 *     try:
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("H2MM_C.cast_burst_uint8", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(0, 2431, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_7);
      /*try:*/ {

        /* "H2MM_C.pyx":2432
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:
 *         err = True             # <<<<<<<<<<<<<<
 *     if err:
 *         return e
*/
        __pyx_v_err = 1;
      }

      /* "H2MM_C.pyx":2431
 *     try:
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;

    /* "H2MM_C.pyx":2429
 *         return ValueError(f"nubmer of bursts in {name} ({len(bursts)} different from others specified ({nbursts[0]})")
 *     cdef cnp.ndarray[object, ndim=1] out
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts[0], dtype=np.object_)
 *     except Exception as e:
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    __pyx_L9_try_end:;
  }

  /* "H2MM_C.pyx":2433
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return e
 *     cdef bint firstarray = len_bursts[0] is NULL
*/
  if (__pyx_v_err) {

    /* "H2MM_C.pyx":2434
 *         err = True
 *     if err:
 *         return e             # <<<<<<<<<<<<<<
 *     cdef bint firstarray = len_bursts[0] is NULL
 *     cdef object otemp
*/
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(!__pyx_v_e)) { __Pyx_RaiseUnboundLocalError("e"); __PYX_ERR(0, 2434, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_v_e);
    __pyx_r = __pyx_v_e;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2433
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return e
 *     cdef bint firstarray = len_bursts[0] is NULL
*/
  }

  /* "H2MM_C.pyx":2435
 *     if err:
 *         return e
 *     cdef bint firstarray = len_bursts[0] is NULL             # <<<<<<<<<<<<<<
 *     cdef object otemp
 *     cdef cnp.ndarray[uint8_t] temp
*/
  __pyx_v_firstarray = ((__pyx_v_len_bursts[0]) == NULL);

  /* "H2MM_C.pyx":2438
 *     cdef object otemp
 *     cdef cnp.ndarray[uint8_t] temp
 *     cdef uint8_t **data = <uint8_t**> PyMem_Malloc(nbursts[0]*sizeof(uint8_t*))             # <<<<<<<<<<<<<<
 *     cdef int64_t *lbursts = <int64_t*> PyMem_Malloc(nbursts[0]*sizeof(int64_t)) if firstarray else len_bursts[0]
 *     if lbursts is NULL:
*/
  __pyx_v_data = ((uint8_t **)PyMem_Malloc(((__pyx_v_nbursts[0]) * (sizeof(uint8_t *)))));

  /* "H2MM_C.pyx":2439
 *     cdef cnp.ndarray[uint8_t] temp
 *     cdef uint8_t **data = <uint8_t**> PyMem_Malloc(nbursts[0]*sizeof(uint8_t*))
 *     cdef int64_t *lbursts = <int64_t*> PyMem_Malloc(nbursts[0]*sizeof(int64_t)) if firstarray else len_bursts[0]             # <<<<<<<<<<<<<<
 *     if lbursts is NULL:
 *         return MemoryError("insufficient memory")
*/
  if (__pyx_v_firstarray) {
    __pyx_t_18 = ((int64_t *)PyMem_Malloc(((__pyx_v_nbursts[0]) * (sizeof(int64_t)))));
  } else {
    __pyx_t_18 = (__pyx_v_len_bursts[0]);
  }
  __pyx_v_lbursts = __pyx_t_18;

  /* "H2MM_C.pyx":2440
 *     cdef uint8_t **data = <uint8_t**> PyMem_Malloc(nbursts[0]*sizeof(uint8_t*))
 *     cdef int64_t *lbursts = <int64_t*> PyMem_Malloc(nbursts[0]*sizeof(int64_t)) if firstarray else len_bursts[0]
 *     if lbursts is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError("insufficient memory")
 *     if data is NULL:
*/
  __pyx_t_1 = (__pyx_v_lbursts == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2441
 *     cdef int64_t *lbursts = <int64_t*> PyMem_Malloc(nbursts[0]*sizeof(int64_t)) if firstarray else len_bursts[0]
 *     if lbursts is NULL:
 *         return MemoryError("insufficient memory")             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         if firstarray:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = NULL;
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_insufficient_memory};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2440
 *     cdef uint8_t **data = <uint8_t**> PyMem_Malloc(nbursts[0]*sizeof(uint8_t*))
 *     cdef int64_t *lbursts = <int64_t*> PyMem_Malloc(nbursts[0]*sizeof(int64_t)) if firstarray else len_bursts[0]
 *     if lbursts is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError("insufficient memory")
 *     if data is NULL:
*/
  }

  /* "H2MM_C.pyx":2442
 *     if lbursts is NULL:
 *         return MemoryError("insufficient memory")
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         if firstarray:
 *             PyMem_Free(lbursts)
*/
  __pyx_t_1 = (__pyx_v_data == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":2443
 *         return MemoryError("insufficient memory")
 *     if data is NULL:
 *         if firstarray:             # <<<<<<<<<<<<<<
 *             PyMem_Free(lbursts)
 *             lbursts = NULL
*/
    if (__pyx_v_firstarray) {

      /* "H2MM_C.pyx":2444
 *     if data is NULL:
 *         if firstarray:
 *             PyMem_Free(lbursts)             # <<<<<<<<<<<<<<
 *             lbursts = NULL
 *         return MemoryError("insufficient memory")
*/
      PyMem_Free(__pyx_v_lbursts);

      /* "H2MM_C.pyx":2445
 *         if firstarray:
 *             PyMem_Free(lbursts)
 *             lbursts = NULL             # <<<<<<<<<<<<<<
 *         return MemoryError("insufficient memory")
 *     for i in range(nbursts[0]):
*/
      __pyx_v_lbursts = NULL;

      /* "H2MM_C.pyx":2443
 *         return MemoryError("insufficient memory")
 *     if data is NULL:
 *         if firstarray:             # <<<<<<<<<<<<<<
 *             PyMem_Free(lbursts)
 *             lbursts = NULL
*/
    }

    /* "H2MM_C.pyx":2446
 *             PyMem_Free(lbursts)
 *             lbursts = NULL
 *         return MemoryError("insufficient memory")             # <<<<<<<<<<<<<<
 *     for i in range(nbursts[0]):
 *         try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = NULL;
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_insufficient_memory};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2442
 *     if lbursts is NULL:
 *         return MemoryError("insufficient memory")
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         if firstarray:
 *             PyMem_Free(lbursts)
*/
  }

  /* "H2MM_C.pyx":2447
 *             lbursts = NULL
 *         return MemoryError("insufficient memory")
 *     for i in range(nbursts[0]):             # <<<<<<<<<<<<<<
 *         try:
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)
*/
  __pyx_t_19 = (__pyx_v_nbursts[0]);
  __pyx_t_20 = __pyx_t_19;
  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
    __pyx_v_i = __pyx_t_21;

    /* "H2MM_C.pyx":2448
 *         return MemoryError("insufficient memory")
 *     for i in range(nbursts[0]):
 *         try:             # <<<<<<<<<<<<<<
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)
 *             temp = otemp
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "H2MM_C.pyx":2449
 *     for i in range(nbursts[0]):
 *         try:
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)             # <<<<<<<<<<<<<<
 *             temp = otemp
 *         except:
*/
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2449, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2449, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bursts, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2449, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2449, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2449, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_10 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_10 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_t_3};
          __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2449, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_9, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2449, __pyx_L23_error)
          __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2449, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_otemp, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "H2MM_C.pyx":2450
 *         try:
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)
 *             temp = otemp             # <<<<<<<<<<<<<<
 *         except:
 *             err = True
*/
        __pyx_t_6 = __pyx_v_otemp;
        __Pyx_INCREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2450, __pyx_L23_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
          __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_14 < 0)) {
            PyErr_Fetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
            }
            __pyx_t_17 = __pyx_t_16 = __pyx_t_15 = 0;
          }
          __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0];
          if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 2450, __pyx_L23_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_temp, ((PyArrayObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "H2MM_C.pyx":2448
 *         return MemoryError("insufficient memory")
 *     for i in range(nbursts[0]):
 *         try:             # <<<<<<<<<<<<<<
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)
 *             temp = otemp
*/
      }
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L30_try_end;
      __pyx_L23_error:;
      __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_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "H2MM_C.pyx":2451
 *             otemp = np.ascontiguousarray(bursts[i], dtype=np.uint8)
 *             temp = otemp
 *         except:             # <<<<<<<<<<<<<<
 *             err = True
 *         if err:
*/
      /*except:*/ {
        __Pyx_ErrRestore(0,0,0);

        /* "H2MM_C.pyx":2452
 *             temp = otemp
 *         except:
 *             err = True             # <<<<<<<<<<<<<<
 *         if err:
 *             if firstarray:
*/
        __pyx_v_err = 1;
        goto __pyx_L24_exception_handled;
      }
      __pyx_L24_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
      __pyx_L30_try_end:;
    }

    /* "H2MM_C.pyx":2453
 *         except:
 *             err = True
 *         if err:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    if (__pyx_v_err) {

      /* "H2MM_C.pyx":2454
 *             err = True
 *         if err:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      if (__pyx_v_firstarray) {

        /* "H2MM_C.pyx":2455
 *         if err:
 *             if firstarray:
 *                 PyMem_Free(lbursts)             # <<<<<<<<<<<<<<
 *                 lbursts = NULL
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
*/
        PyMem_Free(__pyx_v_lbursts);

        /* "H2MM_C.pyx":2456
 *             if firstarray:
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL             # <<<<<<<<<<<<<<
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
 *         if temp.ndim != 1:
*/
        __pyx_v_lbursts = NULL;

        /* "H2MM_C.pyx":2454
 *             err = True
 *         if err:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      }

      /* "H2MM_C.pyx":2457
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")             # <<<<<<<<<<<<<<
 *         if temp.ndim != 1:
 *             if firstarray:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = NULL;
      __pyx_t_4 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_22[0] = __pyx_mstate_global->__pyx_kp_u_burst;
      __pyx_t_22[1] = __pyx_t_4;
      __pyx_t_22[2] = __pyx_mstate_global->__pyx_kp_u_in;
      __pyx_t_22[3] = __pyx_t_9;
      __pyx_t_22[4] = __pyx_mstate_global->__pyx_kp_u_cannot_be_read_as_1D_uint8_nump;
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_22, 5, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 39, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2457, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2453
 *         except:
 *             err = True
 *         if err:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    }

    /* "H2MM_C.pyx":2458
 *                 lbursts = NULL
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
 *         if temp.ndim != 1:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    __pyx_t_1 = (__pyx_f_5numpy_7ndarray_4ndim_ndim(((PyArrayObject *)__pyx_v_temp)) != 1);
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":2459
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
 *         if temp.ndim != 1:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      if (__pyx_v_firstarray) {

        /* "H2MM_C.pyx":2460
 *         if temp.ndim != 1:
 *             if firstarray:
 *                 PyMem_Free(lbursts)             # <<<<<<<<<<<<<<
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")
*/
        PyMem_Free(__pyx_v_lbursts);

        /* "H2MM_C.pyx":2461
 *             if firstarray:
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL             # <<<<<<<<<<<<<<
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")
 *         if firstarray:
*/
        __pyx_v_lbursts = NULL;

        /* "H2MM_C.pyx":2459
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
 *         if temp.ndim != 1:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      }

      /* "H2MM_C.pyx":2462
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")             # <<<<<<<<<<<<<<
 *         if firstarray:
 *             lbursts[i] = <int64_t> temp.shape[0]
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = NULL;
      __pyx_t_5 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_f_5numpy_7ndarray_4ndim_ndim(((PyArrayObject *)__pyx_v_temp)), 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_burst;
      __pyx_t_8[1] = __pyx_t_5;
      __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_in;
      __pyx_t_8[3] = __pyx_t_9;
      __pyx_t_8[4] = __pyx_mstate_global->__pyx_kp_u_is;
      __pyx_t_8[5] = __pyx_t_4;
      __pyx_t_8[6] = __pyx_mstate_global->__pyx_kp_u_D_must_be_1D_uint8_array;
      __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_8, 7, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 4 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 25, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2462, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2458
 *                 lbursts = NULL
 *             return TypeError(f"burst {i} in {name} cannot be read as 1D uint8 numpy array")
 *         if temp.ndim != 1:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    }

    /* "H2MM_C.pyx":2463
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")
 *         if firstarray:             # <<<<<<<<<<<<<<
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:
*/
    if (__pyx_v_firstarray) {

      /* "H2MM_C.pyx":2464
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")
 *         if firstarray:
 *             lbursts[i] = <int64_t> temp.shape[0]             # <<<<<<<<<<<<<<
 *             if lbursts[i] < 2:
 *                 if firstarray:
*/
      (__pyx_v_lbursts[__pyx_v_i]) = ((int64_t)(__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]));

      /* "H2MM_C.pyx":2465
 *         if firstarray:
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:             # <<<<<<<<<<<<<<
 *                 if firstarray:
 *                     PyMem_Free(lbursts)
*/
      __pyx_t_1 = ((__pyx_v_lbursts[__pyx_v_i]) < 2);
      if (__pyx_t_1) {

        /* "H2MM_C.pyx":2466
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:
 *                 if firstarray:             # <<<<<<<<<<<<<<
 *                     PyMem_Free(lbursts)
 *                     lbursts = NULL
*/
        if (__pyx_v_firstarray) {

          /* "H2MM_C.pyx":2467
 *             if lbursts[i] < 2:
 *                 if firstarray:
 *                     PyMem_Free(lbursts)             # <<<<<<<<<<<<<<
 *                     lbursts = NULL
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
*/
          PyMem_Free(__pyx_v_lbursts);

          /* "H2MM_C.pyx":2468
 *                 if firstarray:
 *                     PyMem_Free(lbursts)
 *                     lbursts = NULL             # <<<<<<<<<<<<<<
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
 *         elif lbursts[i] != temp.shape[0]:
*/
          __pyx_v_lbursts = NULL;

          /* "H2MM_C.pyx":2466
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:
 *                 if firstarray:             # <<<<<<<<<<<<<<
 *                     PyMem_Free(lbursts)
 *                     lbursts = NULL
*/
        }

        /* "H2MM_C.pyx":2469
 *                     PyMem_Free(lbursts)
 *                     lbursts = NULL
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")             # <<<<<<<<<<<<<<
 *         elif lbursts[i] != temp.shape[0]:
 *             if firstarray:
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = NULL;
        __pyx_t_3 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyUnicode_From_npy_intp((__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]), 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_23[0] = __pyx_mstate_global->__pyx_kp_u_burst;
        __pyx_t_23[1] = __pyx_t_3;
        __pyx_t_23[2] = __pyx_mstate_global->__pyx_kp_u_in;
        __pyx_t_23[3] = __pyx_t_4;
        __pyx_t_23[4] = __pyx_mstate_global->__pyx_kp_u_is_too_short_must_have_at_least;
        __pyx_t_23[5] = __pyx_t_9;
        __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_23, 6, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 49 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4));
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2469, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
          __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2469, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;

        /* "H2MM_C.pyx":2465
 *         if firstarray:
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:             # <<<<<<<<<<<<<<
 *                 if firstarray:
 *                     PyMem_Free(lbursts)
*/
      }

      /* "H2MM_C.pyx":2463
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} is {temp.ndim}D, must be 1D uint8 array")
 *         if firstarray:             # <<<<<<<<<<<<<<
 *             lbursts[i] = <int64_t> temp.shape[0]
 *             if lbursts[i] < 2:
*/
      goto __pyx_L37;
    }

    /* "H2MM_C.pyx":2470
 *                     lbursts = NULL
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
 *         elif lbursts[i] != temp.shape[0]:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    __pyx_t_1 = ((__pyx_v_lbursts[__pyx_v_i]) != (__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]));
    if (__pyx_t_1) {

      /* "H2MM_C.pyx":2471
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
 *         elif lbursts[i] != temp.shape[0]:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      if (__pyx_v_firstarray) {

        /* "H2MM_C.pyx":2472
 *         elif lbursts[i] != temp.shape[0]:
 *             if firstarray:
 *                 PyMem_Free(lbursts)             # <<<<<<<<<<<<<<
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} has different size from other specified ({temp.shape[0]} vs {lbursts[i]}")
*/
        PyMem_Free(__pyx_v_lbursts);

        /* "H2MM_C.pyx":2473
 *             if firstarray:
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL             # <<<<<<<<<<<<<<
 *             return ValueError(f"burst {i} in {name} has different size from other specified ({temp.shape[0]} vs {lbursts[i]}")
 *         out[i] = otemp
*/
        __pyx_v_lbursts = NULL;

        /* "H2MM_C.pyx":2471
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
 *         elif lbursts[i] != temp.shape[0]:
 *             if firstarray:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
*/
      }

      /* "H2MM_C.pyx":2474
 *                 PyMem_Free(lbursts)
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} has different size from other specified ({temp.shape[0]} vs {lbursts[i]}")             # <<<<<<<<<<<<<<
 *         out[i] = otemp
 *         data[i] = <uint8_t*> temp.data
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = NULL;
      __pyx_t_7 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_v_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyUnicode_From_npy_intp((__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]), 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyUnicode_From_int64_t((__pyx_v_lbursts[__pyx_v_i]), 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_24[0] = __pyx_mstate_global->__pyx_kp_u_burst;
      __pyx_t_24[1] = __pyx_t_7;
      __pyx_t_24[2] = __pyx_mstate_global->__pyx_kp_u_in;
      __pyx_t_24[3] = __pyx_t_9;
      __pyx_t_24[4] = __pyx_mstate_global->__pyx_kp_u_has_different_size_from_other_s;
      __pyx_t_24[5] = __pyx_t_4;
      __pyx_t_24[6] = __pyx_mstate_global->__pyx_kp_u_vs;
      __pyx_t_24[7] = __pyx_t_3;
      __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_24, 8, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 4 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 42 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9));
      if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_25};
        __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2474, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2470
 *                     lbursts = NULL
 *                 return ValueError(f"burst {i} in {name} is too short, must have at least 2 photons, got {temp.shape[0]}")
 *         elif lbursts[i] != temp.shape[0]:             # <<<<<<<<<<<<<<
 *             if firstarray:
 *                 PyMem_Free(lbursts)
*/
    }
    __pyx_L37:;

    /* "H2MM_C.pyx":2475
 *                 lbursts = NULL
 *             return ValueError(f"burst {i} in {name} has different size from other specified ({temp.shape[0]} vs {lbursts[i]}")
 *         out[i] = otemp             # <<<<<<<<<<<<<<
 *         data[i] = <uint8_t*> temp.data
 *     if firstarray:
*/
    if (unlikely(!__pyx_v_otemp)) { __Pyx_RaiseUnboundLocalError("otemp"); __PYX_ERR(0, 2475, __pyx_L1_error) }
    __pyx_t_26 = __pyx_v_i;
    __pyx_t_14 = -1;
    if (__pyx_t_26 < 0) {
      __pyx_t_26 += __pyx_pybuffernd_out.diminfo[0].shape;
      if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
    } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_14 = 0;
    if (unlikely(__pyx_t_14 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_14);
      __PYX_ERR(0, 2475, __pyx_L1_error)
    }
    __pyx_t_27 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_out.diminfo[0].strides);
    __Pyx_XGOTREF(*__pyx_t_27);
    __Pyx_INCREF(__pyx_v_otemp); __Pyx_XDECREF(*__pyx_t_27);
    *__pyx_t_27 = __pyx_v_otemp;
    __Pyx_XGIVEREF(*__pyx_t_27);

    /* "H2MM_C.pyx":2476
 *             return ValueError(f"burst {i} in {name} has different size from other specified ({temp.shape[0]} vs {lbursts[i]}")
 *         out[i] = otemp
 *         data[i] = <uint8_t*> temp.data             # <<<<<<<<<<<<<<
 *     if firstarray:
 *         len_bursts[0] = lbursts
*/
    (__pyx_v_data[__pyx_v_i]) = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_temp)));
  }

  /* "H2MM_C.pyx":2477
 *         out[i] = otemp
 *         data[i] = <uint8_t*> temp.data
 *     if firstarray:             # <<<<<<<<<<<<<<
 *         len_bursts[0] = lbursts
 *     dout[0] = data
*/
  if (__pyx_v_firstarray) {

    /* "H2MM_C.pyx":2478
 *         data[i] = <uint8_t*> temp.data
 *     if firstarray:
 *         len_bursts[0] = lbursts             # <<<<<<<<<<<<<<
 *     dout[0] = data
 *     return out
*/
    (__pyx_v_len_bursts[0]) = __pyx_v_lbursts;

    /* "H2MM_C.pyx":2477
 *         out[i] = otemp
 *         data[i] = <uint8_t*> temp.data
 *     if firstarray:             # <<<<<<<<<<<<<<
 *         len_bursts[0] = lbursts
 *     dout[0] = data
*/
  }

  /* "H2MM_C.pyx":2479
 *     if firstarray:
 *         len_bursts[0] = lbursts
 *     dout[0] = data             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
  (__pyx_v_dout[0]) = __pyx_v_data;

  /* "H2MM_C.pyx":2480
 *         len_bursts[0] = lbursts
 *     dout[0] = data
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_out);
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "H2MM_C.pyx":2419
 * 
 * 
 * cdef object cast_burst_uint8(bursts, str name, int64_t *nbursts, int64_t **len_bursts, uint8_t ***dout):             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     cdef bint err = False
*/

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_25);
  { 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_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.cast_burst_uint8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_otemp);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2483
 * 
 * 
 * cdef object cast_bursts_deltas(bursts, int64_t nbursts, int64_t *lbursts, int32_t ***dout):             # <<<<<<<<<<<<<<
 *     ### check number of bursts is correct
 *     if len(bursts) != nbursts:
*/

static PyObject *__pyx_f_6H2MM_C_cast_bursts_deltas(PyObject *__pyx_v_bursts, int64_t __pyx_v_nbursts, int64_t *__pyx_v_lbursts, int32_t ***__pyx_v_dout) {
  int32_t **__pyx_v_data;
  PyArrayObject *__pyx_v_temp = 0;
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  int64_t __pyx_v_jj;
  int64_t __pyx_v_delta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __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[5];
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int64_t __pyx_t_10;
  int64_t __pyx_t_11;
  int64_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  PyObject *__pyx_t_19[3];
  PyObject *__pyx_t_20[7];
  int64_t __pyx_t_21;
  int64_t __pyx_t_22;
  int64_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_bursts_deltas", 0);
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;

  /* "H2MM_C.pyx":2485
 * cdef object cast_bursts_deltas(bursts, int64_t nbursts, int64_t *lbursts, int32_t ***dout):
 *     ### check number of bursts is correct
 *     if len(bursts) != nbursts:             # <<<<<<<<<<<<<<
 *         return ValueError(f"nubmer of bursts in times ({len(bursts)} different from others specified ({nbursts})")
 *     ### make out array ###
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_bursts); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2485, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != __pyx_v_nbursts);
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":2486
 *     ### check number of bursts is correct
 *     if len(bursts) != nbursts:
 *         return ValueError(f"nubmer of bursts in times ({len(bursts)} different from others specified ({nbursts})")             # <<<<<<<<<<<<<<
 *     ### make out array ###
 *     cdef int32_t **data = <int32_t**> PyMem_Malloc(nbursts*sizeof(int32_t*))
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_1 = PyObject_Length(__pyx_v_bursts); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2486, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_1, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyUnicode_From_int64_t(__pyx_v_nbursts, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_nubmer_of_bursts_in_times;
    __pyx_t_7[1] = __pyx_t_5;
    __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_different_from_others_specified;
    __pyx_t_7[3] = __pyx_t_6;
    __pyx_t_7[4] = __pyx_mstate_global->__pyx_kp_u__5;
    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 5, 27 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 34 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 1, 127);
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2485
 * cdef object cast_bursts_deltas(bursts, int64_t nbursts, int64_t *lbursts, int32_t ***dout):
 *     ### check number of bursts is correct
 *     if len(bursts) != nbursts:             # <<<<<<<<<<<<<<
 *         return ValueError(f"nubmer of bursts in times ({len(bursts)} different from others specified ({nbursts})")
 *     ### make out array ###
*/
  }

  /* "H2MM_C.pyx":2488
 *         return ValueError(f"nubmer of bursts in times ({len(bursts)} different from others specified ({nbursts})")
 *     ### make out array ###
 *     cdef int32_t **data = <int32_t**> PyMem_Malloc(nbursts*sizeof(int32_t*))             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         return MemoryError('insufficient memory for deltas')
*/
  __pyx_v_data = ((int32_t **)PyMem_Malloc((__pyx_v_nbursts * (sizeof(int32_t *)))));

  /* "H2MM_C.pyx":2489
 *     ### make out array ###
 *     cdef int32_t **data = <int32_t**> PyMem_Malloc(nbursts*sizeof(int32_t*))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError('insufficient memory for deltas')
 *     cdef cnp.ndarray[int64_t] temp
*/
  __pyx_t_2 = (__pyx_v_data == NULL);
  if (__pyx_t_2) {

    /* "H2MM_C.pyx":2490
 *     cdef int32_t **data = <int32_t**> PyMem_Malloc(nbursts*sizeof(int32_t*))
 *     if data is NULL:
 *         return MemoryError('insufficient memory for deltas')             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[int64_t] temp
 *     cdef int64_t i, j, jj, delta
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_deltas};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2489
 *     ### make out array ###
 *     cdef int32_t **data = <int32_t**> PyMem_Malloc(nbursts*sizeof(int32_t*))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError('insufficient memory for deltas')
 *     cdef cnp.ndarray[int64_t] temp
*/
  }

  /* "H2MM_C.pyx":2493
 *     cdef cnp.ndarray[int64_t] temp
 *     cdef int64_t i, j, jj, delta
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         temp = np.ascontiguousarray(bursts[i], dtype=np.int64)
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:
*/
  __pyx_t_10 = __pyx_v_nbursts;
  __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;

    /* "H2MM_C.pyx":2494
 *     cdef int64_t i, j, jj, delta
 *     for i in range(nbursts):
 *         temp = np.ascontiguousarray(bursts[i], dtype=np.int64)             # <<<<<<<<<<<<<<
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:
 *             free_deltas(i, data)
*/
    __pyx_t_8 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_bursts, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_8);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_9 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_t_4};
      __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_13, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2494, __pyx_L1_error)
      __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2494, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        }
        __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
      }
      __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 2494, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_temp, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":2495
 *     for i in range(nbursts):
 *         temp = np.ascontiguousarray(bursts[i], dtype=np.int64)
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:             # <<<<<<<<<<<<<<
 *             free_deltas(i, data)
 *             data = NULL
*/
    __pyx_t_18 = (__pyx_f_5numpy_7ndarray_4ndim_ndim(((PyArrayObject *)__pyx_v_temp)) != 1);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_2 = __pyx_t_18;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_18 = ((__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]) != (__pyx_v_lbursts[__pyx_v_i]));
    __pyx_t_2 = __pyx_t_18;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":2496
 *         temp = np.ascontiguousarray(bursts[i], dtype=np.int64)
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:
 *             free_deltas(i, data)             # <<<<<<<<<<<<<<
 *             data = NULL
 *             if temp.ndim != 1:
*/
      __pyx_t_14 = __pyx_f_6H2MM_C_free_deltas(__pyx_v_i, __pyx_v_data); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2496, __pyx_L1_error)

      /* "H2MM_C.pyx":2497
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:
 *             free_deltas(i, data)
 *             data = NULL             # <<<<<<<<<<<<<<
 *             if temp.ndim != 1:
 *                 return ValueError(f"burst {i} in time is not 1D")
*/
      __pyx_v_data = NULL;

      /* "H2MM_C.pyx":2498
 *             free_deltas(i, data)
 *             data = NULL
 *             if temp.ndim != 1:             # <<<<<<<<<<<<<<
 *                 return ValueError(f"burst {i} in time is not 1D")
 *             else:
*/
      __pyx_t_2 = (__pyx_f_5numpy_7ndarray_4ndim_ndim(((PyArrayObject *)__pyx_v_temp)) != 1);
      if (__pyx_t_2) {

        /* "H2MM_C.pyx":2499
 *             data = NULL
 *             if temp.ndim != 1:
 *                 return ValueError(f"burst {i} in time is not 1D")             # <<<<<<<<<<<<<<
 *             else:
 *                 return ValueError(f"burst {i} in times has different size from other bursts arrays ({temp.shape[0]}, vs {nbursts})")
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = NULL;
        __pyx_t_5 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u_burst;
        __pyx_t_19[1] = __pyx_t_5;
        __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u_in_time_is_not_1D;
        __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_19, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 18, 127);
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_13};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2499, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

        /* "H2MM_C.pyx":2498
 *             free_deltas(i, data)
 *             data = NULL
 *             if temp.ndim != 1:             # <<<<<<<<<<<<<<
 *                 return ValueError(f"burst {i} in time is not 1D")
 *             else:
*/
      }

      /* "H2MM_C.pyx":2501
 *                 return ValueError(f"burst {i} in time is not 1D")
 *             else:
 *                 return ValueError(f"burst {i} in times has different size from other bursts arrays ({temp.shape[0]}, vs {nbursts})")             # <<<<<<<<<<<<<<
 *         data[i] = <int32_t*> PyMem_Malloc(lbursts[i]*sizeof(int32_t))
 *         if data[i] is NULL:
*/
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_13 = NULL;
        __pyx_t_6 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyUnicode_From_npy_intp((__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_temp))[0]), 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyUnicode_From_int64_t(__pyx_v_nbursts, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_burst;
        __pyx_t_20[1] = __pyx_t_6;
        __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_in_times_has_different_size_fro;
        __pyx_t_20[3] = __pyx_t_5;
        __pyx_t_20[4] = __pyx_mstate_global->__pyx_kp_u_vs_2;
        __pyx_t_20[5] = __pyx_t_4;
        __pyx_t_20[6] = __pyx_mstate_global->__pyx_kp_u__5;
        __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_20, 7, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 55 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127);
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2501, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __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_9 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_8};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2501, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;
      }

      /* "H2MM_C.pyx":2495
 *     for i in range(nbursts):
 *         temp = np.ascontiguousarray(bursts[i], dtype=np.int64)
 *         if temp.ndim != 1 or temp.shape[0] != lbursts[i]:             # <<<<<<<<<<<<<<
 *             free_deltas(i, data)
 *             data = NULL
*/
    }

    /* "H2MM_C.pyx":2502
 *             else:
 *                 return ValueError(f"burst {i} in times has different size from other bursts arrays ({temp.shape[0]}, vs {nbursts})")
 *         data[i] = <int32_t*> PyMem_Malloc(lbursts[i]*sizeof(int32_t))             # <<<<<<<<<<<<<<
 *         if data[i] is NULL:
 *             free_deltas(i, data)
*/
    (__pyx_v_data[__pyx_v_i]) = ((int32_t *)PyMem_Malloc(((__pyx_v_lbursts[__pyx_v_i]) * (sizeof(int32_t)))));

    /* "H2MM_C.pyx":2503
 *                 return ValueError(f"burst {i} in times has different size from other bursts arrays ({temp.shape[0]}, vs {nbursts})")
 *         data[i] = <int32_t*> PyMem_Malloc(lbursts[i]*sizeof(int32_t))
 *         if data[i] is NULL:             # <<<<<<<<<<<<<<
 *             free_deltas(i, data)
 *             data = NULL
*/
    __pyx_t_2 = ((__pyx_v_data[__pyx_v_i]) == NULL);
    if (__pyx_t_2) {

      /* "H2MM_C.pyx":2504
 *         data[i] = <int32_t*> PyMem_Malloc(lbursts[i]*sizeof(int32_t))
 *         if data[i] is NULL:
 *             free_deltas(i, data)             # <<<<<<<<<<<<<<
 *             data = NULL
 *             return MemoryError("insufficient memory for time deltas")
*/
      __pyx_t_14 = __pyx_f_6H2MM_C_free_deltas(__pyx_v_i, __pyx_v_data); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2504, __pyx_L1_error)

      /* "H2MM_C.pyx":2505
 *         if data[i] is NULL:
 *             free_deltas(i, data)
 *             data = NULL             # <<<<<<<<<<<<<<
 *             return MemoryError("insufficient memory for time deltas")
 *         data[i][0] = 0
*/
      __pyx_v_data = NULL;

      /* "H2MM_C.pyx":2506
 *             free_deltas(i, data)
 *             data = NULL
 *             return MemoryError("insufficient memory for time deltas")             # <<<<<<<<<<<<<<
 *         data[i][0] = 0
 *         jj = 0
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = NULL;
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_time_del};
        __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":2503
 *                 return ValueError(f"burst {i} in times has different size from other bursts arrays ({temp.shape[0]}, vs {nbursts})")
 *         data[i] = <int32_t*> PyMem_Malloc(lbursts[i]*sizeof(int32_t))
 *         if data[i] is NULL:             # <<<<<<<<<<<<<<
 *             free_deltas(i, data)
 *             data = NULL
*/
    }

    /* "H2MM_C.pyx":2507
 *             data = NULL
 *             return MemoryError("insufficient memory for time deltas")
 *         data[i][0] = 0             # <<<<<<<<<<<<<<
 *         jj = 0
 *         for j in range(1, lbursts[i]):
*/
    ((__pyx_v_data[__pyx_v_i])[0]) = 0;

    /* "H2MM_C.pyx":2508
 *             return MemoryError("insufficient memory for time deltas")
 *         data[i][0] = 0
 *         jj = 0             # <<<<<<<<<<<<<<
 *         for j in range(1, lbursts[i]):
 *             delta = temp[j] - temp[jj]
*/
    __pyx_v_jj = 0;

    /* "H2MM_C.pyx":2509
 *         data[i][0] = 0
 *         jj = 0
 *         for j in range(1, lbursts[i]):             # <<<<<<<<<<<<<<
 *             delta = temp[j] - temp[jj]
 *             if delta < 0 or delta > INT32_MAX:
*/
    __pyx_t_21 = (__pyx_v_lbursts[__pyx_v_i]);
    __pyx_t_22 = __pyx_t_21;
    for (__pyx_t_23 = 1; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
      __pyx_v_j = __pyx_t_23;

      /* "H2MM_C.pyx":2510
 *         jj = 0
 *         for j in range(1, lbursts[i]):
 *             delta = temp[j] - temp[jj]             # <<<<<<<<<<<<<<
 *             if delta < 0 or delta > INT32_MAX:
 *                 free_deltas(i+1, data)
*/
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_14 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_pybuffernd_temp.diminfo[0].shape;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_temp.diminfo[0].shape)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        __PYX_ERR(0, 2510, __pyx_L1_error)
      }
      __pyx_t_25 = __pyx_v_jj;
      __pyx_t_14 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_temp.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_temp.diminfo[0].shape)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        __PYX_ERR(0, 2510, __pyx_L1_error)
      }
      __pyx_v_delta = ((*__Pyx_BufPtrStrided1d(int64_t *, __pyx_pybuffernd_temp.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_temp.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(int64_t *, __pyx_pybuffernd_temp.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_temp.diminfo[0].strides)));

      /* "H2MM_C.pyx":2511
 *         for j in range(1, lbursts[i]):
 *             delta = temp[j] - temp[jj]
 *             if delta < 0 or delta > INT32_MAX:             # <<<<<<<<<<<<<<
 *                 free_deltas(i+1, data)
 *                 data = NULL
*/
      __pyx_t_18 = (__pyx_v_delta < 0);
      if (!__pyx_t_18) {
      } else {
        __pyx_t_2 = __pyx_t_18;
        goto __pyx_L15_bool_binop_done;
      }
      __pyx_t_18 = (__pyx_v_delta > INT32_MAX);
      __pyx_t_2 = __pyx_t_18;
      __pyx_L15_bool_binop_done:;
      if (__pyx_t_2) {

        /* "H2MM_C.pyx":2512
 *             delta = temp[j] - temp[jj]
 *             if delta < 0 or delta > INT32_MAX:
 *                 free_deltas(i+1, data)             # <<<<<<<<<<<<<<
 *                 data = NULL
 *                 if delta < 0:
*/
        __pyx_t_14 = __pyx_f_6H2MM_C_free_deltas((__pyx_v_i + 1), __pyx_v_data); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2512, __pyx_L1_error)

        /* "H2MM_C.pyx":2513
 *             if delta < 0 or delta > INT32_MAX:
 *                 free_deltas(i+1, data)
 *                 data = NULL             # <<<<<<<<<<<<<<
 *                 if delta < 0:
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
*/
        __pyx_v_data = NULL;

        /* "H2MM_C.pyx":2514
 *                 free_deltas(i+1, data)
 *                 data = NULL
 *                 if delta < 0:             # <<<<<<<<<<<<<<
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
*/
        __pyx_t_2 = (__pyx_v_delta < 0);
        if (__pyx_t_2) {

          /* "H2MM_C.pyx":2515
 *                 data = NULL
 *                 if delta < 0:
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")             # <<<<<<<<<<<<<<
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
 *             if delta != 0:
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = NULL;
          __pyx_t_13 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_4 = __Pyx_PyUnicode_From_int64_t(__pyx_v_jj, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = __Pyx_PyUnicode_From_int64_t(__pyx_v_j, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_burst;
          __pyx_t_20[1] = __pyx_t_13;
          __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_photons_times;
          __pyx_t_20[3] = __pyx_t_4;
          __pyx_t_20[4] = __pyx_mstate_global->__pyx_kp_u_and;
          __pyx_t_20[5] = __pyx_t_5;
          __pyx_t_20[6] = __pyx_mstate_global->__pyx_kp_u_out_of_order;
          __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_20, 7, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 13, 127);
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_9 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6};
            __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2515, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
          }
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

          /* "H2MM_C.pyx":2514
 *                 free_deltas(i+1, data)
 *                 data = NULL
 *                 if delta < 0:             # <<<<<<<<<<<<<<
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
*/
        }

        /* "H2MM_C.pyx":2516
 *                 if delta < 0:
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")             # <<<<<<<<<<<<<<
 *             if delta != 0:
 *                 delta -= 1
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = NULL;
        __pyx_t_8 = __Pyx_PyUnicode_From_int64_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = __Pyx_PyUnicode_From_int64_t(__pyx_v_jj, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyUnicode_From_int64_t(__pyx_v_j, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_20[0] = __pyx_mstate_global->__pyx_kp_u_burst;
        __pyx_t_20[1] = __pyx_t_8;
        __pyx_t_20[2] = __pyx_mstate_global->__pyx_kp_u_photons_times;
        __pyx_t_20[3] = __pyx_t_5;
        __pyx_t_20[4] = __pyx_mstate_global->__pyx_kp_u_and;
        __pyx_t_20[5] = __pyx_t_4;
        __pyx_t_20[6] = __pyx_mstate_global->__pyx_kp_u_difference_is_too_large;
        __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_20, 7, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 24, 127);
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __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;
        __pyx_t_9 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_13};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2516, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

        /* "H2MM_C.pyx":2511
 *         for j in range(1, lbursts[i]):
 *             delta = temp[j] - temp[jj]
 *             if delta < 0 or delta > INT32_MAX:             # <<<<<<<<<<<<<<
 *                 free_deltas(i+1, data)
 *                 data = NULL
*/
      }

      /* "H2MM_C.pyx":2517
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
 *             if delta != 0:             # <<<<<<<<<<<<<<
 *                 delta -= 1
 *             data[i][j] = delta
*/
      __pyx_t_2 = (__pyx_v_delta != 0);
      if (__pyx_t_2) {

        /* "H2MM_C.pyx":2518
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
 *             if delta != 0:
 *                 delta -= 1             # <<<<<<<<<<<<<<
 *             data[i][j] = delta
 *             jj = j
*/
        __pyx_v_delta = (__pyx_v_delta - 1);

        /* "H2MM_C.pyx":2517
 *                     return ValueError(f"burst {i} photons times {jj} and {j} out of order")
 *                 return ValueError(f"burst {i} photons times {jj} and {j} difference is too large")
 *             if delta != 0:             # <<<<<<<<<<<<<<
 *                 delta -= 1
 *             data[i][j] = delta
*/
      }

      /* "H2MM_C.pyx":2519
 *             if delta != 0:
 *                 delta -= 1
 *             data[i][j] = delta             # <<<<<<<<<<<<<<
 *             jj = j
 *     dout[0] = data
*/
      ((__pyx_v_data[__pyx_v_i])[__pyx_v_j]) = __pyx_v_delta;

      /* "H2MM_C.pyx":2520
 *                 delta -= 1
 *             data[i][j] = delta
 *             jj = j             # <<<<<<<<<<<<<<
 *     dout[0] = data
 *     return None
*/
      __pyx_v_jj = __pyx_v_j;
    }
  }

  /* "H2MM_C.pyx":2521
 *             data[i][j] = delta
 *             jj = j
 *     dout[0] = data             # <<<<<<<<<<<<<<
 *     return None
 * 
*/
  (__pyx_v_dout[0]) = __pyx_v_data;

  /* "H2MM_C.pyx":2522
 *             jj = j
 *     dout[0] = data
 *     return None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "H2MM_C.pyx":2483
 * 
 * 
 * cdef object cast_bursts_deltas(bursts, int64_t nbursts, int64_t *lbursts, int32_t ***dout):             # <<<<<<<<<<<<<<
 *     ### check number of bursts is correct
 *     if len(bursts) != nbursts:
*/

  /* 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_XDECREF(__pyx_t_13);
  { 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_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.cast_bursts_deltas", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2525
 * 
 * 
 * cdef tuple cast_indexes_times(indexes, times, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas):             # <<<<<<<<<<<<<<
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
*/

static PyObject *__pyx_f_6H2MM_C_cast_indexes_times(PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, int *__pyx_v_single, int64_t *__pyx_v_nbursts, int64_t **__pyx_v_len_bursts, uint8_t ***__pyx_v_idxs, int32_t ***__pyx_v_deltas) {
  PyObject *__pyx_v_shape = NULL;
  PyObject *__pyx_v_sngl = NULL;
  PyObject *__pyx_v_haserr = NULL;
  PyObject *__pyx_v_err = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = 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;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_indexes_times", 0);
  __Pyx_INCREF(__pyx_v_indexes);
  __Pyx_INCREF(__pyx_v_times);

  /* "H2MM_C.pyx":2526
 * 
 * cdef tuple cast_indexes_times(indexes, times, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")             # <<<<<<<<<<<<<<
 *     if haserr:
 *         return tuple(), tuple(), err
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_reshape_burst_arrays(__pyx_v_indexes, __pyx_mstate_global->__pyx_n_u_indexes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2526, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
      for (i=0; i < 5; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2526, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2526, __pyx_L1_error)
  }
  __Pyx_DECREF_SET(__pyx_v_indexes, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_shape = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_sngl = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_haserr = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_err = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "H2MM_C.pyx":2527
 * cdef tuple cast_indexes_times(indexes, times, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_haserr); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2527, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2528
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
 *         return tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 2528, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 2528, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_err) != (0)) __PYX_ERR(0, 2528, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_6 = 0;
    __pyx_r = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2527
 * cdef tuple cast_indexes_times(indexes, times, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
*/
  }

  /* "H2MM_C.pyx":2529
 *     if haserr:
 *         return tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")             # <<<<<<<<<<<<<<
 *     if haserr:
 *         return tuple(), tuple(), err
*/
  __pyx_t_5 = __pyx_f_6H2MM_C_reshape_burst_arrays(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_times); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (likely(__pyx_t_5 != Py_None)) {
    PyObject* sequence = __pyx_t_5;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2529, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_2);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_6,&__pyx_t_1,&__pyx_t_4,&__pyx_t_3,&__pyx_t_2};
      for (i=0; i < 5; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2529, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2529, __pyx_L1_error)
  }
  __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v__ = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_haserr, __pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":2530
 *         return tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_haserr); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2530, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2531
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:
 *         return tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_3 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 2531, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 2531, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_err) != (0)) __PYX_ERR(0, 2531, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2530
 *         return tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
*/
  }

  /* "H2MM_C.pyx":2532
 *     if haserr:
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)             # <<<<<<<<<<<<<<
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), indexes
*/
  __pyx_t_3 = __pyx_f_6H2MM_C_cast_burst_uint8(__pyx_v_indexes, __pyx_mstate_global->__pyx_n_u_indexes, __pyx_v_nbursts, __pyx_v_len_bursts, __pyx_v_idxs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_indexes, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":2533
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), indexes
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
*/
  __pyx_t_7 = ((__pyx_v_idxs[0]) == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2534
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), indexes             # <<<<<<<<<<<<<<
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 2534, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 2534, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_indexes);
    __Pyx_GIVEREF(__pyx_v_indexes);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_indexes) != (0)) __PYX_ERR(0, 2534, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2533
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), indexes
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
*/
  }

  /* "H2MM_C.pyx":2535
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), indexes
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)             # <<<<<<<<<<<<<<
 *     if deltas[0] is NULL:
 *         PyMem_Free(idxs[0])
*/
  __pyx_t_5 = __pyx_f_6H2MM_C_cast_bursts_deltas(__pyx_v_times, (__pyx_v_nbursts[0]), (__pyx_v_len_bursts[0]), __pyx_v_deltas); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "H2MM_C.pyx":2536
 *         return tuple(), tuple(), indexes
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
*/
  __pyx_t_7 = ((__pyx_v_deltas[0]) == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2537
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:
 *         PyMem_Free(idxs[0])             # <<<<<<<<<<<<<<
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err
*/
    PyMem_Free((__pyx_v_idxs[0]));

    /* "H2MM_C.pyx":2538
 *     if deltas[0] is NULL:
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     single[0] = sngl
*/
    (__pyx_v_idxs[0]) = NULL;

    /* "H2MM_C.pyx":2539
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     single[0] = sngl
 *     return shape, indexes, None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_3 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 2539, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 2539, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_err) != (0)) __PYX_ERR(0, 2539, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2536
 *         return tuple(), tuple(), indexes
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
*/
  }

  /* "H2MM_C.pyx":2540
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err
 *     single[0] = sngl             # <<<<<<<<<<<<<<
 *     return shape, indexes, None
 * 
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_sngl); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2540, __pyx_L1_error)
  (__pyx_v_single[0]) = __pyx_t_7;

  /* "H2MM_C.pyx":2541
 *         return tuple(), tuple(), err
 *     single[0] = sngl
 *     return shape, indexes, None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_shape);
  __Pyx_GIVEREF(__pyx_v_shape);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shape) != (0)) __PYX_ERR(0, 2541, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_indexes);
  __Pyx_GIVEREF(__pyx_v_indexes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_indexes) != (0)) __PYX_ERR(0, 2541, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(0, 2541, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2525
 * 
 * 
 * cdef tuple cast_indexes_times(indexes, times, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas):             # <<<<<<<<<<<<<<
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
*/

  /* 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("H2MM_C.cast_indexes_times", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_sngl);
  __Pyx_XDECREF(__pyx_v_haserr);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_indexes);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2544
 * 
 * 
 * cdef cnp.ndarray[object, ndim=1] make_gamma_arrays(int64_t nbursts, int64_t nstate, int64_t *burst_sizes, double ***gamma):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] out
 *     cdef bint err = False
*/

static PyArrayObject *__pyx_f_6H2MM_C_make_gamma_arrays(int64_t __pyx_v_nbursts, int64_t __pyx_v_nstate, int64_t *__pyx_v_burst_sizes, double ***__pyx_v_gamma) {
  PyArrayObject *__pyx_v_out = 0;
  int __pyx_v_err;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_obtemp = 0;
  PyArrayObject *__pyx_v_temp = 0;
  int64_t __pyx_v_i;
  double **__pyx_v_data;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int64_t __pyx_t_16;
  int64_t __pyx_t_17;
  int64_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  PyObject **__pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_gamma_arrays", 0);
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;

  /* "H2MM_C.pyx":2546
 * cdef cnp.ndarray[object, ndim=1] make_gamma_arrays(int64_t nbursts, int64_t nstate, int64_t *burst_sizes, double ***gamma):
 *     cdef cnp.ndarray[object, ndim=1] out
 *     cdef bint err = False             # <<<<<<<<<<<<<<
 *     e = None
 *     try:
*/
  __pyx_v_err = 0;

  /* "H2MM_C.pyx":2547
 *     cdef cnp.ndarray[object, ndim=1] out
 *     cdef bint err = False
 *     e = None             # <<<<<<<<<<<<<<
 *     try:
 *         out = np.empty(nbursts, dtype=np.object_)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_e = ((PyObject*)Py_None);

  /* "H2MM_C.pyx":2548
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2549
 *     e = None
 *     try:
 *         out = np.empty(nbursts, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         err = True
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2549, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_10 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_10 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_6};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2549, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_9, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2549, __pyx_L3_error)
        __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __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 (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2549, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2549, __pyx_L3_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 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_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2549, __pyx_L3_error)
      }
      __pyx_v_out = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":2548
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:
*/
    }
    __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:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2550
 *     try:
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("H2MM_C.make_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 2550, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_7);
      /*try:*/ {

        /* "H2MM_C.pyx":2551
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:
 *         err = True             # <<<<<<<<<<<<<<
 *     if err:
 *         return np.empty(0, dtype=np.object_)
*/
        __pyx_v_err = 1;
      }

      /* "H2MM_C.pyx":2550
 *     try:
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "H2MM_C.pyx":2548
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty(nbursts, dtype=np.object_)
 *     except Exception as e:
*/
    __pyx_L5_except_error:;
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "H2MM_C.pyx":2552
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return np.empty(0, dtype=np.object_)
 *     cdef object obtemp
*/
  if (__pyx_v_err) {

    /* "H2MM_C.pyx":2553
 *         err = True
 *     if err:
 *         return np.empty(0, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     cdef object obtemp
 *     cdef cnp.ndarray[double, ndim=2] temp
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
      __pyx_t_10 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_mstate_global->__pyx_int_0};
      __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2553, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2553, __pyx_L1_error)
      __pyx_t_8 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
      __Pyx_XDECREF(__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;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2553, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2553, __pyx_L1_error)
    __pyx_r = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2552
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return np.empty(0, dtype=np.object_)
 *     cdef object obtemp
*/
  }

  /* "H2MM_C.pyx":2557
 *     cdef cnp.ndarray[double, ndim=2] temp
 *     cdef int64_t i
 *     cdef double **data = <double**> PyMem_Malloc(nbursts*sizeof(double*))             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         return out, MemoryError("insufficient memory for gamma array")
*/
  __pyx_v_data = ((double **)PyMem_Malloc((__pyx_v_nbursts * (sizeof(double *)))));

  /* "H2MM_C.pyx":2558
 *     cdef int64_t i
 *     cdef double **data = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):
*/
  __pyx_t_15 = (__pyx_v_data == NULL);
  if (__pyx_t_15) {

    /* "H2MM_C.pyx":2559
 *     cdef double **data = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *     if data is NULL:
 *         return out, MemoryError("insufficient memory for gamma array")             # <<<<<<<<<<<<<<
 *     for i in range(nbursts):
 *         try:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_gamma_ar};
      __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF((PyObject *)__pyx_v_out);
    __Pyx_GIVEREF((PyObject *)__pyx_v_out);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out)) != (0)) __PYX_ERR(0, 2559, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_8);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 2559, __pyx_L1_error);
    __pyx_t_8 = 0;
    if (!(likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray)))) __PYX_ERR(0, 2559, __pyx_L1_error)
    __pyx_r = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":2558
 *     cdef int64_t i
 *     cdef double **data = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):
*/
  }

  /* "H2MM_C.pyx":2560
 *     if data is NULL:
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         try:
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
*/
  __pyx_t_16 = __pyx_v_nbursts;
  __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;

    /* "H2MM_C.pyx":2561
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      /*try:*/ {

        /* "H2MM_C.pyx":2562
 *     for i in range(nbursts):
 *         try:
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)             # <<<<<<<<<<<<<<
 *             temp = obtemp
 *         except Exception as e:
*/
        __pyx_t_8 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyLong_From_int64_t((__pyx_v_burst_sizes[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = __Pyx_PyLong_From_int64_t(__pyx_v_nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 2562, __pyx_L20_error);
        __Pyx_GIVEREF(__pyx_t_7);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 2562, __pyx_L20_error);
        __pyx_t_4 = 0;
        __pyx_t_7 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
          __pyx_t_10 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_t_5};
          __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2562, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_4, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2562, __pyx_L20_error)
          __pyx_t_9 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
          __Pyx_XDECREF(__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;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2562, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_XDECREF_SET(__pyx_v_obtemp, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "H2MM_C.pyx":2563
 *         try:
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             err = True
*/
        __pyx_t_9 = __pyx_v_obtemp;
        __Pyx_INCREF(__pyx_t_9);
        if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2563, __pyx_L20_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
          __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_11 < 0)) {
            PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
            }
            __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
          }
          __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_temp.diminfo[1].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_temp.diminfo[1].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[1];
          if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2563, __pyx_L20_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_temp, ((PyArrayObject *)__pyx_t_9));
        __pyx_t_9 = 0;

        /* "H2MM_C.pyx":2561
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L27_try_end;
      __pyx_L20_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "H2MM_C.pyx":2564
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             err = True
 *         if err:
*/
      __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
      if (__pyx_t_11) {
        __Pyx_AddTraceback("H2MM_C.make_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2564, __pyx_L22_except_error)
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_6);
        /*try:*/ {

          /* "H2MM_C.pyx":2565
 *             temp = obtemp
 *         except Exception as e:
 *             err = True             # <<<<<<<<<<<<<<
 *         if err:
 *             PyMem_Free(data)
*/
          __pyx_v_err = 1;
        }

        /* "H2MM_C.pyx":2564
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             err = True
 *         if err:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L34;
          }
          __pyx_L34:;
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L21_exception_handled;
      }
      goto __pyx_L22_except_error;

      /* "H2MM_C.pyx":2561
 *         return out, MemoryError("insufficient memory for gamma array")
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty((burst_sizes[i], nstate), dtype=np.double)
 *             temp = obtemp
*/
      __pyx_L22_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      goto __pyx_L1_error;
      __pyx_L21_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      __pyx_L27_try_end:;
    }

    /* "H2MM_C.pyx":2566
 *         except Exception as e:
 *             err = True
 *         if err:             # <<<<<<<<<<<<<<
 *             PyMem_Free(data)
 *             data = NULL
*/
    if (__pyx_v_err) {

      /* "H2MM_C.pyx":2567
 *             err = True
 *         if err:
 *             PyMem_Free(data)             # <<<<<<<<<<<<<<
 *             data = NULL
 *             return out
*/
      PyMem_Free(__pyx_v_data);

      /* "H2MM_C.pyx":2568
 *         if err:
 *             PyMem_Free(data)
 *             data = NULL             # <<<<<<<<<<<<<<
 *             return out
 *         out[i] = obtemp
*/
      __pyx_v_data = NULL;

      /* "H2MM_C.pyx":2569
 *             PyMem_Free(data)
 *             data = NULL
 *             return out             # <<<<<<<<<<<<<<
 *         out[i] = obtemp
 *         data[i] = <double*> temp.data
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_out);
      __pyx_r = ((PyArrayObject *)__pyx_v_out);
      goto __pyx_L0;

      /* "H2MM_C.pyx":2566
 *         except Exception as e:
 *             err = True
 *         if err:             # <<<<<<<<<<<<<<
 *             PyMem_Free(data)
 *             data = NULL
*/
    }

    /* "H2MM_C.pyx":2570
 *             data = NULL
 *             return out
 *         out[i] = obtemp             # <<<<<<<<<<<<<<
 *         data[i] = <double*> temp.data
 *     gamma[0] = data
*/
    if (unlikely(!__pyx_v_obtemp)) { __Pyx_RaiseUnboundLocalError("obtemp"); __PYX_ERR(0, 2570, __pyx_L1_error) }
    __pyx_t_19 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_19 < 0) {
      __pyx_t_19 += __pyx_pybuffernd_out.diminfo[0].shape;
      if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      __PYX_ERR(0, 2570, __pyx_L1_error)
    }
    __pyx_t_20 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_out.diminfo[0].strides);
    __Pyx_XGOTREF(*__pyx_t_20);
    __Pyx_INCREF(__pyx_v_obtemp); __Pyx_XDECREF(*__pyx_t_20);
    *__pyx_t_20 = __pyx_v_obtemp;
    __Pyx_XGIVEREF(*__pyx_t_20);

    /* "H2MM_C.pyx":2571
 *             return out
 *         out[i] = obtemp
 *         data[i] = <double*> temp.data             # <<<<<<<<<<<<<<
 *     gamma[0] = data
 *     return out
*/
    (__pyx_v_data[__pyx_v_i]) = ((double *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_temp)));
  }

  /* "H2MM_C.pyx":2572
 *         out[i] = obtemp
 *         data[i] = <double*> temp.data
 *     gamma[0] = data             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
  (__pyx_v_gamma[0]) = __pyx_v_data;

  /* "H2MM_C.pyx":2573
 *         data[i] = <double*> temp.data
 *     gamma[0] = data
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_out);
  __pyx_r = ((PyArrayObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "H2MM_C.pyx":2544
 * 
 * 
 * cdef cnp.ndarray[object, ndim=1] make_gamma_arrays(int64_t nbursts, int64_t nstate, int64_t *burst_sizes, double ***gamma):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] out
 *     cdef bint err = False
*/

  /* function exit code */
  __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_8);
  __Pyx_XDECREF(__pyx_t_9);
  { 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_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.make_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_obtemp);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2576
 * 
 * 
 * cdef cnp.ndarray[object, ndim=1] make_h2mm_out_arrays(int64_t nmodels, h2mm_mod *mods):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False
*/

static PyArrayObject *__pyx_f_6H2MM_C_make_h2mm_out_arrays(int64_t __pyx_v_nmodels, h2mm_mod *__pyx_v_mods) {
  PyArrayObject *__pyx_v_models = 0;
  int __pyx_v_err;
  PyObject *__pyx_v_e = NULL;
  int64_t __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_models;
  __Pyx_Buffer __pyx_pybuffer_models;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  PyObject **__pyx_t_16;
  int __pyx_t_17;
  char const *__pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int64_t __pyx_t_22;
  int64_t __pyx_t_23;
  int64_t __pyx_t_24;
  char const *__pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_h2mm_out_arrays", 0);
  __pyx_pybuffer_models.pybuffer.buf = NULL;
  __pyx_pybuffer_models.refcount = 0;
  __pyx_pybuffernd_models.data = NULL;
  __pyx_pybuffernd_models.rcbuffer = &__pyx_pybuffer_models;

  /* "H2MM_C.pyx":2578
 * cdef cnp.ndarray[object, ndim=1] make_h2mm_out_arrays(int64_t nmodels, h2mm_mod *mods):
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False             # <<<<<<<<<<<<<<
 *     try:
 *         models = np.empty(nmodels, dtype=np.object_)
*/
  __pyx_v_err = 0;

  /* "H2MM_C.pyx":2579
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False
 *     try:             # <<<<<<<<<<<<<<
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":2580
 *     cdef bint err = False
 *     try:
 *         models = np.empty(nmodels, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         err = True
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_nmodels); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_10 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_10 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_6};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2580, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_9, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 2580, __pyx_L3_error)
        __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __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 (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2580, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2580, __pyx_L3_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_models.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_models.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_models.rcbuffer->pybuffer, (PyObject*)__pyx_v_models, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 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_models.diminfo[0].strides = __pyx_pybuffernd_models.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_models.diminfo[0].shape = __pyx_pybuffernd_models.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2580, __pyx_L3_error)
      }
      __pyx_v_models = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":2579
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False
 *     try:             # <<<<<<<<<<<<<<
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:
*/
    }
    __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:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":2581
 *     try:
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *         models[0] = e
*/
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("H2MM_C.make_h2mm_out_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 2581, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_e = __pyx_t_7;
      /*try:*/ {

        /* "H2MM_C.pyx":2582
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:
 *         err = True             # <<<<<<<<<<<<<<
 *         models[0] = e
 *     if err:
*/
        __pyx_v_err = 1;

        /* "H2MM_C.pyx":2583
 *     except Exception as e:
 *         err = True
 *         models[0] = e             # <<<<<<<<<<<<<<
 *     if err:
 *         return models
*/
        __pyx_t_15 = 0;
        __pyx_t_11 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_pybuffernd_models.diminfo[0].shape;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_models.diminfo[0].shape)) __pyx_t_11 = 0;
        if (unlikely(__pyx_t_11 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_11);
          __PYX_ERR(0, 2583, __pyx_L14_error)
        }
        __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_models.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_models.diminfo[0].strides);
        __Pyx_XGOTREF(*__pyx_t_16);
        __Pyx_INCREF(__pyx_v_e); __Pyx_XDECREF(*__pyx_t_16);
        *__pyx_t_16 = __pyx_v_e;
        __Pyx_XGIVEREF(*__pyx_t_16);
      }

      /* "H2MM_C.pyx":2581
 *     try:
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *         models[0] = e
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L15;
        }
        __pyx_L14_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
          if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_21);
          __pyx_t_11 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename;
          {
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
          __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18;
          goto __pyx_L5_except_error;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "H2MM_C.pyx":2579
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False
 *     try:             # <<<<<<<<<<<<<<
 *         models = np.empty(nmodels, dtype=np.object_)
 *     except Exception as e:
*/
    __pyx_L5_except_error:;
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "H2MM_C.pyx":2584
 *         err = True
 *         models[0] = e
 *     if err:             # <<<<<<<<<<<<<<
 *         return models
 *     for i in range(nmodels):
*/
  if (__pyx_v_err) {

    /* "H2MM_C.pyx":2585
 *         models[0] = e
 *     if err:
 *         return models             # <<<<<<<<<<<<<<
 *     for i in range(nmodels):
 *         try:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_models);
    __pyx_r = ((PyArrayObject *)__pyx_v_models);
    goto __pyx_L0;

    /* "H2MM_C.pyx":2584
 *         err = True
 *         models[0] = e
 *     if err:             # <<<<<<<<<<<<<<
 *         return models
 *     for i in range(nmodels):
*/
  }

  /* "H2MM_C.pyx":2586
 *     if err:
 *         return models
 *     for i in range(nmodels):             # <<<<<<<<<<<<<<
 *         try:
 *             models[i] = h2mm_model.move_ptr(&mods[i])
*/
  __pyx_t_22 = __pyx_v_nmodels;
  __pyx_t_23 = __pyx_t_22;
  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
    __pyx_v_i = __pyx_t_24;

    /* "H2MM_C.pyx":2587
 *         return models
 *     for i in range(nmodels):
 *         try:             # <<<<<<<<<<<<<<
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      /*try:*/ {

        /* "H2MM_C.pyx":2588
 *     for i in range(nmodels):
 *         try:
 *             models[i] = h2mm_model.move_ptr(&mods[i])             # <<<<<<<<<<<<<<
 *         except Exception as e:
 *             err = True
*/
        __pyx_t_8 = ((PyObject *)__pyx_f_6H2MM_C_10h2mm_model_move_ptr((&(__pyx_v_mods[__pyx_v_i])))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2588, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_15 = __pyx_v_i;
        __pyx_t_17 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_pybuffernd_models.diminfo[0].shape;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_models.diminfo[0].shape)) __pyx_t_17 = 0;
        if (unlikely(__pyx_t_17 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_17);
          __PYX_ERR(0, 2588, __pyx_L23_error)
        }
        __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_models.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_models.diminfo[0].strides);
        __Pyx_XGOTREF(*__pyx_t_16);
        __Pyx_INCREF(__pyx_t_8); __Pyx_XDECREF(*__pyx_t_16);
        *__pyx_t_16 = __pyx_t_8;
        __Pyx_XGIVEREF(*__pyx_t_16);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "H2MM_C.pyx":2587
 *         return models
 *     for i in range(nmodels):
 *         try:             # <<<<<<<<<<<<<<
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:
*/
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L30_try_end;
      __pyx_L23_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "H2MM_C.pyx":2589
 *         try:
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             err = True
 *             models[i] = e
*/
      __pyx_t_17 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
      if (__pyx_t_17) {
        __Pyx_AddTraceback("H2MM_C.make_h2mm_out_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 2589, __pyx_L25_except_error)
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_v_e = __pyx_t_7;
        /*try:*/ {

          /* "H2MM_C.pyx":2590
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:
 *             err = True             # <<<<<<<<<<<<<<
 *             models[i] = e
 *         if err:
*/
          __pyx_v_err = 1;

          /* "H2MM_C.pyx":2591
 *         except Exception as e:
 *             err = True
 *             models[i] = e             # <<<<<<<<<<<<<<
 *         if err:
 *             return models
*/
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_17 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_models.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_models.diminfo[0].shape)) __pyx_t_17 = 0;
          if (unlikely(__pyx_t_17 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_17);
            __PYX_ERR(0, 2591, __pyx_L36_error)
          }
          __pyx_t_16 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_models.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_models.diminfo[0].strides);
          __Pyx_XGOTREF(*__pyx_t_16);
          __Pyx_INCREF(__pyx_v_e); __Pyx_XDECREF(*__pyx_t_16);
          *__pyx_t_16 = __pyx_v_e;
          __Pyx_XGIVEREF(*__pyx_t_16);
        }

        /* "H2MM_C.pyx":2589
 *         try:
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:             # <<<<<<<<<<<<<<
 *             err = True
 *             models[i] = e
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            goto __pyx_L37;
          }
          __pyx_L36_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
            if ( unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_12);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __pyx_t_17 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_25 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_ErrRestore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
            __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
            __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_25;
            goto __pyx_L25_except_error;
          }
          __pyx_L37:;
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L24_exception_handled;
      }
      goto __pyx_L25_except_error;

      /* "H2MM_C.pyx":2587
 *         return models
 *     for i in range(nmodels):
 *         try:             # <<<<<<<<<<<<<<
 *             models[i] = h2mm_model.move_ptr(&mods[i])
 *         except Exception as e:
*/
      __pyx_L25_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      goto __pyx_L1_error;
      __pyx_L24_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      __pyx_L30_try_end:;
    }

    /* "H2MM_C.pyx":2592
 *             err = True
 *             models[i] = e
 *         if err:             # <<<<<<<<<<<<<<
 *             return models
 *     return models
*/
    if (__pyx_v_err) {

      /* "H2MM_C.pyx":2593
 *             models[i] = e
 *         if err:
 *             return models             # <<<<<<<<<<<<<<
 *     return models
 * 
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_models);
      __pyx_r = ((PyArrayObject *)__pyx_v_models);
      goto __pyx_L0;

      /* "H2MM_C.pyx":2592
 *             err = True
 *             models[i] = e
 *         if err:             # <<<<<<<<<<<<<<
 *             return models
 *     return models
*/
    }
  }

  /* "H2MM_C.pyx":2594
 *         if err:
 *             return models
 *     return models             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_models);
  __pyx_r = ((PyArrayObject *)__pyx_v_models);
  goto __pyx_L0;

  /* "H2MM_C.pyx":2576
 * 
 * 
 * cdef cnp.ndarray[object, ndim=1] make_h2mm_out_arrays(int64_t nmodels, h2mm_mod *mods):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] models
 *     cdef bint err = False
*/

  /* function exit code */
  __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_8);
  __Pyx_XDECREF(__pyx_t_9);
  { 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_models.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.make_h2mm_out_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_models.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_models);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

static PyObject *__pyx_pf_6H2MM_C_31__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);

  /* "H2MM_C.pyx":2603
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,
 *               reset_niter=True, gamma=False, opt_array=False):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the most likely model that explains the given set of data. The
*/
  __pyx_t_1 = PyTuple_New(18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(((PyObject*)__pyx_mstate_global->__pyx_n_u_iter));
  __Pyx_GIVEREF(((PyObject*)__pyx_mstate_global->__pyx_n_u_iter));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject*)__pyx_mstate_global->__pyx_n_u_iter)) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(((PyObject*)__pyx_mstate_global->__pyx_int_1));
  __Pyx_GIVEREF(((PyObject*)__pyx_mstate_global->__pyx_int_1));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject*)__pyx_mstate_global->__pyx_int_1)) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 6, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 7, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 8, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 9, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 10, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 11, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 12, __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 13, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 14, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(((PyObject*)Py_True));
  __Pyx_GIVEREF(((PyObject*)Py_True));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 15, ((PyObject*)Py_True)) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(((PyObject*)Py_False));
  __Pyx_GIVEREF(((PyObject*)Py_False));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 16, ((PyObject*)Py_False)) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(((PyObject*)Py_False));
  __Pyx_GIVEREF(((PyObject*)Py_False));
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 17, ((PyObject*)Py_False)) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);

  /* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None) != (0)) __PYX_ERR(0, 2597, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("H2MM_C.__defaults__", __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_6H2MM_C_11EM_H2MM_C(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_10EM_H2MM_C, "\n    Calculate the most likely model that explains the given set of data. The \n    input model is used as the start of the optimization.\n\n    Parameters\n    ----------\n    model : h2mm_model\n        An initial guess for the H2MM model, just give a general guess, the algorithm\n        will optimize, and generally the algorithm will converge even when the\n        initial guess is very far off\n    \n    indexes : list of NUMPY 1D int arrays\n        A list of the arrival indexes for each photon in each burst.\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The indexes list must maintain  1-to-1 correspondence to the times list\n    \n    times : list of NUMPY 1D int arrays\n        A list of the arrival times for each photon in each burst\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The times list must maintain  1-to-1 correspondence to the indexes list\n    \n    max_iter : int or None, optional\n        the maximum number of iterations to conduct before returning the current\n        :class:`h2mm_model`, if None (default) use value from optimization_limits. \n        Default is None\n    \n    bounds_func : str, callable or None, optional\n        function to be evaluated after every iteration of the H2MM algorithm\n        its primary function is to place bounds on :class:`h2mm_model`\n        \n        .. note:: \n            \n            bounding the :class:`h2mm_model` causes the guarantee of improvement on each\n            iteration until convergence to no longer apply, therefore the results are\n            no longer guaranteed to be the optimal model within bounds.\n        \n        Default is None\n        \n        Acceptable inputs\\:\n            \n            C level limits: 'minmax' 'revert' 'revert_old'\n                prevents the model from havin""g values outside of those defined\n                by :class:`h2mm_limits` class given to bounds, if an iteration produces\n                a new model for loglik calculation in the next iteration with \n                values that are out of those bounds, the 3 function differ in\n                how they correct the model when a new model has a value out of\n                bounds, they are as follows:\n                \n                **'minmax'**\\: \n                    \n                    sets the out of bounds value to the min or max value\n                    closer to the original value\n                \n                **'revert'**\\: \n                    \n                    sets the out of bounds value to the value from the last\n                    model for which the loglik was calculated\n                \n                **'revert_old'**\\: \n                    \n                    similar to revert, but instead reverts to the value\n                    from the model one before the last calculated model\n            \n            Callable: python function that takes 4 inputs and returns :class:`h2mm_model` object\n                .. warning:: \n                \n                    The user takes full responsibility for errors in the results.\n                \n                must be a python function that takes the signature\n                ``bounds_func(new, current, old, *bounds, **bounds_kwargs)``\n                ``new``, ``current``, and ``old`` are :class:`h2mm_model` objects, \n                with ``new`` being the model whose loglik has yet to be calculated\n                resulting from the latest iteration, ``current`` being the model\n                whose loglik was just calculated, and ``old`` being the result\n                of the previous iteration. Be one of the following: :class:`h2mm_model`,\n                :code:`bool`, :code:`int`, or a 2-tuple of :class:`h2mm_model` and\n                either :code:`bool` or :co""de:`int`. In all cases, :code:`int` values\n                must 0, 1, or 2. :class:`h2mm_model` objects will be used as the\n                next model to compute the loglik of. :class:`bool` and :code:`int`\n                objects determine if optimization will continue.\n                If :code:`True`, then optimization will continue, if :code:`False`,\n                then optimization will cease, and the ``old`` model will be returned\n                as the ideal model. If :code:`0`, then optimization will continue,\n                if :code:`1`, then return ``old`` model as optimal model, if \n                :code:`2`, then return ``current`` model as optimizal model.\n    \n    bounds : h2mm_limits, tuple, or None, optional\n        Argument(s) pass to bounds_func function. If bounds_func is a string,\n        then bounds **must** be specified, and **must** be a :class:`h2mm_limits`\n        object.\n        \n        If ``bounds_func`` is callable, and bounds is not None or a tuple, bounds\n        is passed as the 4th argument to bounds_func, ie \n        :code:`bounds_func(new, current, old, bounds, **bounds_kwargs)`, \n        if bounds is a tuple, then passed as \\*args, \n        ie :code:`bounds_func(new, current, old, *bounds, **bounds_kwargs)`\n        Default is None\n    \n    bounds_kwargs : dict, or None, optional\n        Only used when ``bounds_func`` is callable, passed as \\*\\*kwargs to\n        ``bounds_func`` ie ie :code:`bounds_func(new, current, old, *bounds, **bounds_kwargs)`.\n        If :code:`None`\n        The default is None\n    \n    print_func : None, str or callable, optional\n        Specifies how the results of each iteration will be displayed, several \n        strings specify built-in functions. Default is 'iter'\n        Acceptable inputs: str, Callable or None\n            \n            **None**\\:\n            \n                causes no printout anywhere of the results of each iteration\n                \n          ""  Str: 'all', 'diff', 'comp', 'iter'\n            \n                **'all'**\\: \n                    \n                    prints out the full :class:`h2mm_model` just evaluated, this is very\n                    verbose, and not generally recommended unless you really want\n                    to know every step of the optimization\n                \n                **'diff'**\\: \n                    \n                    prints the loglik of the iteration, and the difference \n                    between the current and old loglik, this is the same format\n                    that the 'console' option used, the difference is whether the\n                    print function used is the C printf, or Cython print, which \n                    changes the destination from the console to the Jupyter notebook\n                    \n                **'diff_time'**\\: \n                    \n                    same as 'diff' but adds the time of the last iteration\n                    and the total optimization time\n                    \n                **'comp'**\\: \n                    \n                    prints out the current and old loglik\n                \n                **'comp_time'**\\: \n                    \n                    same as 'comp'  but with times, like in 'diff_time'\n                \n                **'iter'**\\: \n                    \n                    prints out only the current iteration\n            \n            Callable: user defined function\n                A python function for printing out a custom output, the function must\n                accept the input of \n                (int, :class:`h2mm_model`, :class:`h2mm_model`, :class:`h2mm_model`, float, float)\n                as the function will be handed ``(niter, new, current, old, iter_time, total_time)``\n                from a special Cython wrapper. iter_time and total_time are the times\n                of the latest iteration and total time of optimization, respective""ly.\n                Note that iter_time and total_time are based on the fast, but\n                inaccurate C clock function.\n    \n    print_freq: int, optional\n        Number of iterations between updating display. Default is 1\n    \n    print_args : tuple or None, optional\n        Only used when ``print_func`` is callable. Passed as final argument to\n        ``print_func`` if not :code:`None` or :code:`tuple`, ie\n        ``print_func(niter, new, current, old, iter_time, total_time, print_args, **print_kwargs)``\n        if :code:`tuple`, then passed as \\*args, ie\n        ``print_func(niter, new, current, old, iter_time, total_time, *print_args, **print_kwargs)``\n        If :code:`None`, then ignored. The default is :code:`None`.\n    \n    print_kwargs: dict or None, optional\n        Only used when ``print_func`` is callable, passed as \\*\\*kwargs to ``print_func``\n        ie ``print_func(niter, new, current, old, iter_time, time_total, *print_args, **print_kwargs)``.\n        If :code:`None`, then ignored. The default is :code:`None`.\n    \n    print_stream : OutStream, optional\n        Typically OutStream, the stream where the output will be displayed.\n        Passed as first argument to print_formatter, if :code:`None`, then use\n        stream specified in optimization_limites. Default is None\n    \n    print_formatter : Printer, optional\n        Class object (usually subclass of :class:`Printer`) that formats\n        text for output to ``print_stream``. Instance of ``print_formatter`` class\n        will be created with \n        ``fmtr = print_formatter(print_stream, *print_fmt_args, **print_fmt_kwargs)``\n        to use for printing. Each print will call ``fmtr.update(text)`` where\n        ``text`` is output of ``print_func`` call. At end of optimization,\n        ``fmtr.close()`` will be called. If ``print_formatter`` is :code:`None`\n        then will use the formatter specified in ``optimization_limits``.\n        The default is :c""ode:`None`.\n    \n    print_fmt_args : tuple, Any or None, optional\n        Additional arguments passed to ``print_formatter``, if None, ignored,\n        if not tuple, then treated as single argument. The default is :code:`None`.\n    \n    print_fmt_kwargs : dict or None, optional\n        Additional  keyword arguments passed to ``print_formatter``, if None, ignored.\n        The default is :code:`None`.\n        \n    max_time : float or None, optional\n        The maximum time (in seconds) before returning current model\n        **NOTE** this uses the inaccurate C clock, which is often longer than the\n        actual time. If :code:`None` (default) use value from optimization_limits. \n        Default is :code:`None`.\n    \n    converged_min : float or None, optional\n        The difference between new and current :class:`h2mm_model` to consider the model\n        converged, the default setting is close to floating point error, it is\n        recommended to only increase the size. If None (default) use value from \n        optimization_limits. Default is None\n    num_cores : int or None, optional\n        the number of C threads (which ignore the gil, thus functioning more\n        like python processes), to use when calculating iterations.\n        \n        .. note:: \n            \n            optimization_limtis sets this to be `os.cpu_count() // 2`, as most machines\n            are multithreaded. Because os.cpu_count() returns the number of threads,\n            not necessarily the number of cpus. For most machines, being multithreaded,\n            this actually returns twice the number of physical cores. Hence the default\n            to set at `os.cpu_count() // 2`. If your machine is not multithreaded, it\n            is best to set `optimization_limits.num_cores = os.cpu_count()`\n            \n        If None (default) use value from optimization_limits. \n        Default is None\n    reset_niter : bool, optional\n        Tells the algorithm whet""her or not to reset the iteration counter of the\n        model, True means that even if the model was previously optimized, the \n        iteration counter will start at 0, so calling :func:`EM_H2MM_C` on a model that\n        reached its maximum iteration number will proceed another max_iter \n        iterations. On the other hand, if set to False, then the new iterations\n        will be added to the old. If set to False, you likely will have to increase\n        max_iter, as the optimization will count the previous iterations towards\n        the max_iter threshold.\n        Default is False\n    \n    gamma : bool, optional\n        Whether or not to return the gamma array, which gives the probabilities\n        of each photon being in a given state.\n        \n        .. note::\n            \n            If opt_array is True, then only the gamma arrays for the ideal\n            model are returned.\n        \n        Default is False\n    \n    opt_array : bool | int, optional\n        Defines how the result is returned, if False (default) (or 0) then return only\n        the ideal model, if True (or 1), then a numpy array is returned containing all\n        models during the optimization, with the last model being the optimial model.\n        If 2 then return all models, including models after converged.\n        Default is False\n    \n    Returns\n    -------\n    out : h2mm_model\n        The optimized :class:`h2mm_model`. will return after one of the following conditions\n        are met: model has converged (according to converged_min, default 1e-14),\n        maximum iterations reached, maximum time has passed, or an error has occurred\n        (usually the result of a nan from a floating point precision error)\n        \n    gamma : numpy.ndarray (optional)\n        If gamma = True, this variable is returned, which contains (as numpy arrays)\n        the probabilities of each photon to be in each state, for each burst.\n        The arrays are returned ""in the same order and type as the input indexes,\n        individual data points organized as [photon, state] within each data\n        sequence.\n        \n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_11EM_H2MM_C = {"EM_H2MM_C", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_11EM_H2MM_C, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10EM_H2MM_C};
static PyObject *__pyx_pw_6H2MM_C_11EM_H2MM_C(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model = 0;
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_max_iter = 0;
  PyObject *__pyx_v_bounds_func = 0;
  PyObject *__pyx_v_bounds = 0;
  PyObject *__pyx_v_bounds_kwargs = 0;
  PyObject *__pyx_v_print_func = 0;
  PyObject *__pyx_v_print_freq = 0;
  PyObject *__pyx_v_print_args = 0;
  PyObject *__pyx_v_print_kwargs = 0;
  PyObject *__pyx_v_print_stream = 0;
  PyObject *__pyx_v_print_formatter = 0;
  PyObject *__pyx_v_print_fmt_args = 0;
  PyObject *__pyx_v_print_fmt_kwargs = 0;
  PyObject *__pyx_v_max_time = 0;
  PyObject *__pyx_v_converged_min = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_reset_niter = 0;
  PyObject *__pyx_v_gamma = 0;
  PyObject *__pyx_v_opt_array = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("EM_H2MM_C (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_max_iter,&__pyx_mstate_global->__pyx_n_u_bounds_func,&__pyx_mstate_global->__pyx_n_u_bounds,&__pyx_mstate_global->__pyx_n_u_bounds_kwargs,&__pyx_mstate_global->__pyx_n_u_print_func,&__pyx_mstate_global->__pyx_n_u_print_freq,&__pyx_mstate_global->__pyx_n_u_print_args,&__pyx_mstate_global->__pyx_n_u_print_kwargs,&__pyx_mstate_global->__pyx_n_u_print_stream,&__pyx_mstate_global->__pyx_n_u_print_formatter,&__pyx_mstate_global->__pyx_n_u_print_fmt_args,&__pyx_mstate_global->__pyx_n_u_print_fmt_kwargs,&__pyx_mstate_global->__pyx_n_u_max_time,&__pyx_mstate_global->__pyx_n_u_converged_min,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_reset_niter,&__pyx_mstate_global->__pyx_n_u_gamma,&__pyx_mstate_global->__pyx_n_u_opt_array,0};
    struct __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self);
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 2597, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case 21:
        values[20] = __Pyx_ArgRef_FASTCALL(__pyx_args, 20);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[20])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 20:
        values[19] = __Pyx_ArgRef_FASTCALL(__pyx_args, 19);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[19])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 19:
        values[18] = __Pyx_ArgRef_FASTCALL(__pyx_args, 18);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[18])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 18:
        values[17] = __Pyx_ArgRef_FASTCALL(__pyx_args, 17);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[17])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 17:
        values[16] = __Pyx_ArgRef_FASTCALL(__pyx_args, 16);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[16])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 16:
        values[15] = __Pyx_ArgRef_FASTCALL(__pyx_args, 15);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[15])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 15:
        values[14] = __Pyx_ArgRef_FASTCALL(__pyx_args, 14);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[14])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 14:
        values[13] = __Pyx_ArgRef_FASTCALL(__pyx_args, 13);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[13])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 13:
        values[12] = __Pyx_ArgRef_FASTCALL(__pyx_args, 12);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[12])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 12:
        values[11] = __Pyx_ArgRef_FASTCALL(__pyx_args, 11);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[11])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "EM_H2MM_C", 0) < (0)) __PYX_ERR(0, 2597, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2598
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,
 *               bounds_func=None, bounds=None, bounds_kwargs=None,             # <<<<<<<<<<<<<<
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_iter)));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));

      /* "H2MM_C.pyx":2599
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,             # <<<<<<<<<<<<<<
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2600
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,             # <<<<<<<<<<<<<<
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,
*/
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2601
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,             # <<<<<<<<<<<<<<
 *               max_time=np.inf, converged_min=None, num_cores=None,
 *               reset_niter=True, gamma=False, opt_array=False):
*/
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[15]) values[15] = __Pyx_NewRef(__pyx_dynamic_args->arg0);

      /* "H2MM_C.pyx":2602
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *               reset_niter=True, gamma=False, opt_array=False):
 *     """
*/
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[18]) values[18] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[19]) values[19] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[20]) values[20] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("EM_H2MM_C", 0, 3, 21, i); __PYX_ERR(0, 2597, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case 21:
        values[20] = __Pyx_ArgRef_FASTCALL(__pyx_args, 20);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[20])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 20:
        values[19] = __Pyx_ArgRef_FASTCALL(__pyx_args, 19);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[19])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 19:
        values[18] = __Pyx_ArgRef_FASTCALL(__pyx_args, 18);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[18])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 18:
        values[17] = __Pyx_ArgRef_FASTCALL(__pyx_args, 17);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[17])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 17:
        values[16] = __Pyx_ArgRef_FASTCALL(__pyx_args, 16);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[16])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 16:
        values[15] = __Pyx_ArgRef_FASTCALL(__pyx_args, 15);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[15])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 15:
        values[14] = __Pyx_ArgRef_FASTCALL(__pyx_args, 14);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[14])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 14:
        values[13] = __Pyx_ArgRef_FASTCALL(__pyx_args, 13);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[13])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 13:
        values[12] = __Pyx_ArgRef_FASTCALL(__pyx_args, 12);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[12])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 12:
        values[11] = __Pyx_ArgRef_FASTCALL(__pyx_args, 11);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[11])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 11:
        values[10] = __Pyx_ArgRef_FASTCALL(__pyx_args, 10);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[10])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case 10:
        values[9] = __Pyx_ArgRef_FASTCALL(__pyx_args, 9);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[9])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 2597, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 2597, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2597, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2597, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2598
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,
 *               bounds_func=None, bounds=None, bounds_kwargs=None,             # <<<<<<<<<<<<<<
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_n_u_iter)));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_1)));

      /* "H2MM_C.pyx":2599
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,             # <<<<<<<<<<<<<<
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,
*/
      if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2600
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,             # <<<<<<<<<<<<<<
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,
*/
      if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":2601
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,             # <<<<<<<<<<<<<<
 *               max_time=np.inf, converged_min=None, num_cores=None,
 *               reset_niter=True, gamma=False, opt_array=False):
*/
      if (!values[13]) values[13] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[14]) values[14] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[15]) values[15] = __Pyx_NewRef(__pyx_dynamic_args->arg0);

      /* "H2MM_C.pyx":2602
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *               reset_niter=True, gamma=False, opt_array=False):
 *     """
*/
      if (!values[16]) values[16] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[17]) values[17] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[18]) values[18] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[19]) values[19] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[20]) values[20] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    }
    __pyx_v_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_indexes = values[1];
    __pyx_v_times = values[2];
    __pyx_v_max_iter = values[3];
    __pyx_v_bounds_func = values[4];
    __pyx_v_bounds = values[5];
    __pyx_v_bounds_kwargs = values[6];
    __pyx_v_print_func = values[7];
    __pyx_v_print_freq = values[8];
    __pyx_v_print_args = values[9];
    __pyx_v_print_kwargs = values[10];
    __pyx_v_print_stream = values[11];
    __pyx_v_print_formatter = values[12];
    __pyx_v_print_fmt_args = values[13];
    __pyx_v_print_fmt_kwargs = values[14];
    __pyx_v_max_time = values[15];
    __pyx_v_converged_min = values[16];
    __pyx_v_num_cores = values[17];
    __pyx_v_reset_niter = values[18];
    __pyx_v_gamma = values[19];
    __pyx_v_opt_array = values[20];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("EM_H2MM_C", 0, 3, 21, __pyx_nargs); __PYX_ERR(0, 2597, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.EM_H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "model", 0))) __PYX_ERR(0, 2597, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_10EM_H2MM_C(__pyx_self, __pyx_v_model, __pyx_v_indexes, __pyx_v_times, __pyx_v_max_iter, __pyx_v_bounds_func, __pyx_v_bounds, __pyx_v_bounds_kwargs, __pyx_v_print_func, __pyx_v_print_freq, __pyx_v_print_args, __pyx_v_print_kwargs, __pyx_v_print_stream, __pyx_v_print_formatter, __pyx_v_print_fmt_args, __pyx_v_print_fmt_kwargs, __pyx_v_max_time, __pyx_v_converged_min, __pyx_v_num_cores, __pyx_v_reset_niter, __pyx_v_gamma, __pyx_v_opt_array);

  /* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_10EM_H2MM_C(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_max_iter, PyObject *__pyx_v_bounds_func, PyObject *__pyx_v_bounds, PyObject *__pyx_v_bounds_kwargs, PyObject *__pyx_v_print_func, PyObject *__pyx_v_print_freq, PyObject *__pyx_v_print_args, PyObject *__pyx_v_print_kwargs, PyObject *__pyx_v_print_stream, PyObject *__pyx_v_print_formatter, PyObject *__pyx_v_print_fmt_args, PyObject *__pyx_v_print_fmt_kwargs, PyObject *__pyx_v_max_time, PyObject *__pyx_v_converged_min, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_reset_niter, PyObject *__pyx_v_gamma, PyObject *__pyx_v_opt_array) {
  int64_t __pyx_v_i;
  int __pyx_v_gamma_;
  int __pyx_v_opt_array_;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_mdl = 0;
  lm __pyx_v_limits;
  PyObject *__pyx_v_print_strings = 0;
  __pyx_t_6H2MM_C_PrintStruct __pyx_v_prnt_strct;
  PyObject *__pyx_v_print_fmtr = 0;
  int (*__pyx_v_ptr_print_func)(int64_t, h2mm_mod *, h2mm_mod *, h2mm_mod *, double, double, void *);
  int (*__pyx_v_bound_func)(h2mm_mod *, h2mm_mod *, h2mm_mod *, double, lm *, void *);
  struct __pyx_obj_6H2MM_C__h2mm_lims *__pyx_v_bnds = 0;
  __pyx_t_6H2MM_C_BoundStruct __pyx_v_bound;
  void *__pyx_v_bnd_ptr;
  int __pyx_v_single;
  int64_t __pyx_v_nbursts;
  int64_t *__pyx_v_burst_sizes;
  uint8_t **__pyx_v_idxs;
  int32_t **__pyx_v_deltas;
  PyObject *__pyx_v_shape = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_indxs = NULL;
  PyObject *__pyx_v_err = NULL;
  int64_t __pyx_v_nphot;
  double **__pyx_v_gamma_arr;
  PyArrayObject *__pyx_v_gamma_out = 0;
  int __pyx_v_res;
  int64_t __pyx_v_out_arr_size;
  h2mm_mod *__pyx_v_out_arr;
  int64_t __pyx_v_nout;
  int64_t __pyx_v_conv;
  int64_t __pyx_v_niter;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_print_err = 0;
  PyObject *__pyx_v_bound_err = 0;
  PyObject *__pyx_v_out_text = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_gamma_out;
  __Pyx_Buffer __pyx_pybuffer_gamma_out;
  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;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int64_t __pyx_t_9;
  double __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int64_t __pyx_t_13;
  int64_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  h2mm_mod *__pyx_t_18;
  PyObject *__pyx_t_19[4];
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  PyObject *__pyx_t_22[3];
  Py_ssize_t __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("EM_H2MM_C", 0);
  __Pyx_INCREF(__pyx_v_bounds);
  __Pyx_INCREF(__pyx_v_bounds_kwargs);
  __Pyx_INCREF(__pyx_v_print_args);
  __Pyx_INCREF(__pyx_v_print_kwargs);
  __Pyx_INCREF(__pyx_v_print_fmt_args);
  __Pyx_INCREF(__pyx_v_print_fmt_kwargs);
  __pyx_pybuffer_gamma_out.pybuffer.buf = NULL;
  __pyx_pybuffer_gamma_out.refcount = 0;
  __pyx_pybuffernd_gamma_out.data = NULL;
  __pyx_pybuffernd_gamma_out.rcbuffer = &__pyx_pybuffer_gamma_out;

  /* "H2MM_C.pyx":2873
 * 
 *     """
 *     print_fmt_args = tuple() if print_fmt_args is None else print_fmt_args             # <<<<<<<<<<<<<<
 *     print_fmt_args = print_fmt_args if isinstance(print_fmt_args, tuple) else (print_fmt_args, )
 *     print_fmt_kwargs = dict() if print_fmt_kwargs is None else dict(print_fmt_kwargs)
*/
  __pyx_t_2 = (__pyx_v_print_fmt_args == Py_None);
  if (__pyx_t_2) {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_print_fmt_args);
    __pyx_t_1 = __pyx_v_print_fmt_args;
  }
  __Pyx_DECREF_SET(__pyx_v_print_fmt_args, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2874
 *     """
 *     print_fmt_args = tuple() if print_fmt_args is None else print_fmt_args
 *     print_fmt_args = print_fmt_args if isinstance(print_fmt_args, tuple) else (print_fmt_args, )             # <<<<<<<<<<<<<<
 *     print_fmt_kwargs = dict() if print_fmt_kwargs is None else dict(print_fmt_kwargs)
 *     print_args = tuple() if print_args is None else print_args
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_print_fmt_args); 
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_print_fmt_args);
    __pyx_t_1 = __pyx_v_print_fmt_args;
  } else {
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2874, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_print_fmt_args);
    __Pyx_GIVEREF(__pyx_v_print_fmt_args);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_print_fmt_args) != (0)) __PYX_ERR(0, 2874, __pyx_L1_error);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_print_fmt_args, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2875
 *     print_fmt_args = tuple() if print_fmt_args is None else print_fmt_args
 *     print_fmt_args = print_fmt_args if isinstance(print_fmt_args, tuple) else (print_fmt_args, )
 *     print_fmt_kwargs = dict() if print_fmt_kwargs is None else dict(print_fmt_kwargs)             # <<<<<<<<<<<<<<
 *     print_args = tuple() if print_args is None else print_args
 *     print_args = print_args if isinstance(print_args, tuple) else (print_args, )
*/
  __pyx_t_2 = (__pyx_v_print_fmt_kwargs == Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_print_fmt_kwargs};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2875, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_print_fmt_kwargs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2876
 *     print_fmt_args = print_fmt_args if isinstance(print_fmt_args, tuple) else (print_fmt_args, )
 *     print_fmt_kwargs = dict() if print_fmt_kwargs is None else dict(print_fmt_kwargs)
 *     print_args = tuple() if print_args is None else print_args             # <<<<<<<<<<<<<<
 *     print_args = print_args if isinstance(print_args, tuple) else (print_args, )
 *     print_kwargs = dict() if print_kwargs is None else dict(print_kwargs)
*/
  __pyx_t_2 = (__pyx_v_print_args == Py_None);
  if (__pyx_t_2) {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_print_args);
    __pyx_t_1 = __pyx_v_print_args;
  }
  __Pyx_DECREF_SET(__pyx_v_print_args, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2877
 *     print_fmt_kwargs = dict() if print_fmt_kwargs is None else dict(print_fmt_kwargs)
 *     print_args = tuple() if print_args is None else print_args
 *     print_args = print_args if isinstance(print_args, tuple) else (print_args, )             # <<<<<<<<<<<<<<
 *     print_kwargs = dict() if print_kwargs is None else dict(print_kwargs)
 *     bounds_kwargs = dict() if bounds_kwargs is None else dict(bounds_kwargs)
*/
  __pyx_t_2 = PyTuple_Check(__pyx_v_print_args); 
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v_print_args);
    __pyx_t_1 = __pyx_v_print_args;
  } else {
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_print_args);
    __Pyx_GIVEREF(__pyx_v_print_args);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_print_args) != (0)) __PYX_ERR(0, 2877, __pyx_L1_error);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_print_args, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2878
 *     print_args = tuple() if print_args is None else print_args
 *     print_args = print_args if isinstance(print_args, tuple) else (print_args, )
 *     print_kwargs = dict() if print_kwargs is None else dict(print_kwargs)             # <<<<<<<<<<<<<<
 *     bounds_kwargs = dict() if bounds_kwargs is None else dict(bounds_kwargs)
 *     cdef int64_t i
*/
  __pyx_t_2 = (__pyx_v_print_kwargs == Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2878, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_print_kwargs};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_print_kwargs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2879
 *     print_args = print_args if isinstance(print_args, tuple) else (print_args, )
 *     print_kwargs = dict() if print_kwargs is None else dict(print_kwargs)
 *     bounds_kwargs = dict() if bounds_kwargs is None else dict(bounds_kwargs)             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     cdef bint gamma_ = bool(gamma)
*/
  __pyx_t_2 = (__pyx_v_bounds_kwargs == Py_None);
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_bounds_kwargs};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_bounds_kwargs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2881
 *     bounds_kwargs = dict() if bounds_kwargs is None else dict(bounds_kwargs)
 *     cdef int64_t i
 *     cdef bint gamma_ = bool(gamma)             # <<<<<<<<<<<<<<
 *     cdef int opt_array_ = int(opt_array)
 *     if opt_array_ not in (0, 1, 2):
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gamma); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2881, __pyx_L1_error)
  __pyx_v_gamma_ = (!(!__pyx_t_2));

  /* "H2MM_C.pyx":2882
 *     cdef int64_t i
 *     cdef bint gamma_ = bool(gamma)
 *     cdef int opt_array_ = int(opt_array)             # <<<<<<<<<<<<<<
 *     if opt_array_ not in (0, 1, 2):
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
*/
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_opt_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_opt_array_ = __pyx_t_6;

  /* "H2MM_C.pyx":2883
 *     cdef bint gamma_ = bool(gamma)
 *     cdef int opt_array_ = int(opt_array)
 *     if opt_array_ not in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
*/
  switch (__pyx_v_opt_array_) {
    case 0:
    case 1:
    case 2:
    __pyx_t_2 = 0;
    break;
    default:
    __pyx_t_2 = 1;
    break;
  }
  __pyx_t_7 = __pyx_t_2;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":2884
 *     cdef int opt_array_ = int(opt_array)
 *     if opt_array_ not in (0, 1, 2):
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")             # <<<<<<<<<<<<<<
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
 *     if reset_niter:
*/
    __pyx_t_3 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_opt_array_must_be_True_False_0_F};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2884, __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, 2884, __pyx_L1_error)

    /* "H2MM_C.pyx":2883
 *     cdef bint gamma_ = bool(gamma)
 *     cdef int opt_array_ = int(opt_array)
 *     if opt_array_ not in (0, 1, 2):             # <<<<<<<<<<<<<<
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
*/
  }

  /* "H2MM_C.pyx":2885
 *     if opt_array_ not in (0, 1, 2):
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)             # <<<<<<<<<<<<<<
 *     if reset_niter:
 *         mdl.model.niter = 0
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_6H2MM_C_model_copy_from_ptr(__pyx_v_model->model)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mdl = ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":2886
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
 *     if reset_niter:             # <<<<<<<<<<<<<<
 *         mdl.model.niter = 0
 *     ######################### get optimization limits #########################
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_reset_niter); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2886, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2887
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
 *     if reset_niter:
 *         mdl.model.niter = 0             # <<<<<<<<<<<<<<
 *     ######################### get optimization limits #########################
 *     cdef lm limits
*/
    __pyx_v_mdl->model->niter = 0;

    /* "H2MM_C.pyx":2886
 *         raise ValueError("opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models)")
 *     cdef h2mm_model mdl = model_copy_from_ptr(model.model)
 *     if reset_niter:             # <<<<<<<<<<<<<<
 *         mdl.model.niter = 0
 *     ######################### get optimization limits #########################
*/
  }

  /* "H2MM_C.pyx":2890
 *     ######################### get optimization limits #########################
 *     cdef lm limits
 *     limits.max_iter = <int64_t> optimization_limits._get_max_iter(max_iter)             # <<<<<<<<<<<<<<
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     limits.max_time = <double> optimization_limits._get_max_time(max_time)
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_max_iter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_max_iter};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_limits.max_iter = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":2891
 *     cdef lm limits
 *     limits.max_iter = <int64_t> optimization_limits._get_max_iter(max_iter)
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)             # <<<<<<<<<<<<<<
 *     limits.max_time = <double> optimization_limits._get_max_time(max_time)
 *     limits.min_conv = <double> optimization_limits._get_converged_min(converged_min)
*/
  __pyx_t_8 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_num_cores); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_8);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_num_cores};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2891, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_limits.num_cores = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":2892
 *     limits.max_iter = <int64_t> optimization_limits._get_max_iter(max_iter)
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     limits.max_time = <double> optimization_limits._get_max_time(max_time)             # <<<<<<<<<<<<<<
 *     limits.min_conv = <double> optimization_limits._get_converged_min(converged_min)
 *     ################# process print_func and print_func args  #################
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_get_max_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_max_time};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_limits.max_time = ((double)__pyx_t_10);

  /* "H2MM_C.pyx":2893
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     limits.max_time = <double> optimization_limits._get_max_time(max_time)
 *     limits.min_conv = <double> optimization_limits._get_converged_min(converged_min)             # <<<<<<<<<<<<<<
 *     ################# process print_func and print_func args  #################
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_converged_min); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_converged_min};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2893, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_limits.min_conv = ((double)__pyx_t_10);

  /* "H2MM_C.pyx":2895
 *     limits.min_conv = <double> optimization_limits._get_converged_min(converged_min)
 *     ################# process print_func and print_func args  #################
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')             # <<<<<<<<<<<<<<
 *     if print_func not in print_strings and not callable(print_func):
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[13]);
  __pyx_v_print_strings = __pyx_mstate_global->__pyx_tuple[13];

  /* "H2MM_C.pyx":2896
 *     ################# process print_func and print_func args  #################
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')
 *     if print_func not in print_strings and not callable(print_func):             # <<<<<<<<<<<<<<
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
 *     cdef PrintStruct prnt_strct
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_print_func, __pyx_v_print_strings, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2896, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_7 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_print_func); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2896, __pyx_L1_error)
  __pyx_t_11 = (!__pyx_t_2);
  __pyx_t_7 = __pyx_t_11;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":2897
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')
 *     if print_func not in print_strings and not callable(print_func):
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")             # <<<<<<<<<<<<<<
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_print_func_must_be_None_all_diff};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2897, __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, 2897, __pyx_L1_error)

    /* "H2MM_C.pyx":2896
 *     ################# process print_func and print_func args  #################
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')
 *     if print_func not in print_strings and not callable(print_func):             # <<<<<<<<<<<<<<
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
 *     cdef PrintStruct prnt_strct
*/
  }

  /* "H2MM_C.pyx":2899
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),             # <<<<<<<<<<<<<<
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
*/
  __pyx_t_8 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_formatter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_8);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_print_formatter};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_8 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_outstream); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_12);
    assert(__pyx_t_8);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_print_stream};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 2899, __pyx_L1_error);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":2900
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)             # <<<<<<<<<<<<<<
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
 *     prnt_strct.disp_freq = <int64_t> int(print_freq)
*/
  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_print_fmt_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "H2MM_C.pyx":2899
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),             # <<<<<<<<<<<<<<
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
*/
  __pyx_t_8 = PyNumber_Add(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":2900
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)             # <<<<<<<<<<<<<<
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
 *     prnt_strct.disp_freq = <int64_t> int(print_freq)
*/
  if (unlikely(__pyx_v_print_fmt_kwargs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 2900, __pyx_L1_error)
  }
  if (likely(PyDict_CheckExact(__pyx_v_print_fmt_kwargs))) {
    __pyx_t_4 = PyDict_Copy(__pyx_v_print_fmt_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2900, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_v_print_fmt_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }

  /* "H2MM_C.pyx":2899
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
 *     cdef PrintStruct prnt_strct
 *     cdef object print_fmtr = optimization_limits._get_formatter(print_formatter)(optimization_limits._get_outstream(print_stream),             # <<<<<<<<<<<<<<
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
*/
  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_print_fmtr = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":2902
 *                                                                                  *print_fmt_args, **print_fmt_kwargs)
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
 *     prnt_strct.disp_freq = <int64_t> int(print_freq)             # <<<<<<<<<<<<<<
 *     prnt_strct.max_iter = limits.max_iter
 *     prnt_strct.max_time = limits.max_time
*/
  __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_v_print_freq); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_9 = __Pyx_PyLong_As_int64_t(__pyx_t_12); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_prnt_strct.disp_freq = ((int64_t)__pyx_t_9);

  /* "H2MM_C.pyx":2903
 *     cdef int (*ptr_print_func)(int64_t,h2mm_mod*,h2mm_mod*,h2mm_mod*,double,double,void*) noexcept with gil
 *     prnt_strct.disp_freq = <int64_t> int(print_freq)
 *     prnt_strct.max_iter = limits.max_iter             # <<<<<<<<<<<<<<
 *     prnt_strct.max_time = limits.max_time
 *     prnt_strct.formatter = <PyObject*> print_fmtr
*/
  __pyx_t_9 = __pyx_v_limits.max_iter;
  __pyx_v_prnt_strct.max_iter = __pyx_t_9;

  /* "H2MM_C.pyx":2904
 *     prnt_strct.disp_freq = <int64_t> int(print_freq)
 *     prnt_strct.max_iter = limits.max_iter
 *     prnt_strct.max_time = limits.max_time             # <<<<<<<<<<<<<<
 *     prnt_strct.formatter = <PyObject*> print_fmtr
 *     prnt_strct.func = NULL
*/
  __pyx_t_10 = __pyx_v_limits.max_time;
  __pyx_v_prnt_strct.max_time = __pyx_t_10;

  /* "H2MM_C.pyx":2905
 *     prnt_strct.max_iter = limits.max_iter
 *     prnt_strct.max_time = limits.max_time
 *     prnt_strct.formatter = <PyObject*> print_fmtr             # <<<<<<<<<<<<<<
 *     prnt_strct.func = NULL
 *     prnt_strct.args = NULL
*/
  __pyx_v_prnt_strct.formatter = ((PyObject *)__pyx_v_print_fmtr);

  /* "H2MM_C.pyx":2906
 *     prnt_strct.max_time = limits.max_time
 *     prnt_strct.formatter = <PyObject*> print_fmtr
 *     prnt_strct.func = NULL             # <<<<<<<<<<<<<<
 *     prnt_strct.args = NULL
 *     prnt_strct.kwargs = NULL
*/
  __pyx_v_prnt_strct.func = NULL;

  /* "H2MM_C.pyx":2907
 *     prnt_strct.formatter = <PyObject*> print_fmtr
 *     prnt_strct.func = NULL
 *     prnt_strct.args = NULL             # <<<<<<<<<<<<<<
 *     prnt_strct.kwargs = NULL
 *     prnt_strct.error = NULL
*/
  __pyx_v_prnt_strct.args = NULL;

  /* "H2MM_C.pyx":2908
 *     prnt_strct.func = NULL
 *     prnt_strct.args = NULL
 *     prnt_strct.kwargs = NULL             # <<<<<<<<<<<<<<
 *     prnt_strct.error = NULL
 *     ptr_print_func = NULL
*/
  __pyx_v_prnt_strct.kwargs = NULL;

  /* "H2MM_C.pyx":2909
 *     prnt_strct.args = NULL
 *     prnt_strct.kwargs = NULL
 *     prnt_strct.error = NULL             # <<<<<<<<<<<<<<
 *     ptr_print_func = NULL
 *     if print_func in print_strings:
*/
  __pyx_v_prnt_strct.error = NULL;

  /* "H2MM_C.pyx":2910
 *     prnt_strct.kwargs = NULL
 *     prnt_strct.error = NULL
 *     ptr_print_func = NULL             # <<<<<<<<<<<<<<
 *     if print_func in print_strings:
 *         if print_func == 'all':
*/
  __pyx_v_ptr_print_func = NULL;

  /* "H2MM_C.pyx":2911
 *     prnt_strct.error = NULL
 *     ptr_print_func = NULL
 *     if print_func in print_strings:             # <<<<<<<<<<<<<<
 *         if print_func == 'all':
 *             ptr_print_func = model_print_all
*/
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_print_func, __pyx_v_print_strings, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2911, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2912
 *     ptr_print_func = NULL
 *     if print_func in print_strings:
 *         if print_func == 'all':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_all
 *         elif print_func == 'diff':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_all, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2912, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2913
 *     if print_func in print_strings:
 *         if print_func == 'all':
 *             ptr_print_func = model_print_all             # <<<<<<<<<<<<<<
 *         elif print_func == 'diff':
 *             ptr_print_func = model_print_diff
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_all;

      /* "H2MM_C.pyx":2912
 *     ptr_print_func = NULL
 *     if print_func in print_strings:
 *         if print_func == 'all':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_all
 *         elif print_func == 'diff':
*/
      goto __pyx_L9;
    }

    /* "H2MM_C.pyx":2914
 *         if print_func == 'all':
 *             ptr_print_func = model_print_all
 *         elif print_func == 'diff':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_diff
 *         elif print_func == 'diff_time':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_diff, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2914, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2915
 *             ptr_print_func = model_print_all
 *         elif print_func == 'diff':
 *             ptr_print_func = model_print_diff             # <<<<<<<<<<<<<<
 *         elif print_func == 'diff_time':
 *             ptr_print_func = model_print_diff_time
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_diff;

      /* "H2MM_C.pyx":2914
 *         if print_func == 'all':
 *             ptr_print_func = model_print_all
 *         elif print_func == 'diff':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_diff
 *         elif print_func == 'diff_time':
*/
      goto __pyx_L9;
    }

    /* "H2MM_C.pyx":2916
 *         elif print_func == 'diff':
 *             ptr_print_func = model_print_diff
 *         elif print_func == 'diff_time':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_diff_time
 *         elif print_func == 'comp':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_diff_time, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2916, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2917
 *             ptr_print_func = model_print_diff
 *         elif print_func == 'diff_time':
 *             ptr_print_func = model_print_diff_time             # <<<<<<<<<<<<<<
 *         elif print_func == 'comp':
 *             ptr_print_func = model_print_comp
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_diff_time;

      /* "H2MM_C.pyx":2916
 *         elif print_func == 'diff':
 *             ptr_print_func = model_print_diff
 *         elif print_func == 'diff_time':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_diff_time
 *         elif print_func == 'comp':
*/
      goto __pyx_L9;
    }

    /* "H2MM_C.pyx":2918
 *         elif print_func == 'diff_time':
 *             ptr_print_func = model_print_diff_time
 *         elif print_func == 'comp':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_comp
 *         elif print_func == 'comp_time':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_comp, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2918, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2919
 *             ptr_print_func = model_print_diff_time
 *         elif print_func == 'comp':
 *             ptr_print_func = model_print_comp             # <<<<<<<<<<<<<<
 *         elif print_func == 'comp_time':
 *             ptr_print_func = model_print_comp_time
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_comp;

      /* "H2MM_C.pyx":2918
 *         elif print_func == 'diff_time':
 *             ptr_print_func = model_print_diff_time
 *         elif print_func == 'comp':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_comp
 *         elif print_func == 'comp_time':
*/
      goto __pyx_L9;
    }

    /* "H2MM_C.pyx":2920
 *         elif print_func == 'comp':
 *             ptr_print_func = model_print_comp
 *         elif print_func == 'comp_time':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_comp_time
 *         elif print_func == 'iter':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_comp_time, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2920, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2921
 *             ptr_print_func = model_print_comp
 *         elif print_func == 'comp_time':
 *             ptr_print_func = model_print_comp_time             # <<<<<<<<<<<<<<
 *         elif print_func == 'iter':
 *             ptr_print_func = model_print_iter
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_comp_time;

      /* "H2MM_C.pyx":2920
 *         elif print_func == 'comp':
 *             ptr_print_func = model_print_comp
 *         elif print_func == 'comp_time':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_comp_time
 *         elif print_func == 'iter':
*/
      goto __pyx_L9;
    }

    /* "H2MM_C.pyx":2922
 *         elif print_func == 'comp_time':
 *             ptr_print_func = model_print_comp_time
 *         elif print_func == 'iter':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_iter
 *     elif callable(print_func):
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_print_func, __pyx_mstate_global->__pyx_n_u_iter, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2922, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2923
 *             ptr_print_func = model_print_comp_time
 *         elif print_func == 'iter':
 *             ptr_print_func = model_print_iter             # <<<<<<<<<<<<<<
 *     elif callable(print_func):
 *         prnt_strct.func = <PyObject*> print_func
*/
      __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_iter;

      /* "H2MM_C.pyx":2922
 *         elif print_func == 'comp_time':
 *             ptr_print_func = model_print_comp_time
 *         elif print_func == 'iter':             # <<<<<<<<<<<<<<
 *             ptr_print_func = model_print_iter
 *     elif callable(print_func):
*/
    }
    __pyx_L9:;

    /* "H2MM_C.pyx":2911
 *     prnt_strct.error = NULL
 *     ptr_print_func = NULL
 *     if print_func in print_strings:             # <<<<<<<<<<<<<<
 *         if print_func == 'all':
 *             ptr_print_func = model_print_all
*/
    goto __pyx_L8;
  }

  /* "H2MM_C.pyx":2924
 *         elif print_func == 'iter':
 *             ptr_print_func = model_print_iter
 *     elif callable(print_func):             # <<<<<<<<<<<<<<
 *         prnt_strct.func = <PyObject*> print_func
 *         prnt_strct.args = <PyObject*> print_args
*/
  __pyx_t_7 = __Pyx_PyCallable_Check(__pyx_v_print_func); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 2924, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2925
 *             ptr_print_func = model_print_iter
 *     elif callable(print_func):
 *         prnt_strct.func = <PyObject*> print_func             # <<<<<<<<<<<<<<
 *         prnt_strct.args = <PyObject*> print_args
 *         prnt_strct.kwargs = <PyObject*> print_kwargs
*/
    __pyx_v_prnt_strct.func = ((PyObject *)__pyx_v_print_func);

    /* "H2MM_C.pyx":2926
 *     elif callable(print_func):
 *         prnt_strct.func = <PyObject*> print_func
 *         prnt_strct.args = <PyObject*> print_args             # <<<<<<<<<<<<<<
 *         prnt_strct.kwargs = <PyObject*> print_kwargs
 *         ptr_print_func = model_print_call
*/
    __pyx_v_prnt_strct.args = ((PyObject *)__pyx_v_print_args);

    /* "H2MM_C.pyx":2927
 *         prnt_strct.func = <PyObject*> print_func
 *         prnt_strct.args = <PyObject*> print_args
 *         prnt_strct.kwargs = <PyObject*> print_kwargs             # <<<<<<<<<<<<<<
 *         ptr_print_func = model_print_call
 *     ########################## process bounds inputs ##########################
*/
    __pyx_v_prnt_strct.kwargs = ((PyObject *)__pyx_v_print_kwargs);

    /* "H2MM_C.pyx":2928
 *         prnt_strct.args = <PyObject*> print_args
 *         prnt_strct.kwargs = <PyObject*> print_kwargs
 *         ptr_print_func = model_print_call             # <<<<<<<<<<<<<<
 *     ########################## process bounds inputs ##########################
 *     if bounds_func not in (None, 'none', 'minmax', 'revert', 'revert_old', 'revert-old') and not callable(bounds_func):
*/
    __pyx_v_ptr_print_func = __pyx_f_6H2MM_C_model_print_call;

    /* "H2MM_C.pyx":2924
 *         elif print_func == 'iter':
 *             ptr_print_func = model_print_iter
 *     elif callable(print_func):             # <<<<<<<<<<<<<<
 *         prnt_strct.func = <PyObject*> print_func
 *         prnt_strct.args = <PyObject*> print_args
*/
  }
  __pyx_L8:;

  /* "H2MM_C.pyx":2930
 *         ptr_print_func = model_print_call
 *     ########################## process bounds inputs ##########################
 *     if bounds_func not in (None, 'none', 'minmax', 'revert', 'revert_old', 'revert-old') and not callable(bounds_func):             # <<<<<<<<<<<<<<
 *         raise ValueError("bounds_func must be None, 'minmax', 'revert', or 'revert_old', or or callable")
 *     cdef int (*bound_func)(h2mm_mod*, h2mm_mod*, h2mm_mod*, double, lm* ,void*) noexcept with gil
*/
  __Pyx_INCREF(__pyx_v_bounds_func);
  __pyx_t_12 = __pyx_v_bounds_func;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2930, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_11 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_none, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_11 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_minmax, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_11 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_revert, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_11 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_revert_old, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_11 = __pyx_t_2;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_revert_old_2, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2930, __pyx_L1_error)
  __pyx_t_11 = __pyx_t_2;
  __pyx_L13_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_2 = __pyx_t_11;
  if (__pyx_t_2) {
  } else {
    __pyx_t_7 = __pyx_t_2;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_bounds_func); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2930, __pyx_L1_error)
  __pyx_t_11 = (!__pyx_t_2);
  __pyx_t_7 = __pyx_t_11;
  __pyx_L11_bool_binop_done:;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":2931
 *     ########################## process bounds inputs ##########################
 *     if bounds_func not in (None, 'none', 'minmax', 'revert', 'revert_old', 'revert-old') and not callable(bounds_func):
 *         raise ValueError("bounds_func must be None, 'minmax', 'revert', or 'revert_old', or or callable")             # <<<<<<<<<<<<<<
 *     cdef int (*bound_func)(h2mm_mod*, h2mm_mod*, h2mm_mod*, double, lm* ,void*) noexcept with gil
 *     cdef _h2mm_lims bnds
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_bounds_func_must_be_None_minmax};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 2931, __pyx_L1_error)

    /* "H2MM_C.pyx":2930
 *         ptr_print_func = model_print_call
 *     ########################## process bounds inputs ##########################
 *     if bounds_func not in (None, 'none', 'minmax', 'revert', 'revert_old', 'revert-old') and not callable(bounds_func):             # <<<<<<<<<<<<<<
 *         raise ValueError("bounds_func must be None, 'minmax', 'revert', or 'revert_old', or or callable")
 *     cdef int (*bound_func)(h2mm_mod*, h2mm_mod*, h2mm_mod*, double, lm* ,void*) noexcept with gil
*/
  }

  /* "H2MM_C.pyx":2935
 *     cdef _h2mm_lims bnds
 *     cdef BoundStruct bound
 *     cdef void *bnd_ptr = NULL             # <<<<<<<<<<<<<<
 *     bound_func = NULL
 *     bound.args = NULL
*/
  __pyx_v_bnd_ptr = NULL;

  /* "H2MM_C.pyx":2936
 *     cdef BoundStruct bound
 *     cdef void *bnd_ptr = NULL
 *     bound_func = NULL             # <<<<<<<<<<<<<<
 *     bound.args = NULL
 *     bound.kwargs = NULL
*/
  __pyx_v_bound_func = NULL;

  /* "H2MM_C.pyx":2937
 *     cdef void *bnd_ptr = NULL
 *     bound_func = NULL
 *     bound.args = NULL             # <<<<<<<<<<<<<<
 *     bound.kwargs = NULL
 *     bound.error = NULL
*/
  __pyx_v_bound.args = NULL;

  /* "H2MM_C.pyx":2938
 *     bound_func = NULL
 *     bound.args = NULL
 *     bound.kwargs = NULL             # <<<<<<<<<<<<<<
 *     bound.error = NULL
 *     if bounds_func in (None, 'none'):
*/
  __pyx_v_bound.kwargs = NULL;

  /* "H2MM_C.pyx":2939
 *     bound.args = NULL
 *     bound.kwargs = NULL
 *     bound.error = NULL             # <<<<<<<<<<<<<<
 *     if bounds_func in (None, 'none'):
 *         bound_func = limit_check_only
*/
  __pyx_v_bound.error = NULL;

  /* "H2MM_C.pyx":2940
 *     bound.kwargs = NULL
 *     bound.error = NULL
 *     if bounds_func in (None, 'none'):             # <<<<<<<<<<<<<<
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
*/
  __Pyx_INCREF(__pyx_v_bounds_func);
  __pyx_t_12 = __pyx_v_bounds_func;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2940, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_11) {
  } else {
    __pyx_t_7 = __pyx_t_11;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_none, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2940, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_11;
  __pyx_L20_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_11 = __pyx_t_7;
  if (__pyx_t_11) {

    /* "H2MM_C.pyx":2941
 *     bound.error = NULL
 *     if bounds_func in (None, 'none'):
 *         bound_func = limit_check_only             # <<<<<<<<<<<<<<
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
 *         if bounds_func == 'minmax':
*/
    __pyx_v_bound_func = limit_check_only;

    /* "H2MM_C.pyx":2940
 *     bound.kwargs = NULL
 *     bound.error = NULL
 *     if bounds_func in (None, 'none'):             # <<<<<<<<<<<<<<
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
*/
  }

  /* "H2MM_C.pyx":2942
 *     if bounds_func in (None, 'none'):
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):             # <<<<<<<<<<<<<<
 *         if bounds_func == 'minmax':
 *             bound_func = limit_minmax
*/
  __Pyx_INCREF(__pyx_v_bounds_func);
  __pyx_t_12 = __pyx_v_bounds_func;
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_minmax, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2942, __pyx_L1_error)
  if (!__pyx_t_7) {
  } else {
    __pyx_t_11 = __pyx_t_7;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_revert, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2942, __pyx_L1_error)
  if (!__pyx_t_7) {
  } else {
    __pyx_t_11 = __pyx_t_7;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_revert_old, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2942, __pyx_L1_error)
  if (!__pyx_t_7) {
  } else {
    __pyx_t_11 = __pyx_t_7;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_revert_old_2, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2942, __pyx_L1_error)
  __pyx_t_11 = __pyx_t_7;
  __pyx_L23_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_7 = __pyx_t_11;
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2943
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
 *         if bounds_func == 'minmax':             # <<<<<<<<<<<<<<
 *             bound_func = limit_minmax
 *         elif bounds_func == 'revert':
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_bounds_func, __pyx_mstate_global->__pyx_n_u_minmax, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2943, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2944
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
 *         if bounds_func == 'minmax':
 *             bound_func = limit_minmax             # <<<<<<<<<<<<<<
 *         elif bounds_func == 'revert':
 *             bound_func = limit_revert
*/
      __pyx_v_bound_func = limit_minmax;

      /* "H2MM_C.pyx":2943
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):
 *         if bounds_func == 'minmax':             # <<<<<<<<<<<<<<
 *             bound_func = limit_minmax
 *         elif bounds_func == 'revert':
*/
      goto __pyx_L27;
    }

    /* "H2MM_C.pyx":2945
 *         if bounds_func == 'minmax':
 *             bound_func = limit_minmax
 *         elif bounds_func == 'revert':             # <<<<<<<<<<<<<<
 *             bound_func = limit_revert
 *         elif bounds_func in ('revert_old', 'revert-old'):
*/
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_bounds_func, __pyx_mstate_global->__pyx_n_u_revert, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2945, __pyx_L1_error)
    if (__pyx_t_7) {

      /* "H2MM_C.pyx":2946
 *             bound_func = limit_minmax
 *         elif bounds_func == 'revert':
 *             bound_func = limit_revert             # <<<<<<<<<<<<<<
 *         elif bounds_func in ('revert_old', 'revert-old'):
 *             bound_func = limit_revert_old
*/
      __pyx_v_bound_func = limit_revert;

      /* "H2MM_C.pyx":2945
 *         if bounds_func == 'minmax':
 *             bound_func = limit_minmax
 *         elif bounds_func == 'revert':             # <<<<<<<<<<<<<<
 *             bound_func = limit_revert
 *         elif bounds_func in ('revert_old', 'revert-old'):
*/
      goto __pyx_L27;
    }

    /* "H2MM_C.pyx":2947
 *         elif bounds_func == 'revert':
 *             bound_func = limit_revert
 *         elif bounds_func in ('revert_old', 'revert-old'):             # <<<<<<<<<<<<<<
 *             bound_func = limit_revert_old
 *         if not isinstance(bounds, h2mm_limits):
*/
    __Pyx_INCREF(__pyx_v_bounds_func);
    __pyx_t_12 = __pyx_v_bounds_func;
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_revert_old, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2947, __pyx_L1_error)
    if (!__pyx_t_11) {
    } else {
      __pyx_t_7 = __pyx_t_11;
      goto __pyx_L28_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_revert_old_2, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 2947, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_11;
    __pyx_L28_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_11 = __pyx_t_7;
    if (__pyx_t_11) {

      /* "H2MM_C.pyx":2948
 *             bound_func = limit_revert
 *         elif bounds_func in ('revert_old', 'revert-old'):
 *             bound_func = limit_revert_old             # <<<<<<<<<<<<<<
 *         if not isinstance(bounds, h2mm_limits):
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")
*/
      __pyx_v_bound_func = limit_revert_old;

      /* "H2MM_C.pyx":2947
 *         elif bounds_func == 'revert':
 *             bound_func = limit_revert
 *         elif bounds_func in ('revert_old', 'revert-old'):             # <<<<<<<<<<<<<<
 *             bound_func = limit_revert_old
 *         if not isinstance(bounds, h2mm_limits):
*/
    }
    __pyx_L27:;

    /* "H2MM_C.pyx":2949
 *         elif bounds_func in ('revert_old', 'revert-old'):
 *             bound_func = limit_revert_old
 *         if not isinstance(bounds, h2mm_limits):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")
 *         bnds = bounds._make_model(model)
*/
    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_h2mm_limits); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = PyObject_IsInstance(__pyx_v_bounds, __pyx_t_12); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 2949, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_7 = (!__pyx_t_11);
    if (unlikely(__pyx_t_7)) {

      /* "H2MM_C.pyx":2950
 *             bound_func = limit_revert_old
 *         if not isinstance(bounds, h2mm_limits):
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")             # <<<<<<<<<<<<<<
 *         bnds = bounds._make_model(model)
 *         bnd_ptr = <void*> &bnds.limits
*/
      __pyx_t_4 = NULL;
      __pyx_t_8 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_bounds)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_standard_bounding_styles_require, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_1};
        __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2950, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __Pyx_Raise(__pyx_t_12, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(0, 2950, __pyx_L1_error)

      /* "H2MM_C.pyx":2949
 *         elif bounds_func in ('revert_old', 'revert-old'):
 *             bound_func = limit_revert_old
 *         if not isinstance(bounds, h2mm_limits):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")
 *         bnds = bounds._make_model(model)
*/
    }

    /* "H2MM_C.pyx":2951
 *         if not isinstance(bounds, h2mm_limits):
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")
 *         bnds = bounds._make_model(model)             # <<<<<<<<<<<<<<
 *         bnd_ptr = <void*> &bnds.limits
 *     elif callable(bounds_func):
*/
    __pyx_t_1 = __pyx_v_bounds;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_model)};
      __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_make_model_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_mstate_global->__pyx_ptype_6H2MM_C__h2mm_lims))))) __PYX_ERR(0, 2951, __pyx_L1_error)
    __pyx_v_bnds = ((struct __pyx_obj_6H2MM_C__h2mm_lims *)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":2952
 *             raise TypeError(f"standard bounding styles requires bounds argument to be of type h2mm_limits, not {type(bounds)}")
 *         bnds = bounds._make_model(model)
 *         bnd_ptr = <void*> &bnds.limits             # <<<<<<<<<<<<<<
 *     elif callable(bounds_func):
 *         bounds = tuple() if bounds is None else bounds
*/
    __pyx_v_bnd_ptr = ((void *)(&__pyx_v_bnds->limits));

    /* "H2MM_C.pyx":2942
 *     if bounds_func in (None, 'none'):
 *         bound_func = limit_check_only
 *     if bounds_func in ('minmax', 'revert', 'revert_old', 'revert-old'):             # <<<<<<<<<<<<<<
 *         if bounds_func == 'minmax':
 *             bound_func = limit_minmax
*/
    goto __pyx_L22;
  }

  /* "H2MM_C.pyx":2953
 *         bnds = bounds._make_model(model)
 *         bnd_ptr = <void*> &bnds.limits
 *     elif callable(bounds_func):             # <<<<<<<<<<<<<<
 *         bounds = tuple() if bounds is None else bounds
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )
*/
  __pyx_t_7 = __Pyx_PyCallable_Check(__pyx_v_bounds_func); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 2953, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":2954
 *         bnd_ptr = <void*> &bnds.limits
 *     elif callable(bounds_func):
 *         bounds = tuple() if bounds is None else bounds             # <<<<<<<<<<<<<<
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )
 *         bound_func = cy_limit
*/
    __pyx_t_7 = (__pyx_v_bounds == Py_None);
    if (__pyx_t_7) {
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2954, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_12 = __pyx_t_1;
      __pyx_t_1 = 0;
    } else {
      __Pyx_INCREF(__pyx_v_bounds);
      __pyx_t_12 = __pyx_v_bounds;
    }
    __Pyx_DECREF_SET(__pyx_v_bounds, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":2955
 *     elif callable(bounds_func):
 *         bounds = tuple() if bounds is None else bounds
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )             # <<<<<<<<<<<<<<
 *         bound_func = cy_limit
 *         bound.func = <PyObject*> bounds_func
*/
    __pyx_t_7 = PyTuple_Check(__pyx_v_bounds); 
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_v_bounds);
      __pyx_t_12 = __pyx_v_bounds;
    } else {
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2955, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_bounds);
      __Pyx_GIVEREF(__pyx_v_bounds);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bounds) != (0)) __PYX_ERR(0, 2955, __pyx_L1_error);
      __pyx_t_12 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_bounds, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":2956
 *         bounds = tuple() if bounds is None else bounds
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )
 *         bound_func = cy_limit             # <<<<<<<<<<<<<<
 *         bound.func = <PyObject*> bounds_func
 *         bound.args = <PyObject*> bounds
*/
    __pyx_v_bound_func = __pyx_f_6H2MM_C_cy_limit;

    /* "H2MM_C.pyx":2957
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )
 *         bound_func = cy_limit
 *         bound.func = <PyObject*> bounds_func             # <<<<<<<<<<<<<<
 *         bound.args = <PyObject*> bounds
 *         bound.kwargs = <PyObject*> bounds_kwargs
*/
    __pyx_v_bound.func = ((PyObject *)__pyx_v_bounds_func);

    /* "H2MM_C.pyx":2958
 *         bound_func = cy_limit
 *         bound.func = <PyObject*> bounds_func
 *         bound.args = <PyObject*> bounds             # <<<<<<<<<<<<<<
 *         bound.kwargs = <PyObject*> bounds_kwargs
 *         bnd_ptr = <void*> &bound
*/
    __pyx_v_bound.args = ((PyObject *)__pyx_v_bounds);

    /* "H2MM_C.pyx":2959
 *         bound.func = <PyObject*> bounds_func
 *         bound.args = <PyObject*> bounds
 *         bound.kwargs = <PyObject*> bounds_kwargs             # <<<<<<<<<<<<<<
 *         bnd_ptr = <void*> &bound
 *     ############################### cast bursts ###############################
*/
    __pyx_v_bound.kwargs = ((PyObject *)__pyx_v_bounds_kwargs);

    /* "H2MM_C.pyx":2960
 *         bound.args = <PyObject*> bounds
 *         bound.kwargs = <PyObject*> bounds_kwargs
 *         bnd_ptr = <void*> &bound             # <<<<<<<<<<<<<<
 *     ############################### cast bursts ###############################
 *     # this is last because this requires allocating the most arrays
*/
    __pyx_v_bnd_ptr = ((void *)(&__pyx_v_bound));

    /* "H2MM_C.pyx":2953
 *         bnds = bounds._make_model(model)
 *         bnd_ptr = <void*> &bnds.limits
 *     elif callable(bounds_func):             # <<<<<<<<<<<<<<
 *         bounds = tuple() if bounds is None else bounds
 *         bounds = bounds if isinstance(bounds, tuple) else (bounds, )
*/
  }
  __pyx_L22:;

  /* "H2MM_C.pyx":2964
 *     # this is last because this requires allocating the most arrays
 *     # (reduces number of frees on errors before this code)
 *     cdef bint single = False             # <<<<<<<<<<<<<<
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
*/
  __pyx_v_single = 0;

  /* "H2MM_C.pyx":2965
 *     # (reduces number of frees on errors before this code)
 *     cdef bint single = False
 *     cdef int64_t nbursts = 0             # <<<<<<<<<<<<<<
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
*/
  __pyx_v_nbursts = 0;

  /* "H2MM_C.pyx":2966
 *     cdef bint single = False
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL             # <<<<<<<<<<<<<<
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
*/
  __pyx_v_burst_sizes = NULL;

  /* "H2MM_C.pyx":2967
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL             # <<<<<<<<<<<<<<
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
*/
  __pyx_v_idxs = NULL;

  /* "H2MM_C.pyx":2968
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL             # <<<<<<<<<<<<<<
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
*/
  __pyx_v_deltas = NULL;

  /* "H2MM_C.pyx":2969
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)             # <<<<<<<<<<<<<<
 *     if err is not None:
 *         raise err
*/
  __pyx_t_12 = __pyx_f_6H2MM_C_cast_indexes_times(__pyx_v_indexes, __pyx_v_times, (&__pyx_v_single), (&__pyx_v_nbursts), (&__pyx_v_burst_sizes), (&__pyx_v_idxs), (&__pyx_v_deltas)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (likely(__pyx_t_12 != Py_None)) {
    PyObject* sequence = __pyx_t_12;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2969, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2969, __pyx_L1_error)
  }
  __pyx_v_shape = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_indxs = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_err = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "H2MM_C.pyx":2970
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t nphot = 0
*/
  __pyx_t_7 = (__pyx_v_err != Py_None);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":2971
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
 *         raise err             # <<<<<<<<<<<<<<
 *     cdef int64_t nphot = 0
 *     for i in range(nbursts):
*/
    __Pyx_Raise(__pyx_v_err, 0, 0, 0);
    __PYX_ERR(0, 2971, __pyx_L1_error)

    /* "H2MM_C.pyx":2970
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t nphot = 0
*/
  }

  /* "H2MM_C.pyx":2972
 *     if err is not None:
 *         raise err
 *     cdef int64_t nphot = 0             # <<<<<<<<<<<<<<
 *     for i in range(nbursts):
 *         nphot += burst_sizes[i]
*/
  __pyx_v_nphot = 0;

  /* "H2MM_C.pyx":2973
 *         raise err
 *     cdef int64_t nphot = 0
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         nphot += burst_sizes[i]
 *     #################### allocate gamma arrays for output  ####################
*/
  __pyx_t_9 = __pyx_v_nbursts;
  __pyx_t_13 = __pyx_t_9;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "H2MM_C.pyx":2974
 *     cdef int64_t nphot = 0
 *     for i in range(nbursts):
 *         nphot += burst_sizes[i]             # <<<<<<<<<<<<<<
 *     #################### allocate gamma arrays for output  ####################
 *     cdef double **gamma_arr = NULL
*/
    __pyx_v_nphot = (__pyx_v_nphot + (__pyx_v_burst_sizes[__pyx_v_i]));
  }

  /* "H2MM_C.pyx":2976
 *         nphot += burst_sizes[i]
 *     #################### allocate gamma arrays for output  ####################
 *     cdef double **gamma_arr = NULL             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] gamma_out
 *     cdef int res
*/
  __pyx_v_gamma_arr = NULL;

  /* "H2MM_C.pyx":2979
 *     cdef cnp.ndarray[object, ndim=1] gamma_out
 *     cdef int res
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)
 *         if gamma_arr == NULL:
*/
  if (__pyx_v_gamma_) {

    /* "H2MM_C.pyx":2980
 *     cdef int res
 *     if gamma_:
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)             # <<<<<<<<<<<<<<
 *         if gamma_arr == NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
    __pyx_t_12 = ((PyObject *)__pyx_f_6H2MM_C_make_gamma_arrays(__pyx_v_nbursts, __pyx_v_mdl->model->nstate, __pyx_v_burst_sizes, (&__pyx_v_gamma_arr))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_gamma_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        }
        __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
      }
      __pyx_pybuffernd_gamma_out.diminfo[0].strides = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gamma_out.diminfo[0].shape = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2980, __pyx_L1_error)
    }
    __pyx_v_gamma_out = ((PyArrayObject *)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":2981
 *     if gamma_:
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)
 *         if gamma_arr == NULL:             # <<<<<<<<<<<<<<
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             raise MemoryError("insufficient memory for gamma")
*/
    __pyx_t_7 = (__pyx_v_gamma_arr == NULL);
    if (unlikely(__pyx_t_7)) {

      /* "H2MM_C.pyx":2982
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)
 *         if gamma_arr == NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *             raise MemoryError("insufficient memory for gamma")
 *     ######################## make model output arrays  ########################
*/
      __pyx_t_6 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2982, __pyx_L1_error)

      /* "H2MM_C.pyx":2983
 *         if gamma_arr == NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             raise MemoryError("insufficient memory for gamma")             # <<<<<<<<<<<<<<
 *     ######################## make model output arrays  ########################
 *     cdef int64_t out_arr_size = limits.max_iter + 2 - mdl.model.niter if opt_array_ else 1
*/
      __pyx_t_8 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_gamma};
        __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __Pyx_Raise(__pyx_t_12, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __PYX_ERR(0, 2983, __pyx_L1_error)

      /* "H2MM_C.pyx":2981
 *     if gamma_:
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)
 *         if gamma_arr == NULL:             # <<<<<<<<<<<<<<
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             raise MemoryError("insufficient memory for gamma")
*/
    }

    /* "H2MM_C.pyx":2979
 *     cdef cnp.ndarray[object, ndim=1] gamma_out
 *     cdef int res
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         gamma_out = make_gamma_arrays(nbursts, mdl.model.nstate, burst_sizes, &gamma_arr)
 *         if gamma_arr == NULL:
*/
  }

  /* "H2MM_C.pyx":2985
 *             raise MemoryError("insufficient memory for gamma")
 *     ######################## make model output arrays  ########################
 *     cdef int64_t out_arr_size = limits.max_iter + 2 - mdl.model.niter if opt_array_ else 1             # <<<<<<<<<<<<<<
 *     cdef h2mm_mod *out_arr = Py_allocate_models(out_arr_size, mdl.model.nstate, mdl.model.ndet, nphot)
 *     if out_arr == NULL:
*/
  __pyx_t_7 = (__pyx_v_opt_array_ != 0);
  if (__pyx_t_7) {
    __pyx_t_9 = ((__pyx_v_limits.max_iter + 2) - __pyx_v_mdl->model->niter);
  } else {
    __pyx_t_9 = 1;
  }
  __pyx_v_out_arr_size = __pyx_t_9;

  /* "H2MM_C.pyx":2986
 *     ######################## make model output arrays  ########################
 *     cdef int64_t out_arr_size = limits.max_iter + 2 - mdl.model.niter if opt_array_ else 1
 *     cdef h2mm_mod *out_arr = Py_allocate_models(out_arr_size, mdl.model.nstate, mdl.model.ndet, nphot)             # <<<<<<<<<<<<<<
 *     if out_arr == NULL:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
  __pyx_t_18 = __pyx_f_6H2MM_C_Py_allocate_models(__pyx_v_out_arr_size, __pyx_v_mdl->model->nstate, __pyx_v_mdl->model->ndet, __pyx_v_nphot); if (unlikely(__pyx_t_18 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 2986, __pyx_L1_error)
  __pyx_v_out_arr = __pyx_t_18;

  /* "H2MM_C.pyx":2987
 *     cdef int64_t out_arr_size = limits.max_iter + 2 - mdl.model.niter if opt_array_ else 1
 *     cdef h2mm_mod *out_arr = Py_allocate_models(out_arr_size, mdl.model.nstate, mdl.model.ndet, nphot)
 *     if out_arr == NULL:             # <<<<<<<<<<<<<<
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         PyMem_Free(gamma_arr)
*/
  __pyx_t_7 = (__pyx_v_out_arr == NULL);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":2988
 *     cdef h2mm_mod *out_arr = Py_allocate_models(out_arr_size, mdl.model.nstate, mdl.model.ndet, nphot)
 *     if out_arr == NULL:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *         PyMem_Free(gamma_arr)
 *         raise MemoryError("insufficient memory for h2mm_model output")
*/
    __pyx_t_6 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2988, __pyx_L1_error)

    /* "H2MM_C.pyx":2989
 *     if out_arr == NULL:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         PyMem_Free(gamma_arr)             # <<<<<<<<<<<<<<
 *         raise MemoryError("insufficient memory for h2mm_model output")
 *     ######################## perform h2mm optimization ########################
*/
    PyMem_Free(__pyx_v_gamma_arr);

    /* "H2MM_C.pyx":2990
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         PyMem_Free(gamma_arr)
 *         raise MemoryError("insufficient memory for h2mm_model output")             # <<<<<<<<<<<<<<
 *     ######################## perform h2mm optimization ########################
 *     with nogil:
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_h2mm_mod};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 2990, __pyx_L1_error)

    /* "H2MM_C.pyx":2987
 *     cdef int64_t out_arr_size = limits.max_iter + 2 - mdl.model.niter if opt_array_ else 1
 *     cdef h2mm_mod *out_arr = Py_allocate_models(out_arr_size, mdl.model.nstate, mdl.model.ndet, nphot)
 *     if out_arr == NULL:             # <<<<<<<<<<<<<<
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         PyMem_Free(gamma_arr)
*/
  }

  /* "H2MM_C.pyx":2992
 *         raise MemoryError("insufficient memory for h2mm_model output")
 *     ######################## perform h2mm optimization ########################
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if gamma_:
 *             if opt_array_:
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "H2MM_C.pyx":2993
 *     ######################## perform h2mm optimization ########################
 *     with nogil:
 *         if gamma_:             # <<<<<<<<<<<<<<
 *             if opt_array_:
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
*/
        if (__pyx_v_gamma_) {

          /* "H2MM_C.pyx":2994
 *     with nogil:
 *         if gamma_:
 *             if opt_array_:             # <<<<<<<<<<<<<<
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
*/
          __pyx_t_7 = (__pyx_v_opt_array_ != 0);
          if (__pyx_t_7) {

            /* "H2MM_C.pyx":2995
 *         if gamma_:
 *             if opt_array_:
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)             # <<<<<<<<<<<<<<
 *             else:
 *                 res =  h2mm_optimize_gamma(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
*/
            __pyx_v_res = h2mm_optimize_gamma_array(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_mdl->model, (&__pyx_v_out_arr), (&__pyx_v_gamma_arr), (&__pyx_v_limits), __pyx_v_bound_func, __pyx_v_bnd_ptr, __pyx_v_ptr_print_func, ((void *)(&__pyx_v_prnt_strct)));

            /* "H2MM_C.pyx":2994
 *     with nogil:
 *         if gamma_:
 *             if opt_array_:             # <<<<<<<<<<<<<<
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
*/
            goto __pyx_L41;
          }

          /* "H2MM_C.pyx":2997
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
 *                 res =  h2mm_optimize_gamma(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)             # <<<<<<<<<<<<<<
 *         else:
 *             if opt_array_:
*/
          /*else*/ {
            __pyx_v_res = h2mm_optimize_gamma(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_mdl->model, __pyx_v_out_arr, (&__pyx_v_gamma_arr), (&__pyx_v_limits), __pyx_v_bound_func, __pyx_v_bnd_ptr, __pyx_v_ptr_print_func, ((void *)(&__pyx_v_prnt_strct)));
          }
          __pyx_L41:;

          /* "H2MM_C.pyx":2993
 *     ######################## perform h2mm optimization ########################
 *     with nogil:
 *         if gamma_:             # <<<<<<<<<<<<<<
 *             if opt_array_:
 *                 res =  h2mm_optimize_gamma_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
*/
          goto __pyx_L40;
        }

        /* "H2MM_C.pyx":2999
 *                 res =  h2mm_optimize_gamma(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *         else:
 *             if opt_array_:             # <<<<<<<<<<<<<<
 *                 res =  h2mm_optimize_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
*/
        /*else*/ {
          __pyx_t_7 = (__pyx_v_opt_array_ != 0);
          if (__pyx_t_7) {

            /* "H2MM_C.pyx":3000
 *         else:
 *             if opt_array_:
 *                 res =  h2mm_optimize_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)             # <<<<<<<<<<<<<<
 *             else:
 *                 res =  h2mm_optimize(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
*/
            __pyx_v_res = h2mm_optimize_array(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_mdl->model, (&__pyx_v_out_arr), (&__pyx_v_limits), __pyx_v_bound_func, __pyx_v_bnd_ptr, __pyx_v_ptr_print_func, ((void *)(&__pyx_v_prnt_strct)));

            /* "H2MM_C.pyx":2999
 *                 res =  h2mm_optimize_gamma(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &gamma_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *         else:
 *             if opt_array_:             # <<<<<<<<<<<<<<
 *                 res =  h2mm_optimize_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
*/
            goto __pyx_L42;
          }

          /* "H2MM_C.pyx":3002
 *                 res =  h2mm_optimize_array(nbursts, burst_sizes, deltas, idxs, mdl.model, &out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *             else:
 *                 res =  h2mm_optimize(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)             # <<<<<<<<<<<<<<
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_arr is not NULL:
*/
          /*else*/ {
            __pyx_v_res = h2mm_optimize(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_mdl->model, __pyx_v_out_arr, (&__pyx_v_limits), __pyx_v_bound_func, __pyx_v_bnd_ptr, __pyx_v_ptr_print_func, ((void *)(&__pyx_v_prnt_strct)));
          }
          __pyx_L42:;
        }
        __pyx_L40:;
      }

      /* "H2MM_C.pyx":2992
 *         raise MemoryError("insufficient memory for h2mm_model output")
 *     ######################## perform h2mm optimization ########################
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if gamma_:
 *             if opt_array_:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L39;
        }
        __pyx_L39:;
      }
  }

  /* "H2MM_C.pyx":3003
 *             else:
 *                 res =  h2mm_optimize(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *     if gamma_arr is not NULL:
 *         PyMem_Free(gamma_arr)
*/
  __pyx_t_6 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3003, __pyx_L1_error)

  /* "H2MM_C.pyx":3004
 *                 res =  h2mm_optimize(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_arr is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(gamma_arr)
 *         gamma_arr = NULL
*/
  __pyx_t_7 = (__pyx_v_gamma_arr != NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3005
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_arr is not NULL:
 *         PyMem_Free(gamma_arr)             # <<<<<<<<<<<<<<
 *         gamma_arr = NULL
 *     ############################# Process output  #############################
*/
    PyMem_Free(__pyx_v_gamma_arr);

    /* "H2MM_C.pyx":3006
 *     if gamma_arr is not NULL:
 *         PyMem_Free(gamma_arr)
 *         gamma_arr = NULL             # <<<<<<<<<<<<<<
 *     ############################# Process output  #############################
 *     cdef int64_t nout = 0 if opt_array_ else 1
*/
    __pyx_v_gamma_arr = NULL;

    /* "H2MM_C.pyx":3004
 *                 res =  h2mm_optimize(nbursts, burst_sizes, deltas, idxs, mdl.model, out_arr, &limits, bound_func, bnd_ptr, ptr_print_func, <void*> &prnt_strct)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_arr is not NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(gamma_arr)
 *         gamma_arr = NULL
*/
  }

  /* "H2MM_C.pyx":3008
 *         gamma_arr = NULL
 *     ############################# Process output  #############################
 *     cdef int64_t nout = 0 if opt_array_ else 1             # <<<<<<<<<<<<<<
 *     cdef int64_t conv = -1
 *     cdef int64_t niter
*/
  __pyx_t_7 = (__pyx_v_opt_array_ != 0);
  if (__pyx_t_7) {
    __pyx_t_9 = 0;
  } else {
    __pyx_t_9 = 1;
  }
  __pyx_v_nout = __pyx_t_9;

  /* "H2MM_C.pyx":3009
 *     ############################# Process output  #############################
 *     cdef int64_t nout = 0 if opt_array_ else 1
 *     cdef int64_t conv = -1             # <<<<<<<<<<<<<<
 *     cdef int64_t niter
 *     if res > 0:
*/
  __pyx_v_conv = -1L;

  /* "H2MM_C.pyx":3011
 *     cdef int64_t conv = -1
 *     cdef int64_t niter
 *     if res > 0:             # <<<<<<<<<<<<<<
 *         if opt_array_ == 0:
 *             conv = out_arr[0].conv
*/
  __pyx_t_7 = (__pyx_v_res > 0);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3012
 *     cdef int64_t niter
 *     if res > 0:
 *         if opt_array_ == 0:             # <<<<<<<<<<<<<<
 *             conv = out_arr[0].conv
 *             niter = out_arr[0].niter
*/
    switch (__pyx_v_opt_array_) {
      case 0:

      /* "H2MM_C.pyx":3013
 *     if res > 0:
 *         if opt_array_ == 0:
 *             conv = out_arr[0].conv             # <<<<<<<<<<<<<<
 *             niter = out_arr[0].niter
 *         elif opt_array_ == 1:
*/
      __pyx_t_9 = (__pyx_v_out_arr[0]).conv;
      __pyx_v_conv = __pyx_t_9;

      /* "H2MM_C.pyx":3014
 *         if opt_array_ == 0:
 *             conv = out_arr[0].conv
 *             niter = out_arr[0].niter             # <<<<<<<<<<<<<<
 *         elif opt_array_ == 1:
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):
*/
      __pyx_t_9 = (__pyx_v_out_arr[0]).niter;
      __pyx_v_niter = __pyx_t_9;

      /* "H2MM_C.pyx":3012
 *     cdef int64_t niter
 *     if res > 0:
 *         if opt_array_ == 0:             # <<<<<<<<<<<<<<
 *             conv = out_arr[0].conv
 *             niter = out_arr[0].niter
*/
      break;
      case 1:

      /* "H2MM_C.pyx":3016
 *             niter = out_arr[0].niter
 *         elif opt_array_ == 1:
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):             # <<<<<<<<<<<<<<
 *                 nout += 1
 *             if nout == out_arr_size:
*/
      while (1) {
        __pyx_t_11 = (__pyx_v_nout < __pyx_v_out_arr_size);
        if (__pyx_t_11) {
        } else {
          __pyx_t_7 = __pyx_t_11;
          goto __pyx_L47_bool_binop_done;
        }
        __pyx_t_11 = (!(((__pyx_v_out_arr[__pyx_v_nout]).conv & CONVCODE_OUTPUT) != 0));
        __pyx_t_7 = __pyx_t_11;
        __pyx_L47_bool_binop_done:;
        if (!__pyx_t_7) break;

        /* "H2MM_C.pyx":3017
 *         elif opt_array_ == 1:
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):
 *                 nout += 1             # <<<<<<<<<<<<<<
 *             if nout == out_arr_size:
 *                 nout -= 1
*/
        __pyx_v_nout = (__pyx_v_nout + 1);
      }

      /* "H2MM_C.pyx":3018
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):
 *                 nout += 1
 *             if nout == out_arr_size:             # <<<<<<<<<<<<<<
 *                 nout -= 1
 *             conv = out_arr[nout].conv
*/
      __pyx_t_7 = (__pyx_v_nout == __pyx_v_out_arr_size);
      if (__pyx_t_7) {

        /* "H2MM_C.pyx":3019
 *                 nout += 1
 *             if nout == out_arr_size:
 *                 nout -= 1             # <<<<<<<<<<<<<<
 *             conv = out_arr[nout].conv
 *             niter = out_arr[nout].niter
*/
        __pyx_v_nout = (__pyx_v_nout - 1);

        /* "H2MM_C.pyx":3018
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):
 *                 nout += 1
 *             if nout == out_arr_size:             # <<<<<<<<<<<<<<
 *                 nout -= 1
 *             conv = out_arr[nout].conv
*/
      }

      /* "H2MM_C.pyx":3020
 *             if nout == out_arr_size:
 *                 nout -= 1
 *             conv = out_arr[nout].conv             # <<<<<<<<<<<<<<
 *             niter = out_arr[nout].niter
 *             nout += 1
*/
      __pyx_t_9 = (__pyx_v_out_arr[__pyx_v_nout]).conv;
      __pyx_v_conv = __pyx_t_9;

      /* "H2MM_C.pyx":3021
 *                 nout -= 1
 *             conv = out_arr[nout].conv
 *             niter = out_arr[nout].niter             # <<<<<<<<<<<<<<
 *             nout += 1
 *         elif opt_array_ == 2:
*/
      __pyx_t_9 = (__pyx_v_out_arr[__pyx_v_nout]).niter;
      __pyx_v_niter = __pyx_t_9;

      /* "H2MM_C.pyx":3022
 *             conv = out_arr[nout].conv
 *             niter = out_arr[nout].niter
 *             nout += 1             # <<<<<<<<<<<<<<
 *         elif opt_array_ == 2:
 *             while nout < out_arr_size and out_arr[nout].conv != 0:
*/
      __pyx_v_nout = (__pyx_v_nout + 1);

      /* "H2MM_C.pyx":3015
 *             conv = out_arr[0].conv
 *             niter = out_arr[0].niter
 *         elif opt_array_ == 1:             # <<<<<<<<<<<<<<
 *             while nout < out_arr_size and not (out_arr[nout].conv & CONVCODE_OUTPUT):
 *                 nout += 1
*/
      break;
      case 2:

      /* "H2MM_C.pyx":3024
 *             nout += 1
 *         elif opt_array_ == 2:
 *             while nout < out_arr_size and out_arr[nout].conv != 0:             # <<<<<<<<<<<<<<
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:
 *                     conv = out_arr[nout].conv
*/
      while (1) {
        __pyx_t_11 = (__pyx_v_nout < __pyx_v_out_arr_size);
        if (__pyx_t_11) {
        } else {
          __pyx_t_7 = __pyx_t_11;
          goto __pyx_L52_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_out_arr[__pyx_v_nout]).conv != 0);
        __pyx_t_7 = __pyx_t_11;
        __pyx_L52_bool_binop_done:;
        if (!__pyx_t_7) break;

        /* "H2MM_C.pyx":3025
 *         elif opt_array_ == 2:
 *             while nout < out_arr_size and out_arr[nout].conv != 0:
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *                     conv = out_arr[nout].conv
 *                     niter = out_arr[nout].niter
*/
        __pyx_t_7 = (((__pyx_v_out_arr[__pyx_v_nout]).conv & CONVCODE_OUTPUT) != 0);
        if (__pyx_t_7) {

          /* "H2MM_C.pyx":3026
 *             while nout < out_arr_size and out_arr[nout].conv != 0:
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:
 *                     conv = out_arr[nout].conv             # <<<<<<<<<<<<<<
 *                     niter = out_arr[nout].niter
 *                 nout += 1
*/
          __pyx_t_9 = (__pyx_v_out_arr[__pyx_v_nout]).conv;
          __pyx_v_conv = __pyx_t_9;

          /* "H2MM_C.pyx":3027
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:
 *                     conv = out_arr[nout].conv
 *                     niter = out_arr[nout].niter             # <<<<<<<<<<<<<<
 *                 nout += 1
 *         out = make_h2mm_out_arrays(nout, out_arr) # note error stored in out, should be impossible, but most likely problem is memory error
*/
          __pyx_t_9 = (__pyx_v_out_arr[__pyx_v_nout]).niter;
          __pyx_v_niter = __pyx_t_9;

          /* "H2MM_C.pyx":3025
 *         elif opt_array_ == 2:
 *             while nout < out_arr_size and out_arr[nout].conv != 0:
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:             # <<<<<<<<<<<<<<
 *                     conv = out_arr[nout].conv
 *                     niter = out_arr[nout].niter
*/
        }

        /* "H2MM_C.pyx":3028
 *                     conv = out_arr[nout].conv
 *                     niter = out_arr[nout].niter
 *                 nout += 1             # <<<<<<<<<<<<<<
 *         out = make_h2mm_out_arrays(nout, out_arr) # note error stored in out, should be impossible, but most likely problem is memory error
 *     Py_free_models(out_arr_size, out_arr)
*/
        __pyx_v_nout = (__pyx_v_nout + 1);
      }

      /* "H2MM_C.pyx":3023
 *             niter = out_arr[nout].niter
 *             nout += 1
 *         elif opt_array_ == 2:             # <<<<<<<<<<<<<<
 *             while nout < out_arr_size and out_arr[nout].conv != 0:
 *                 if out_arr[nout].conv & CONVCODE_OUTPUT:
*/
      break;
      default: break;
    }

    /* "H2MM_C.pyx":3029
 *                     niter = out_arr[nout].niter
 *                 nout += 1
 *         out = make_h2mm_out_arrays(nout, out_arr) # note error stored in out, should be impossible, but most likely problem is memory error             # <<<<<<<<<<<<<<
 *     Py_free_models(out_arr_size, out_arr)
 *     out_arr = NULL
*/
    __pyx_t_12 = ((PyObject *)__pyx_f_6H2MM_C_make_h2mm_out_arrays(__pyx_v_nout, __pyx_v_out_arr)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_v_out = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":3011
 *     cdef int64_t conv = -1
 *     cdef int64_t niter
 *     if res > 0:             # <<<<<<<<<<<<<<
 *         if opt_array_ == 0:
 *             conv = out_arr[0].conv
*/
  }

  /* "H2MM_C.pyx":3030
 *                 nout += 1
 *         out = make_h2mm_out_arrays(nout, out_arr) # note error stored in out, should be impossible, but most likely problem is memory error
 *     Py_free_models(out_arr_size, out_arr)             # <<<<<<<<<<<<<<
 *     out_arr = NULL
 *     ############################ check for errors  ############################
*/
  __pyx_t_6 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_out_arr_size, __pyx_v_out_arr); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L1_error)

  /* "H2MM_C.pyx":3031
 *         out = make_h2mm_out_arrays(nout, out_arr) # note error stored in out, should be impossible, but most likely problem is memory error
 *     Py_free_models(out_arr_size, out_arr)
 *     out_arr = NULL             # <<<<<<<<<<<<<<
 *     ############################ check for errors  ############################
 *     cdef object print_err = None
*/
  __pyx_v_out_arr = NULL;

  /* "H2MM_C.pyx":3033
 *     out_arr = NULL
 *     ############################ check for errors  ############################
 *     cdef object print_err = None             # <<<<<<<<<<<<<<
 *     if prnt_strct.error is not NULL:
 *         print_err = <object> prnt_strct.error
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_print_err = Py_None;

  /* "H2MM_C.pyx":3034
 *     ############################ check for errors  ############################
 *     cdef object print_err = None
 *     if prnt_strct.error is not NULL:             # <<<<<<<<<<<<<<
 *         print_err = <object> prnt_strct.error
 *         Py_DECREF(print_err)
*/
  __pyx_t_7 = (__pyx_v_prnt_strct.error != NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3035
 *     cdef object print_err = None
 *     if prnt_strct.error is not NULL:
 *         print_err = <object> prnt_strct.error             # <<<<<<<<<<<<<<
 *         Py_DECREF(print_err)
 *         prnt_strct.error = NULL
*/
    __pyx_t_12 = ((PyObject *)__pyx_v_prnt_strct.error);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_DECREF_SET(__pyx_v_print_err, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":3036
 *     if prnt_strct.error is not NULL:
 *         print_err = <object> prnt_strct.error
 *         Py_DECREF(print_err)             # <<<<<<<<<<<<<<
 *         prnt_strct.error = NULL
 *     cdef object bound_err = None
*/
    Py_DECREF(__pyx_v_print_err);

    /* "H2MM_C.pyx":3037
 *         print_err = <object> prnt_strct.error
 *         Py_DECREF(print_err)
 *         prnt_strct.error = NULL             # <<<<<<<<<<<<<<
 *     cdef object bound_err = None
 *     if bound.error is not NULL:
*/
    __pyx_v_prnt_strct.error = NULL;

    /* "H2MM_C.pyx":3034
 *     ############################ check for errors  ############################
 *     cdef object print_err = None
 *     if prnt_strct.error is not NULL:             # <<<<<<<<<<<<<<
 *         print_err = <object> prnt_strct.error
 *         Py_DECREF(print_err)
*/
  }

  /* "H2MM_C.pyx":3038
 *         Py_DECREF(print_err)
 *         prnt_strct.error = NULL
 *     cdef object bound_err = None             # <<<<<<<<<<<<<<
 *     if bound.error is not NULL:
 *         bound_err = <object> bound.error
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_bound_err = Py_None;

  /* "H2MM_C.pyx":3039
 *         prnt_strct.error = NULL
 *     cdef object bound_err = None
 *     if bound.error is not NULL:             # <<<<<<<<<<<<<<
 *         bound_err = <object> bound.error
 *         Py_DECREF(bound_err)
*/
  __pyx_t_7 = (__pyx_v_bound.error != NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3040
 *     cdef object bound_err = None
 *     if bound.error is not NULL:
 *         bound_err = <object> bound.error             # <<<<<<<<<<<<<<
 *         Py_DECREF(bound_err)
 *         bound.error = NULL
*/
    __pyx_t_12 = ((PyObject *)__pyx_v_bound.error);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_DECREF_SET(__pyx_v_bound_err, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":3041
 *     if bound.error is not NULL:
 *         bound_err = <object> bound.error
 *         Py_DECREF(bound_err)             # <<<<<<<<<<<<<<
 *         bound.error = NULL
 *     if res == -1:
*/
    Py_DECREF(__pyx_v_bound_err);

    /* "H2MM_C.pyx":3042
 *         bound_err = <object> bound.error
 *         Py_DECREF(bound_err)
 *         bound.error = NULL             # <<<<<<<<<<<<<<
 *     if res == -1:
 *         raise ValueError('Bad pointer, check cython code')
*/
    __pyx_v_bound.error = NULL;

    /* "H2MM_C.pyx":3039
 *         prnt_strct.error = NULL
 *     cdef object bound_err = None
 *     if bound.error is not NULL:             # <<<<<<<<<<<<<<
 *         bound_err = <object> bound.error
 *         Py_DECREF(bound_err)
*/
  }

  /* "H2MM_C.pyx":3043
 *         Py_DECREF(bound_err)
 *         bound.error = NULL
 *     if res == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Bad pointer, check cython code')
 *     elif res == -2:
*/
  __pyx_t_7 = (__pyx_v_res == -1L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3044
 *         bound.error = NULL
 *     if res == -1:
 *         raise ValueError('Bad pointer, check cython code')             # <<<<<<<<<<<<<<
 *     elif res == -2:
 *         raise ValueError('Too many photon streams in data for H2MM model')
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Bad_pointer_check_cython_code};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3044, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 3044, __pyx_L1_error)

    /* "H2MM_C.pyx":3043
 *         Py_DECREF(bound_err)
 *         bound.error = NULL
 *     if res == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Bad pointer, check cython code')
 *     elif res == -2:
*/
  }

  /* "H2MM_C.pyx":3045
 *     if res == -1:
 *         raise ValueError('Bad pointer, check cython code')
 *     elif res == -2:             # <<<<<<<<<<<<<<
 *         raise ValueError('Too many photon streams in data for H2MM model')
 *     elif res == -3:
*/
  __pyx_t_7 = (__pyx_v_res == -2L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3046
 *         raise ValueError('Bad pointer, check cython code')
 *     elif res == -2:
 *         raise ValueError('Too many photon streams in data for H2MM model')             # <<<<<<<<<<<<<<
 *     elif res == -3:
 *         raise ValueError('limits function must return model of same shape as inintial model')
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Too_many_photon_streams_in_data};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 3046, __pyx_L1_error)

    /* "H2MM_C.pyx":3045
 *     if res == -1:
 *         raise ValueError('Bad pointer, check cython code')
 *     elif res == -2:             # <<<<<<<<<<<<<<
 *         raise ValueError('Too many photon streams in data for H2MM model')
 *     elif res == -3:
*/
  }

  /* "H2MM_C.pyx":3047
 *     elif res == -2:
 *         raise ValueError('Too many photon streams in data for H2MM model')
 *     elif res == -3:             # <<<<<<<<<<<<<<
 *         raise ValueError('limits function must return model of same shape as inintial model')
 *     elif res == -4:
*/
  __pyx_t_7 = (__pyx_v_res == -3L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3048
 *         raise ValueError('Too many photon streams in data for H2MM model')
 *     elif res == -3:
 *         raise ValueError('limits function must return model of same shape as inintial model')             # <<<<<<<<<<<<<<
 *     elif res == -4:
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_limits_function_must_return_mode};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3048, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 3048, __pyx_L1_error)

    /* "H2MM_C.pyx":3047
 *     elif res == -2:
 *         raise ValueError('Too many photon streams in data for H2MM model')
 *     elif res == -3:             # <<<<<<<<<<<<<<
 *         raise ValueError('limits function must return model of same shape as inintial model')
 *     elif res == -4:
*/
  }

  /* "H2MM_C.pyx":3049
 *     elif res == -3:
 *         raise ValueError('limits function must return model of same shape as inintial model')
 *     elif res == -4:             # <<<<<<<<<<<<<<
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
 *     elif res == -5:
*/
  __pyx_t_7 = (__pyx_v_res == -4L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3050
 *         raise ValueError('limits function must return model of same shape as inintial model')
 *     elif res == -4:
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')             # <<<<<<<<<<<<<<
 *     elif res == -5:
 *         raise bound_err
*/
    __pyx_t_8 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_limits_function_must_return_bool};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 3050, __pyx_L1_error)

    /* "H2MM_C.pyx":3049
 *     elif res == -3:
 *         raise ValueError('limits function must return model of same shape as inintial model')
 *     elif res == -4:             # <<<<<<<<<<<<<<
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
 *     elif res == -5:
*/
  }

  /* "H2MM_C.pyx":3051
 *     elif res == -4:
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
 *     elif res == -5:             # <<<<<<<<<<<<<<
 *         raise bound_err
 *     elif res == -6:
*/
  __pyx_t_7 = (__pyx_v_res == -5L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3052
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
 *     elif res == -5:
 *         raise bound_err             # <<<<<<<<<<<<<<
 *     elif res == -6:
 *         raise print_err
*/
    __Pyx_Raise(__pyx_v_bound_err, 0, 0, 0);
    __PYX_ERR(0, 3052, __pyx_L1_error)

    /* "H2MM_C.pyx":3051
 *     elif res == -4:
 *         raise TypeError('limits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])')
 *     elif res == -5:             # <<<<<<<<<<<<<<
 *         raise bound_err
 *     elif res == -6:
*/
  }

  /* "H2MM_C.pyx":3053
 *     elif res == -5:
 *         raise bound_err
 *     elif res == -6:             # <<<<<<<<<<<<<<
 *         raise print_err
 *     elif res < -6:
*/
  __pyx_t_7 = (__pyx_v_res == -6L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3054
 *         raise bound_err
 *     elif res == -6:
 *         raise print_err             # <<<<<<<<<<<<<<
 *     elif res < -6:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
*/
    __Pyx_Raise(__pyx_v_print_err, 0, 0, 0);
    __PYX_ERR(0, 3054, __pyx_L1_error)

    /* "H2MM_C.pyx":3053
 *     elif res == -5:
 *         raise bound_err
 *     elif res == -6:             # <<<<<<<<<<<<<<
 *         raise print_err
 *     elif res < -6:
*/
  }

  /* "H2MM_C.pyx":3055
 *     elif res == -6:
 *         raise print_err
 *     elif res < -6:             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     # next error should be essentially imposible
*/
  __pyx_t_7 = (__pyx_v_res < -6L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3056
 *         raise print_err
 *     elif res < -6:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')             # <<<<<<<<<<<<<<
 *     # next error should be essentially imposible
 *     for i in range(out.shape[0]):
*/
    __pyx_t_8 = NULL;
    __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_res, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyUnicode_From_int64_t(__pyx_v_conv, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u_Unknown_error_check_C_code_raise;
    __pyx_t_19[1] = __pyx_t_4;
    __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u_conv;
    __pyx_t_19[3] = __pyx_t_1;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_19, 4, 56 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127);
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3056, __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_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_3};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __Pyx_Raise(__pyx_t_12, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __PYX_ERR(0, 3056, __pyx_L1_error)

    /* "H2MM_C.pyx":3055
 *     elif res == -6:
 *         raise print_err
 *     elif res < -6:             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     # next error should be essentially imposible
*/
  }

  /* "H2MM_C.pyx":3058
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     # next error should be essentially imposible
 *     for i in range(out.shape[0]):             # <<<<<<<<<<<<<<
 *         if isinstance(out[i], Exception):
 *             raise out[i]
*/
  if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3058, __pyx_L1_error) }
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_20 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_20 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_21 = __pyx_t_20;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_21; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "H2MM_C.pyx":3059
 *     # next error should be essentially imposible
 *     for i in range(out.shape[0]):
 *         if isinstance(out[i], Exception):             # <<<<<<<<<<<<<<
 *             raise out[i]
 *     ############################# forming output  #############################
*/
    if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3059, __pyx_L1_error) }
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_out, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyException_Check(__pyx_t_3); 
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_t_7)) {

      /* "H2MM_C.pyx":3060
 *     for i in range(out.shape[0]):
 *         if isinstance(out[i], Exception):
 *             raise out[i]             # <<<<<<<<<<<<<<
 *     ############################# forming output  #############################
 *     if conv & CONVCODE_CONVERGED:
*/
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3060, __pyx_L1_error) }
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_out, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3060, __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(0, 3060, __pyx_L1_error)

      /* "H2MM_C.pyx":3059
 *     # next error should be essentially imposible
 *     for i in range(out.shape[0]):
 *         if isinstance(out[i], Exception):             # <<<<<<<<<<<<<<
 *             raise out[i]
 *     ############################# forming output  #############################
*/
    }
  }

  /* "H2MM_C.pyx":3062
 *             raise out[i]
 *     ############################# forming output  #############################
 *     if conv & CONVCODE_CONVERGED:             # <<<<<<<<<<<<<<
 *         out_text = f'The model converged after {niter} iterations'
 *     elif conv & CONVCODE_MAXITER:
*/
  __pyx_t_7 = ((__pyx_v_conv & CONVCODE_CONVERGED) != 0);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3063
 *     ############################# forming output  #############################
 *     if conv & CONVCODE_CONVERGED:
 *         out_text = f'The model converged after {niter} iterations'             # <<<<<<<<<<<<<<
 *     elif conv & CONVCODE_MAXITER:
 *         out_text = 'Optimization reached maximum number of iterations'
*/
    __pyx_t_3 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_22[0] = __pyx_mstate_global->__pyx_kp_u_The_model_converged_after;
    __pyx_t_22[1] = __pyx_t_3;
    __pyx_t_22[2] = __pyx_mstate_global->__pyx_kp_u_iterations;
    __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_22, 3, 26 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 11, 127);
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_out_text = ((PyObject*)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "H2MM_C.pyx":3062
 *             raise out[i]
 *     ############################# forming output  #############################
 *     if conv & CONVCODE_CONVERGED:             # <<<<<<<<<<<<<<
 *         out_text = f'The model converged after {niter} iterations'
 *     elif conv & CONVCODE_MAXITER:
*/
    goto __pyx_L61;
  }

  /* "H2MM_C.pyx":3064
 *     if conv & CONVCODE_CONVERGED:
 *         out_text = f'The model converged after {niter} iterations'
 *     elif conv & CONVCODE_MAXITER:             # <<<<<<<<<<<<<<
 *         out_text = 'Optimization reached maximum number of iterations'
 *     elif conv & CONVCODE_MAXTIME:
*/
  __pyx_t_7 = ((__pyx_v_conv & CONVCODE_MAXITER) != 0);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3065
 *         out_text = f'The model converged after {niter} iterations'
 *     elif conv & CONVCODE_MAXITER:
 *         out_text = 'Optimization reached maximum number of iterations'             # <<<<<<<<<<<<<<
 *     elif conv & CONVCODE_MAXTIME:
 *         out_text = 'Optimization reached maxiumum time'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Optimization_reached_maximum_num);
    __pyx_v_out_text = __pyx_mstate_global->__pyx_kp_u_Optimization_reached_maximum_num;

    /* "H2MM_C.pyx":3064
 *     if conv & CONVCODE_CONVERGED:
 *         out_text = f'The model converged after {niter} iterations'
 *     elif conv & CONVCODE_MAXITER:             # <<<<<<<<<<<<<<
 *         out_text = 'Optimization reached maximum number of iterations'
 *     elif conv & CONVCODE_MAXTIME:
*/
    goto __pyx_L61;
  }

  /* "H2MM_C.pyx":3066
 *     elif conv & CONVCODE_MAXITER:
 *         out_text = 'Optimization reached maximum number of iterations'
 *     elif conv & CONVCODE_MAXTIME:             # <<<<<<<<<<<<<<
 *         out_text = 'Optimization reached maxiumum time'
 *     elif conv & CONVCODE_ERROR:
*/
  __pyx_t_7 = ((__pyx_v_conv & CONVCODE_MAXTIME) != 0);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3067
 *         out_text = 'Optimization reached maximum number of iterations'
 *     elif conv & CONVCODE_MAXTIME:
 *         out_text = 'Optimization reached maxiumum time'             # <<<<<<<<<<<<<<
 *     elif conv & CONVCODE_ERROR:
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Optimization_reached_maxiumum_ti);
    __pyx_v_out_text = __pyx_mstate_global->__pyx_kp_u_Optimization_reached_maxiumum_ti;

    /* "H2MM_C.pyx":3066
 *     elif conv & CONVCODE_MAXITER:
 *         out_text = 'Optimization reached maximum number of iterations'
 *     elif conv & CONVCODE_MAXTIME:             # <<<<<<<<<<<<<<
 *         out_text = 'Optimization reached maxiumum time'
 *     elif conv & CONVCODE_ERROR:
*/
    goto __pyx_L61;
  }

  /* "H2MM_C.pyx":3068
 *     elif conv & CONVCODE_MAXTIME:
 *         out_text = 'Optimization reached maxiumum time'
 *     elif conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
 *     elif conv == -1:
*/
  __pyx_t_7 = ((__pyx_v_conv & CONVCODE_ERROR) != 0);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3069
 *         out_text = 'Optimization reached maxiumum time'
 *     elif conv & CONVCODE_ERROR:
 *         out_text = f'An error occured on iteration {niter}, returning previous model'             # <<<<<<<<<<<<<<
 *     elif conv == -1:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
*/
    __pyx_t_12 = __Pyx_PyUnicode_From_int64_t(__pyx_v_niter, 0, ' ', 'd'); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_22[0] = __pyx_mstate_global->__pyx_kp_u_An_error_occured_on_iteration;
    __pyx_t_22[1] = __pyx_t_12;
    __pyx_t_22[2] = __pyx_mstate_global->__pyx_kp_u_returning_previous_model;
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_22, 3, 30 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12) + 26, 127);
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_out_text = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":3068
 *     elif conv & CONVCODE_MAXTIME:
 *         out_text = 'Optimization reached maxiumum time'
 *     elif conv & CONVCODE_ERROR:             # <<<<<<<<<<<<<<
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
 *     elif conv == -1:
*/
    goto __pyx_L61;
  }

  /* "H2MM_C.pyx":3070
 *     elif conv & CONVCODE_ERROR:
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
 *     elif conv == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     if not opt_array_:
*/
  __pyx_t_7 = (__pyx_v_conv == -1L);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3071
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
 *     elif conv == -1:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')             # <<<<<<<<<<<<<<
 *     if not opt_array_:
 *         out = out[0]
*/
    __pyx_t_12 = NULL;
    __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_res, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyUnicode_From_int64_t(__pyx_v_conv, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19[0] = __pyx_mstate_global->__pyx_kp_u_Unknown_error_check_C_code_raise;
    __pyx_t_19[1] = __pyx_t_8;
    __pyx_t_19[2] = __pyx_mstate_global->__pyx_kp_u_conv;
    __pyx_t_19[3] = __pyx_t_1;
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_19, 4, 56 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127);
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3071, __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(0, 3071, __pyx_L1_error)

    /* "H2MM_C.pyx":3070
 *     elif conv & CONVCODE_ERROR:
 *         out_text = f'An error occured on iteration {niter}, returning previous model'
 *     elif conv == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     if not opt_array_:
*/
  }
  __pyx_L61:;

  /* "H2MM_C.pyx":3072
 *     elif conv == -1:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     if not opt_array_:             # <<<<<<<<<<<<<<
 *         out = out[0]
 *     if ptr_print_func is not NULL:
*/
  __pyx_t_7 = (!(__pyx_v_opt_array_ != 0));
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3073
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     if not opt_array_:
 *         out = out[0]             # <<<<<<<<<<<<<<
 *     if ptr_print_func is not NULL:
 *         print_fmtr.update(out_text)
*/
    if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3073, __pyx_L1_error) }
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_out, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "H2MM_C.pyx":3072
 *     elif conv == -1:
 *         raise ValueError(f'Unknown error, check C code- raise issue on GitHub, res={res}, conv={conv}')
 *     if not opt_array_:             # <<<<<<<<<<<<<<
 *         out = out[0]
 *     if ptr_print_func is not NULL:
*/
  }

  /* "H2MM_C.pyx":3074
 *     if not opt_array_:
 *         out = out[0]
 *     if ptr_print_func is not NULL:             # <<<<<<<<<<<<<<
 *         print_fmtr.update(out_text)
 *         print_fmtr.close()
*/
  __pyx_t_7 = (__pyx_v_ptr_print_func != NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3075
 *         out = out[0]
 *     if ptr_print_func is not NULL:
 *         print_fmtr.update(out_text)             # <<<<<<<<<<<<<<
 *         print_fmtr.close()
 *     if gamma_:
*/
    __pyx_t_4 = __pyx_v_print_fmtr;
    __Pyx_INCREF(__pyx_t_4);
    if (unlikely(!__pyx_v_out_text)) { __Pyx_RaiseUnboundLocalError("out_text"); __PYX_ERR(0, 3075, __pyx_L1_error) }
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_out_text};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3075, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":3076
 *     if ptr_print_func is not NULL:
 *         print_fmtr.update(out_text)
 *         print_fmtr.close()             # <<<<<<<<<<<<<<
 *     if gamma_:
 *         out = out, gamma_out[0] if single else gamma_out.reshape(shape)
*/
    __pyx_t_4 = __pyx_v_print_fmtr;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":3074
 *     if not opt_array_:
 *         out = out[0]
 *     if ptr_print_func is not NULL:             # <<<<<<<<<<<<<<
 *         print_fmtr.update(out_text)
 *         print_fmtr.close()
*/
  }

  /* "H2MM_C.pyx":3077
 *         print_fmtr.update(out_text)
 *         print_fmtr.close()
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         out = out, gamma_out[0] if single else gamma_out.reshape(shape)
 *     return out
*/
  if (__pyx_v_gamma_) {

    /* "H2MM_C.pyx":3078
 *         print_fmtr.close()
 *     if gamma_:
 *         out = out, gamma_out[0] if single else gamma_out.reshape(shape)             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
    if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3078, __pyx_L1_error) }
    if (__pyx_v_single) {
      __pyx_t_23 = 0;
      __pyx_t_6 = -1;
      if (__pyx_t_23 < 0) {
        __pyx_t_23 += __pyx_pybuffernd_gamma_out.diminfo[0].shape;
        if (unlikely(__pyx_t_23 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_gamma_out.diminfo[0].shape)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        __PYX_ERR(0, 3078, __pyx_L1_error)
      }
      __pyx_t_4 = (PyObject *) *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_gamma_out.diminfo[0].strides);
      if (unlikely(__pyx_t_4 == NULL)) __pyx_t_4 = Py_None;
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_12 = ((PyObject *)__pyx_v_gamma_out);
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_shape};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3078, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3078, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_out);
    __Pyx_GIVEREF(__pyx_v_out);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 3078, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 3078, __pyx_L1_error);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "H2MM_C.pyx":3077
 *         print_fmtr.update(out_text)
 *         print_fmtr.close()
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         out = out, gamma_out[0] if single else gamma_out.reshape(shape)
 *     return out
*/
  }

  /* "H2MM_C.pyx":3079
 *     if gamma_:
 *         out = out, gamma_out[0] if single else gamma_out.reshape(shape)
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3079, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  { 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_gamma_out.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.EM_H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mdl);
  __Pyx_XDECREF(__pyx_v_print_strings);
  __Pyx_XDECREF(__pyx_v_print_fmtr);
  __Pyx_XDECREF((PyObject *)__pyx_v_bnds);
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_indxs);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF((PyObject *)__pyx_v_gamma_out);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_print_err);
  __Pyx_XDECREF(__pyx_v_bound_err);
  __Pyx_XDECREF(__pyx_v_out_text);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_bounds_kwargs);
  __Pyx_XDECREF(__pyx_v_print_args);
  __Pyx_XDECREF(__pyx_v_print_kwargs);
  __Pyx_XDECREF(__pyx_v_print_fmt_args);
  __Pyx_XDECREF(__pyx_v_print_fmt_kwargs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_20make_h2mm_arr_modptr_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":3093
 *     else:
 *         shape = (len(models), )
 *     if any(not isinstance(model, h2mm_model) for model in models):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
 *     cdef int64_t nmodel = len(models)
*/

static PyObject *__pyx_pf_6H2MM_C_20make_h2mm_arr_modptr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_8_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3093, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_20make_h2mm_arr_modptr_2generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_make_h2mm_arr_modptr_locals_gene, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.make_h2mm_arr_modptr.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_20make_h2mm_arr_modptr_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3093, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 3093, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3093, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3093, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_2;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3093, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
        #endif
        ++__pyx_t_2;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3093, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3093, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_model);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_model, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_TypeCheck(__pyx_cur_scope->__pyx_v_model, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3082
 * 
 * 
 * cdef tuple make_h2mm_arr_modptr(models, bint *modelsingle, int64_t *nmodels, h2mm_mod **mod_arr):             # <<<<<<<<<<<<<<
 *     if isinstance(models, h2mm_model):
 *         modelsingle[0] = True
*/

static PyObject *__pyx_f_6H2MM_C_make_h2mm_arr_modptr(PyObject *__pyx_v_models, int *__pyx_v_modelsingle, int64_t *__pyx_v_nmodels, h2mm_mod **__pyx_v_mod_arr) {
  PyObject *__pyx_v_shape = NULL;
  int64_t __pyx_v_nmodel;
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  h2mm_mod *__pyx_v_imod_arr;
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_temp = 0;
  h2mm_mod *__pyx_v_mtemp;
  PyObject *__pyx_gb_6H2MM_C_20make_h2mm_arr_modptr_2generator6 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9[3];
  PyObject *__pyx_t_10 = NULL;
  int64_t __pyx_t_11;
  int64_t __pyx_t_12;
  int64_t __pyx_t_13;
  h2mm_mod *__pyx_t_14;
  int __pyx_t_15;
  int64_t __pyx_t_16;
  int64_t __pyx_t_17;
  int64_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_h2mm_arr_modptr", 0);
  __Pyx_INCREF(__pyx_v_models);

  /* "H2MM_C.pyx":3083
 * 
 * cdef tuple make_h2mm_arr_modptr(models, bint *modelsingle, int64_t *nmodels, h2mm_mod **mod_arr):
 *     if isinstance(models, h2mm_model):             # <<<<<<<<<<<<<<
 *         modelsingle[0] = True
 *         models = [models, ]
*/
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_models, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model); 
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":3084
 * cdef tuple make_h2mm_arr_modptr(models, bint *modelsingle, int64_t *nmodels, h2mm_mod **mod_arr):
 *     if isinstance(models, h2mm_model):
 *         modelsingle[0] = True             # <<<<<<<<<<<<<<
 *         models = [models, ]
 *     if not isinstance(models, (cnp.ndarray, Sequence)):
*/
    (__pyx_v_modelsingle[0]) = 1;

    /* "H2MM_C.pyx":3085
 *     if isinstance(models, h2mm_model):
 *         modelsingle[0] = True
 *         models = [models, ]             # <<<<<<<<<<<<<<
 *     if not isinstance(models, (cnp.ndarray, Sequence)):
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
*/
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_models);
    __Pyx_GIVEREF(__pyx_v_models);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_models) != (0)) __PYX_ERR(0, 3085, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_models, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":3083
 * 
 * cdef tuple make_h2mm_arr_modptr(models, bint *modelsingle, int64_t *nmodels, h2mm_mod **mod_arr):
 *     if isinstance(models, h2mm_model):             # <<<<<<<<<<<<<<
 *         modelsingle[0] = True
 *         models = [models, ]
*/
  }

  /* "H2MM_C.pyx":3086
 *         modelsingle[0] = True
 *         models = [models, ]
 *     if not isinstance(models, (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
 *     if isinstance(models, cnp.ndarray):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_models, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_models, __pyx_t_2); 
  __pyx_t_1 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (!__pyx_t_1);
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":3087
 *         models = [models, ]
 *     if not isinstance(models, (cnp.ndarray, Sequence)):
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")             # <<<<<<<<<<<<<<
 *     if isinstance(models, cnp.ndarray):
 *         shape = models.shape
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_6 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_models_must_be_sequence_or_array};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3087, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3087, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3086
 *         modelsingle[0] = True
 *         models = [models, ]
 *     if not isinstance(models, (cnp.ndarray, Sequence)):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
 *     if isinstance(models, cnp.ndarray):
*/
  }

  /* "H2MM_C.pyx":3088
 *     if not isinstance(models, (cnp.ndarray, Sequence)):
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
 *     if isinstance(models, cnp.ndarray):             # <<<<<<<<<<<<<<
 *         shape = models.shape
 *         models = models.reshape(-1)
*/
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_models, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray); 
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":3089
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
 *     if isinstance(models, cnp.ndarray):
 *         shape = models.shape             # <<<<<<<<<<<<<<
 *         models = models.reshape(-1)
 *     else:
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_models, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_shape = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":3090
 *     if isinstance(models, cnp.ndarray):
 *         shape = models.shape
 *         models = models.reshape(-1)             # <<<<<<<<<<<<<<
 *     else:
 *         shape = (len(models), )
*/
    __pyx_t_4 = __pyx_v_models;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_neg_1};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_DECREF_SET(__pyx_v_models, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "H2MM_C.pyx":3088
 *     if not isinstance(models, (cnp.ndarray, Sequence)):
 *         return tuple(), TypeError("models must be sequence or array of h2mm_model objects")
 *     if isinstance(models, cnp.ndarray):             # <<<<<<<<<<<<<<
 *         shape = models.shape
 *         models = models.reshape(-1)
*/
    goto __pyx_L7;
  }

  /* "H2MM_C.pyx":3092
 *         models = models.reshape(-1)
 *     else:
 *         shape = (len(models), )             # <<<<<<<<<<<<<<
 *     if any(not isinstance(model, h2mm_model) for model in models):
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
*/
  /*else*/ {
    __pyx_t_7 = PyObject_Length(__pyx_v_models); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3092, __pyx_L1_error)
    __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 3092, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_v_shape = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L7:;

  /* "H2MM_C.pyx":3093
 *     else:
 *         shape = (len(models), )
 *     if any(not isinstance(model, h2mm_model) for model in models):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
 *     cdef int64_t nmodel = len(models)
*/
  __pyx_t_4 = __pyx_pf_6H2MM_C_20make_h2mm_arr_modptr_genexpr(NULL, __pyx_v_models); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":3094
 *         shape = (len(models), )
 *     if any(not isinstance(model, h2mm_model) for model in models):
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")             # <<<<<<<<<<<<<<
 *     cdef int64_t nmodel = len(models)
 *     cdef int64_t i, j
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3094, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_2 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_all_elements_of_models_must_be_h};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3094, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3094, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 3094, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3094, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3093
 *     else:
 *         shape = (len(models), )
 *     if any(not isinstance(model, h2mm_model) for model in models):             # <<<<<<<<<<<<<<
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
 *     cdef int64_t nmodel = len(models)
*/
  }

  /* "H2MM_C.pyx":3095
 *     if any(not isinstance(model, h2mm_model) for model in models):
 *         return tuple(), TypeError("all elements of models must be h2mm_model objects")
 *     cdef int64_t nmodel = len(models)             # <<<<<<<<<<<<<<
 *     cdef int64_t i, j
 *     cdef h2mm_mod *imod_arr = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
*/
  __pyx_t_7 = PyObject_Length(__pyx_v_models); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3095, __pyx_L1_error)
  __pyx_v_nmodel = __pyx_t_7;

  /* "H2MM_C.pyx":3097
 *     cdef int64_t nmodel = len(models)
 *     cdef int64_t i, j
 *     cdef h2mm_mod *imod_arr = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))             # <<<<<<<<<<<<<<
 *     if imod_arr is NULL:
 *         return tuple(), MemoryError(f"insufficient memory, cannot allocate {nmodel*sizeof(h2mm_mod)//1024} kb for output models array")
*/
  __pyx_v_imod_arr = ((h2mm_mod *)PyMem_Malloc((__pyx_v_nmodel * (sizeof(h2mm_mod)))));

  /* "H2MM_C.pyx":3098
 *     cdef int64_t i, j
 *     cdef h2mm_mod *imod_arr = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if imod_arr is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), MemoryError(f"insufficient memory, cannot allocate {nmodel*sizeof(h2mm_mod)//1024} kb for output models array")
 *     cdef h2mm_model temp
*/
  __pyx_t_3 = (__pyx_v_imod_arr == NULL);
  if (__pyx_t_3) {

    /* "H2MM_C.pyx":3099
 *     cdef h2mm_mod *imod_arr = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if imod_arr is NULL:
 *         return tuple(), MemoryError(f"insufficient memory, cannot allocate {nmodel*sizeof(h2mm_mod)//1024} kb for output models array")             # <<<<<<<<<<<<<<
 *     cdef h2mm_model temp
 *     cdef h2mm_mod *mtemp
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_6 = NULL;
    __pyx_t_8 = __Pyx_PyUnicode_From_size_t(((__pyx_v_nmodel * (sizeof(h2mm_mod))) / 0x400), 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_insufficient_memory_cannot_alloc;
    __pyx_t_9[1] = __pyx_t_8;
    __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_kb_for_output_models_array;
    __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 27, 127);
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_10};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3099, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3099, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3098
 *     cdef int64_t i, j
 *     cdef h2mm_mod *imod_arr = <h2mm_mod*> PyMem_Malloc(nmodel*sizeof(h2mm_mod))
 *     if imod_arr is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), MemoryError(f"insufficient memory, cannot allocate {nmodel*sizeof(h2mm_mod)//1024} kb for output models array")
 *     cdef h2mm_model temp
*/
  }

  /* "H2MM_C.pyx":3102
 *     cdef h2mm_model temp
 *     cdef h2mm_mod *mtemp
 *     for i in range(nmodel):             # <<<<<<<<<<<<<<
 *         temp = models[i]
 *         mtemp = temp.model
*/
  __pyx_t_11 = __pyx_v_nmodel;
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "H2MM_C.pyx":3103
 *     cdef h2mm_mod *mtemp
 *     for i in range(nmodel):
 *         temp = models[i]             # <<<<<<<<<<<<<<
 *         mtemp = temp.model
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))
*/
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_models, __pyx_v_i, int64_t, 1, __Pyx_PyLong_From_int64_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model))))) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_temp, ((struct __pyx_obj_6H2MM_C_h2mm_model *)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "H2MM_C.pyx":3104
 *     for i in range(nmodel):
 *         temp = models[i]
 *         mtemp = temp.model             # <<<<<<<<<<<<<<
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:
*/
    __pyx_t_14 = __pyx_v_temp->model;
    __pyx_v_mtemp = __pyx_t_14;

    /* "H2MM_C.pyx":3105
 *         temp = models[i]
 *         mtemp = temp.model
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         if imod_arr[i].prior is NULL:
 *             Py_free_models(i, imod_arr)
*/
    (__pyx_v_imod_arr[__pyx_v_i]).prior = ((double *)PyMem_Malloc((__pyx_v_mtemp->nstate * (sizeof(double)))));

    /* "H2MM_C.pyx":3106
 *         mtemp = temp.model
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
*/
    __pyx_t_3 = ((__pyx_v_imod_arr[__pyx_v_i]).prior == NULL);
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":3107
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:
 *             Py_free_models(i, imod_arr)             # <<<<<<<<<<<<<<
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))
*/
      __pyx_t_15 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_imod_arr); if (unlikely(__pyx_t_15 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3107, __pyx_L1_error)

      /* "H2MM_C.pyx":3108
 *         if imod_arr[i].prior is NULL:
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")             # <<<<<<<<<<<<<<
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_2 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_cannot_alloc_2};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_10);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10) != (0)) __PYX_ERR(0, 3108, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3108, __pyx_L1_error);
      __pyx_t_10 = 0;
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":3106
 *         mtemp = temp.model
 *         imod_arr[i].prior = <double*> PyMem_Malloc(mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
*/
    }

    /* "H2MM_C.pyx":3109
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         if imod_arr[i].prior is NULL:
 *             PyMem_Free(imod_arr[i].prior)
*/
    (__pyx_v_imod_arr[__pyx_v_i]).trans = ((double *)PyMem_Malloc(((__pyx_v_mtemp->nstate * __pyx_v_mtemp->nstate) * (sizeof(double)))));

    /* "H2MM_C.pyx":3110
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
*/
    __pyx_t_3 = ((__pyx_v_imod_arr[__pyx_v_i]).prior == NULL);
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":3111
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:
 *             PyMem_Free(imod_arr[i].prior)             # <<<<<<<<<<<<<<
 *             imod_arr[i].prior = NULL
 *             Py_free_models(i, imod_arr)
*/
      PyMem_Free((__pyx_v_imod_arr[__pyx_v_i]).prior);

      /* "H2MM_C.pyx":3112
 *         if imod_arr[i].prior is NULL:
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL             # <<<<<<<<<<<<<<
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")
*/
      (__pyx_v_imod_arr[__pyx_v_i]).prior = NULL;

      /* "H2MM_C.pyx":3113
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
 *             Py_free_models(i, imod_arr)             # <<<<<<<<<<<<<<
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))
*/
      __pyx_t_15 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_imod_arr); if (unlikely(__pyx_t_15 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3113, __pyx_L1_error)

      /* "H2MM_C.pyx":3114
 *             imod_arr[i].prior = NULL
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")             # <<<<<<<<<<<<<<
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].obs is NULL:
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_10 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_cannot_alloc_3};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3114, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3114, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_10);
      __pyx_t_10 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":3110
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         imod_arr[i].trans = <double*> PyMem_Malloc(mtemp.nstate*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].prior is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
*/
    }

    /* "H2MM_C.pyx":3115
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))             # <<<<<<<<<<<<<<
 *         if imod_arr[i].obs is NULL:
 *             PyMem_Free(imod_arr[i].prior)
*/
    (__pyx_v_imod_arr[__pyx_v_i]).obs = ((double *)PyMem_Malloc(((__pyx_v_mtemp->ndet * __pyx_v_mtemp->nstate) * (sizeof(double)))));

    /* "H2MM_C.pyx":3116
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].obs is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
*/
    __pyx_t_3 = ((__pyx_v_imod_arr[__pyx_v_i]).obs == NULL);
    if (__pyx_t_3) {

      /* "H2MM_C.pyx":3117
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].obs is NULL:
 *             PyMem_Free(imod_arr[i].prior)             # <<<<<<<<<<<<<<
 *             imod_arr[i].prior = NULL
 *             PyMem_Free(imod_arr[i].trans)
*/
      PyMem_Free((__pyx_v_imod_arr[__pyx_v_i]).prior);

      /* "H2MM_C.pyx":3118
 *         if imod_arr[i].obs is NULL:
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL             # <<<<<<<<<<<<<<
 *             PyMem_Free(imod_arr[i].trans)
 *             imod_arr[i].trans = NULL
*/
      (__pyx_v_imod_arr[__pyx_v_i]).prior = NULL;

      /* "H2MM_C.pyx":3119
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
 *             PyMem_Free(imod_arr[i].trans)             # <<<<<<<<<<<<<<
 *             imod_arr[i].trans = NULL
 *             Py_free_models(i, imod_arr)
*/
      PyMem_Free((__pyx_v_imod_arr[__pyx_v_i]).trans);

      /* "H2MM_C.pyx":3120
 *             imod_arr[i].prior = NULL
 *             PyMem_Free(imod_arr[i].trans)
 *             imod_arr[i].trans = NULL             # <<<<<<<<<<<<<<
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
*/
      (__pyx_v_imod_arr[__pyx_v_i]).trans = NULL;

      /* "H2MM_C.pyx":3121
 *             PyMem_Free(imod_arr[i].trans)
 *             imod_arr[i].trans = NULL
 *             Py_free_models(i, imod_arr)             # <<<<<<<<<<<<<<
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         for j in range(mtemp.nstate):
*/
      __pyx_t_15 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_i, __pyx_v_imod_arr); if (unlikely(__pyx_t_15 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3121, __pyx_L1_error)

      /* "H2MM_C.pyx":3122
 *             imod_arr[i].trans = NULL
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")             # <<<<<<<<<<<<<<
 *         for j in range(mtemp.nstate):
 *             imod_arr[i].prior[j] = mtemp.prior[j]
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_2 = NULL;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_cannot_alloc_2};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_10);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10) != (0)) __PYX_ERR(0, 3122, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3122, __pyx_L1_error);
      __pyx_t_10 = 0;
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "H2MM_C.pyx":3116
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate trans array")
 *         imod_arr[i].obs = <double*> PyMem_Malloc(mtemp.ndet*mtemp.nstate*sizeof(double))
 *         if imod_arr[i].obs is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(imod_arr[i].prior)
 *             imod_arr[i].prior = NULL
*/
    }

    /* "H2MM_C.pyx":3123
 *             Py_free_models(i, imod_arr)
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         for j in range(mtemp.nstate):             # <<<<<<<<<<<<<<
 *             imod_arr[i].prior[j] = mtemp.prior[j]
 *         for j in range(mtemp.nstate*mtemp.nstate):
*/
    __pyx_t_16 = __pyx_v_mtemp->nstate;
    __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;

      /* "H2MM_C.pyx":3124
 *             return tuple(), MemoryError(f"insufficient memory, cannot allocate prior array")
 *         for j in range(mtemp.nstate):
 *             imod_arr[i].prior[j] = mtemp.prior[j]             # <<<<<<<<<<<<<<
 *         for j in range(mtemp.nstate*mtemp.nstate):
 *             imod_arr[i].trans[j] = mtemp.trans[j]
*/
      ((__pyx_v_imod_arr[__pyx_v_i]).prior[__pyx_v_j]) = (__pyx_v_mtemp->prior[__pyx_v_j]);
    }

    /* "H2MM_C.pyx":3125
 *         for j in range(mtemp.nstate):
 *             imod_arr[i].prior[j] = mtemp.prior[j]
 *         for j in range(mtemp.nstate*mtemp.nstate):             # <<<<<<<<<<<<<<
 *             imod_arr[i].trans[j] = mtemp.trans[j]
 *         for j in range(mtemp.nstate*mtemp.ndet):
*/
    __pyx_t_16 = (__pyx_v_mtemp->nstate * __pyx_v_mtemp->nstate);
    __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;

      /* "H2MM_C.pyx":3126
 *             imod_arr[i].prior[j] = mtemp.prior[j]
 *         for j in range(mtemp.nstate*mtemp.nstate):
 *             imod_arr[i].trans[j] = mtemp.trans[j]             # <<<<<<<<<<<<<<
 *         for j in range(mtemp.nstate*mtemp.ndet):
 *             imod_arr[i].obs[j] = mtemp.obs[j]
*/
      ((__pyx_v_imod_arr[__pyx_v_i]).trans[__pyx_v_j]) = (__pyx_v_mtemp->trans[__pyx_v_j]);
    }

    /* "H2MM_C.pyx":3127
 *         for j in range(mtemp.nstate*mtemp.nstate):
 *             imod_arr[i].trans[j] = mtemp.trans[j]
 *         for j in range(mtemp.nstate*mtemp.ndet):             # <<<<<<<<<<<<<<
 *             imod_arr[i].obs[j] = mtemp.obs[j]
 *         imod_arr[i].nstate = mtemp.nstate
*/
    __pyx_t_16 = (__pyx_v_mtemp->nstate * __pyx_v_mtemp->ndet);
    __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;

      /* "H2MM_C.pyx":3128
 *             imod_arr[i].trans[j] = mtemp.trans[j]
 *         for j in range(mtemp.nstate*mtemp.ndet):
 *             imod_arr[i].obs[j] = mtemp.obs[j]             # <<<<<<<<<<<<<<
 *         imod_arr[i].nstate = mtemp.nstate
 *         imod_arr[i].ndet = mtemp.ndet
*/
      ((__pyx_v_imod_arr[__pyx_v_i]).obs[__pyx_v_j]) = (__pyx_v_mtemp->obs[__pyx_v_j]);
    }

    /* "H2MM_C.pyx":3129
 *         for j in range(mtemp.nstate*mtemp.ndet):
 *             imod_arr[i].obs[j] = mtemp.obs[j]
 *         imod_arr[i].nstate = mtemp.nstate             # <<<<<<<<<<<<<<
 *         imod_arr[i].ndet = mtemp.ndet
 *         imod_arr[i].nphot = 0
*/
    __pyx_t_16 = __pyx_v_mtemp->nstate;
    (__pyx_v_imod_arr[__pyx_v_i]).nstate = __pyx_t_16;

    /* "H2MM_C.pyx":3130
 *             imod_arr[i].obs[j] = mtemp.obs[j]
 *         imod_arr[i].nstate = mtemp.nstate
 *         imod_arr[i].ndet = mtemp.ndet             # <<<<<<<<<<<<<<
 *         imod_arr[i].nphot = 0
 *         imod_arr[i].niter = 0
*/
    __pyx_t_16 = __pyx_v_mtemp->ndet;
    (__pyx_v_imod_arr[__pyx_v_i]).ndet = __pyx_t_16;

    /* "H2MM_C.pyx":3131
 *         imod_arr[i].nstate = mtemp.nstate
 *         imod_arr[i].ndet = mtemp.ndet
 *         imod_arr[i].nphot = 0             # <<<<<<<<<<<<<<
 *         imod_arr[i].niter = 0
 *         imod_arr[i].conv = 0
*/
    (__pyx_v_imod_arr[__pyx_v_i]).nphot = 0;

    /* "H2MM_C.pyx":3132
 *         imod_arr[i].ndet = mtemp.ndet
 *         imod_arr[i].nphot = 0
 *         imod_arr[i].niter = 0             # <<<<<<<<<<<<<<
 *         imod_arr[i].conv = 0
 *         imod_arr[i].loglik = 0.0
*/
    (__pyx_v_imod_arr[__pyx_v_i]).niter = 0;

    /* "H2MM_C.pyx":3133
 *         imod_arr[i].nphot = 0
 *         imod_arr[i].niter = 0
 *         imod_arr[i].conv = 0             # <<<<<<<<<<<<<<
 *         imod_arr[i].loglik = 0.0
 *     mod_arr[0] = imod_arr
*/
    (__pyx_v_imod_arr[__pyx_v_i]).conv = 0;

    /* "H2MM_C.pyx":3134
 *         imod_arr[i].niter = 0
 *         imod_arr[i].conv = 0
 *         imod_arr[i].loglik = 0.0             # <<<<<<<<<<<<<<
 *     mod_arr[0] = imod_arr
 *     nmodels[0] = nmodel
*/
    (__pyx_v_imod_arr[__pyx_v_i]).loglik = 0.0;
  }

  /* "H2MM_C.pyx":3135
 *         imod_arr[i].conv = 0
 *         imod_arr[i].loglik = 0.0
 *     mod_arr[0] = imod_arr             # <<<<<<<<<<<<<<
 *     nmodels[0] = nmodel
 *     return shape, False
*/
  (__pyx_v_mod_arr[0]) = __pyx_v_imod_arr;

  /* "H2MM_C.pyx":3136
 *         imod_arr[i].loglik = 0.0
 *     mod_arr[0] = imod_arr
 *     nmodels[0] = nmodel             # <<<<<<<<<<<<<<
 *     return shape, False
 * 
*/
  (__pyx_v_nmodels[0]) = __pyx_v_nmodel;

  /* "H2MM_C.pyx":3137
 *     mod_arr[0] = imod_arr
 *     nmodels[0] = nmodel
 *     return shape, False             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_shape);
  __Pyx_GIVEREF(__pyx_v_shape);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape) != (0)) __PYX_ERR(0, 3137, __pyx_L1_error);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False) != (0)) __PYX_ERR(0, 3137, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3082
 * 
 * 
 * cdef tuple make_h2mm_arr_modptr(models, bint *modelsingle, int64_t *nmodels, h2mm_mod **mod_arr):             # <<<<<<<<<<<<<<
 *     if isinstance(models, h2mm_model):
 *         modelsingle[0] = True
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("H2MM_C.make_h2mm_arr_modptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_20make_h2mm_arr_modptr_2generator6);
  __Pyx_XDECREF(__pyx_v_models);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3140
 * 
 * 
 * cdef cnp.ndarray[object, ndim=2] make_gamma_gamma_arrays(int64_t nmodels, h2mm_mod *models, int64_t nbursts, int64_t *burst_sizes, double ****gamma):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=2] out
 *     cdef bint err = False
*/

static PyArrayObject *__pyx_f_6H2MM_C_make_gamma_gamma_arrays(int64_t __pyx_v_nmodels, h2mm_mod *__pyx_v_models, int64_t __pyx_v_nbursts, int64_t *__pyx_v_burst_sizes, double ****__pyx_v_gamma) {
  PyArrayObject *__pyx_v_out = 0;
  int __pyx_v_err;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_obtemp = 0;
  PyArrayObject *__pyx_v_temp = 0;
  int64_t __pyx_v_i;
  int64_t __pyx_v_j;
  double ***__pyx_v_data;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int64_t __pyx_t_16;
  int64_t __pyx_t_17;
  int64_t __pyx_t_18;
  int64_t __pyx_t_19;
  int64_t __pyx_t_20;
  int64_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  PyObject **__pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_gamma_gamma_arrays", 0);
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;

  /* "H2MM_C.pyx":3142
 * cdef cnp.ndarray[object, ndim=2] make_gamma_gamma_arrays(int64_t nmodels, h2mm_mod *models, int64_t nbursts, int64_t *burst_sizes, double ****gamma):
 *     cdef cnp.ndarray[object, ndim=2] out
 *     cdef bint err = False             # <<<<<<<<<<<<<<
 *     e = None
 *     try:
*/
  __pyx_v_err = 0;

  /* "H2MM_C.pyx":3143
 *     cdef cnp.ndarray[object, ndim=2] out
 *     cdef bint err = False
 *     e = None             # <<<<<<<<<<<<<<
 *     try:
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
*/
  __Pyx_INCREF(Py_None);
  __pyx_v_e = ((PyObject*)Py_None);

  /* "H2MM_C.pyx":3144
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":3145
 *     e = None
 *     try:
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)             # <<<<<<<<<<<<<<
 *     except Exception as e:
 *         err = True
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyLong_From_int64_t(__pyx_v_nmodels); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 3145, __pyx_L3_error);
      __Pyx_GIVEREF(__pyx_t_8);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 3145, __pyx_L3_error);
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3145, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_10 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_10 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_9};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3145, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3145, __pyx_L3_error)
        __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3145, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3145, __pyx_L3_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 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_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
        if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 3145, __pyx_L3_error)
      }
      __pyx_v_out = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":3144
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:
*/
    }
    __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:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "H2MM_C.pyx":3146
 *     try:
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("H2MM_C.make_gamma_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 3146, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_7);
      /*try:*/ {

        /* "H2MM_C.pyx":3147
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:
 *         err = True             # <<<<<<<<<<<<<<
 *     if err:
 *         return np.empty(0, dtype=np.object_)
*/
        __pyx_v_err = 1;
      }

      /* "H2MM_C.pyx":3146
 *     try:
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:             # <<<<<<<<<<<<<<
 *         err = True
 *     if err:
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;

    /* "H2MM_C.pyx":3144
 *     cdef bint err = False
 *     e = None
 *     try:             # <<<<<<<<<<<<<<
 *         out = np.empty((nmodels, nbursts), dtype=np.object_)
 *     except Exception as e:
*/
    __pyx_L5_except_error:;
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "H2MM_C.pyx":3148
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return np.empty(0, dtype=np.object_)
 *     cdef object obtemp
*/
  if (__pyx_v_err) {

    /* "H2MM_C.pyx":3149
 *         err = True
 *     if err:
 *         return np.empty(0, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     cdef object obtemp
 *     cdef cnp.ndarray[double, ndim=2] temp
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_t_7 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      assert(__pyx_t_7);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
      __pyx_t_10 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_mstate_global->__pyx_int_0};
      __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_9, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3149, __pyx_L1_error)
      __pyx_t_8 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3149, __pyx_L1_error)
    __pyx_r = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3148
 *     except Exception as e:
 *         err = True
 *     if err:             # <<<<<<<<<<<<<<
 *         return np.empty(0, dtype=np.object_)
 *     cdef object obtemp
*/
  }

  /* "H2MM_C.pyx":3153
 *     cdef cnp.ndarray[double, ndim=2] temp
 *     cdef int64_t i, j
 *     cdef double ***data = <double***> PyMem_Malloc(nbursts*sizeof(double**))             # <<<<<<<<<<<<<<
 *     if data is NULL:
 *         return out
*/
  __pyx_v_data = ((double ***)PyMem_Malloc((__pyx_v_nbursts * (sizeof(double **)))));

  /* "H2MM_C.pyx":3154
 *     cdef int64_t i, j
 *     cdef double ***data = <double***> PyMem_Malloc(nbursts*sizeof(double**))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return out
 *     for i in range(nmodels):
*/
  __pyx_t_15 = (__pyx_v_data == NULL);
  if (__pyx_t_15) {

    /* "H2MM_C.pyx":3155
 *     cdef double ***data = <double***> PyMem_Malloc(nbursts*sizeof(double**))
 *     if data is NULL:
 *         return out             # <<<<<<<<<<<<<<
 *     for i in range(nmodels):
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __Pyx_INCREF((PyObject *)__pyx_v_out);
    __pyx_r = ((PyArrayObject *)__pyx_v_out);
    goto __pyx_L0;

    /* "H2MM_C.pyx":3154
 *     cdef int64_t i, j
 *     cdef double ***data = <double***> PyMem_Malloc(nbursts*sizeof(double**))
 *     if data is NULL:             # <<<<<<<<<<<<<<
 *         return out
 *     for i in range(nmodels):
*/
  }

  /* "H2MM_C.pyx":3156
 *     if data is NULL:
 *         return out
 *     for i in range(nmodels):             # <<<<<<<<<<<<<<
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *         if data[i] is NULL:
*/
  __pyx_t_16 = __pyx_v_nmodels;
  __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;

    /* "H2MM_C.pyx":3157
 *         return out
 *     for i in range(nmodels):
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))             # <<<<<<<<<<<<<<
 *         if data[i] is NULL:
 *             free_gammagamma(i, data)
*/
    (__pyx_v_data[__pyx_v_i]) = ((double **)PyMem_Malloc((__pyx_v_nbursts * (sizeof(double *)))));

    /* "H2MM_C.pyx":3158
 *     for i in range(nmodels):
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *         if data[i] is NULL:             # <<<<<<<<<<<<<<
 *             free_gammagamma(i, data)
 *             data = NULL
*/
    __pyx_t_15 = ((__pyx_v_data[__pyx_v_i]) == NULL);
    if (__pyx_t_15) {

      /* "H2MM_C.pyx":3159
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *         if data[i] is NULL:
 *             free_gammagamma(i, data)             # <<<<<<<<<<<<<<
 *             data = NULL
 *             return out
*/
      __pyx_t_11 = __pyx_f_6H2MM_C_free_gammagamma(__pyx_v_i, __pyx_v_data); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3159, __pyx_L1_error)

      /* "H2MM_C.pyx":3160
 *         if data[i] is NULL:
 *             free_gammagamma(i, data)
 *             data = NULL             # <<<<<<<<<<<<<<
 *             return out
 *         for j in range(nbursts):
*/
      __pyx_v_data = NULL;

      /* "H2MM_C.pyx":3161
 *             free_gammagamma(i, data)
 *             data = NULL
 *             return out             # <<<<<<<<<<<<<<
 *         for j in range(nbursts):
 *             try:
*/
      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_out);
      __pyx_r = ((PyArrayObject *)__pyx_v_out);
      goto __pyx_L0;

      /* "H2MM_C.pyx":3158
 *     for i in range(nmodels):
 *         data[i] = <double**> PyMem_Malloc(nbursts*sizeof(double*))
 *         if data[i] is NULL:             # <<<<<<<<<<<<<<
 *             free_gammagamma(i, data)
 *             data = NULL
*/
    }

    /* "H2MM_C.pyx":3162
 *             data = NULL
 *             return out
 *         for j in range(nbursts):             # <<<<<<<<<<<<<<
 *             try:
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
*/
    __pyx_t_19 = __pyx_v_nbursts;
    __pyx_t_20 = __pyx_t_19;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;

      /* "H2MM_C.pyx":3163
 *             return out
 *         for j in range(nbursts):
 *             try:             # <<<<<<<<<<<<<<
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_t_1);
        /*try:*/ {

          /* "H2MM_C.pyx":3164
 *         for j in range(nbursts):
 *             try:
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)             # <<<<<<<<<<<<<<
 *                 temp = obtemp
 *             except Exception as e:
*/
          __pyx_t_6 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyLong_From_int64_t((__pyx_v_burst_sizes[__pyx_v_j])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyLong_From_int64_t((__pyx_v_models[__pyx_v_i]).nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 3164, __pyx_L23_error);
          __Pyx_GIVEREF(__pyx_t_7);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 3164, __pyx_L23_error);
          __pyx_t_4 = 0;
          __pyx_t_7 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3164, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_10 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
            assert(__pyx_t_6);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
            __pyx_t_10 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_t_5};
            __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3164, __pyx_L23_error)
            __Pyx_GOTREF(__pyx_t_7);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_4, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3164, __pyx_L23_error)
            __pyx_t_8 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
            __Pyx_XDECREF(__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_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3164, __pyx_L23_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __Pyx_XDECREF_SET(__pyx_v_obtemp, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "H2MM_C.pyx":3165
 *             try:
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp             # <<<<<<<<<<<<<<
 *             except Exception as e:
 *                 err = True
*/
          __pyx_t_8 = __pyx_v_obtemp;
          __Pyx_INCREF(__pyx_t_8);
          if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3165, __pyx_L23_error)
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
            __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_11 < 0)) {
              PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
              }
              __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
            }
            __pyx_pybuffernd_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_temp.diminfo[1].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_temp.diminfo[1].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[1];
            if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 3165, __pyx_L23_error)
          }
          __Pyx_XDECREF_SET(__pyx_v_temp, ((PyArrayObject *)__pyx_t_8));
          __pyx_t_8 = 0;

          /* "H2MM_C.pyx":3163
 *             return out
 *         for j in range(nbursts):
 *             try:             # <<<<<<<<<<<<<<
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp
*/
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L30_try_end;
        __pyx_L23_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "H2MM_C.pyx":3166
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp
 *             except Exception as e:             # <<<<<<<<<<<<<<
 *                 err = True
 *             if err:
*/
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
        if (__pyx_t_11) {
          __Pyx_AddTraceback("H2MM_C.make_gamma_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_7) < 0) __PYX_ERR(0, 3166, __pyx_L25_except_error)
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_9);
          /*try:*/ {

            /* "H2MM_C.pyx":3167
 *                 temp = obtemp
 *             except Exception as e:
 *                 err = True             # <<<<<<<<<<<<<<
 *             if err:
 *                 free_gammagamma(i, data)
*/
            __pyx_v_err = 1;
          }

          /* "H2MM_C.pyx":3166
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp
 *             except Exception as e:             # <<<<<<<<<<<<<<
 *                 err = True
 *             if err:
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_DECREF(__pyx_v_e); __pyx_v_e = 0;
              goto __pyx_L37;
            }
            __pyx_L37:;
          }
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L24_exception_handled;
        }
        goto __pyx_L25_except_error;

        /* "H2MM_C.pyx":3163
 *             return out
 *         for j in range(nbursts):
 *             try:             # <<<<<<<<<<<<<<
 *                 obtemp = np.empty((burst_sizes[j], models[i].nstate), dtype=np.double)
 *                 temp = obtemp
*/
        __pyx_L25_except_error:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L24_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        __pyx_L30_try_end:;
      }

      /* "H2MM_C.pyx":3168
 *             except Exception as e:
 *                 err = True
 *             if err:             # <<<<<<<<<<<<<<
 *                 free_gammagamma(i, data)
 *                 data = NULL
*/
      if (__pyx_v_err) {

        /* "H2MM_C.pyx":3169
 *                 err = True
 *             if err:
 *                 free_gammagamma(i, data)             # <<<<<<<<<<<<<<
 *                 data = NULL
 *                 return out
*/
        __pyx_t_11 = __pyx_f_6H2MM_C_free_gammagamma(__pyx_v_i, __pyx_v_data); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3169, __pyx_L1_error)

        /* "H2MM_C.pyx":3170
 *             if err:
 *                 free_gammagamma(i, data)
 *                 data = NULL             # <<<<<<<<<<<<<<
 *                 return out
 * 
*/
        __pyx_v_data = NULL;

        /* "H2MM_C.pyx":3171
 *                 free_gammagamma(i, data)
 *                 data = NULL
 *                 return out             # <<<<<<<<<<<<<<
 * 
 *             out[i,j] = obtemp
*/
        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF((PyObject *)__pyx_v_out);
        __pyx_r = ((PyArrayObject *)__pyx_v_out);
        goto __pyx_L0;

        /* "H2MM_C.pyx":3168
 *             except Exception as e:
 *                 err = True
 *             if err:             # <<<<<<<<<<<<<<
 *                 free_gammagamma(i, data)
 *                 data = NULL
*/
      }

      /* "H2MM_C.pyx":3173
 *                 return out
 * 
 *             out[i,j] = obtemp             # <<<<<<<<<<<<<<
 *             data[i][j] = <double*> temp.data
 *     gamma[0] = data
*/
      if (unlikely(!__pyx_v_obtemp)) { __Pyx_RaiseUnboundLocalError("obtemp"); __PYX_ERR(0, 3173, __pyx_L1_error) }
      __pyx_t_22 = __pyx_v_i;
      __pyx_t_23 = __pyx_v_j;
      __pyx_t_11 = -1;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_pybuffernd_out.diminfo[0].shape;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 0;
      } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_11 = 0;
      if (__pyx_t_23 < 0) {
        __pyx_t_23 += __pyx_pybuffernd_out.diminfo[1].shape;
        if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 1;
      } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_out.diminfo[1].shape)) __pyx_t_11 = 1;
      if (unlikely(__pyx_t_11 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_11);
        __PYX_ERR(0, 3173, __pyx_L1_error)
      }
      __pyx_t_24 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_out.diminfo[1].strides);
      __Pyx_XGOTREF(*__pyx_t_24);
      __Pyx_INCREF(__pyx_v_obtemp); __Pyx_XDECREF(*__pyx_t_24);
      *__pyx_t_24 = __pyx_v_obtemp;
      __Pyx_XGIVEREF(*__pyx_t_24);

      /* "H2MM_C.pyx":3174
 * 
 *             out[i,j] = obtemp
 *             data[i][j] = <double*> temp.data             # <<<<<<<<<<<<<<
 *     gamma[0] = data
 *     return out
*/
      ((__pyx_v_data[__pyx_v_i])[__pyx_v_j]) = ((double *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_temp)));
    }
  }

  /* "H2MM_C.pyx":3175
 *             out[i,j] = obtemp
 *             data[i][j] = <double*> temp.data
 *     gamma[0] = data             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
  (__pyx_v_gamma[0]) = __pyx_v_data;

  /* "H2MM_C.pyx":3176
 *             data[i][j] = <double*> temp.data
 *     gamma[0] = data
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_out);
  __pyx_r = ((PyArrayObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "H2MM_C.pyx":3140
 * 
 * 
 * cdef cnp.ndarray[object, ndim=2] make_gamma_gamma_arrays(int64_t nmodels, h2mm_mod *models, int64_t nbursts, int64_t *burst_sizes, double ****gamma):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=2] out
 *     cdef bint err = False
*/

  /* function exit code */
  __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_8);
  __Pyx_XDECREF(__pyx_t_9);
  { 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_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.make_gamma_gamma_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_obtemp);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3179
 * 
 * 
 * cdef int free_gammagamma(int64_t nmodels, double ***gamma):             # <<<<<<<<<<<<<<
 *     if gamma is NULL:
 *         return 0
*/

static int __pyx_f_6H2MM_C_free_gammagamma(int64_t __pyx_v_nmodels, double ***__pyx_v_gamma) {
  int64_t __pyx_v_i;
  int __pyx_r;
  int __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  int64_t __pyx_t_4;

  /* "H2MM_C.pyx":3180
 * 
 * cdef int free_gammagamma(int64_t nmodels, double ***gamma):
 *     if gamma is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i, j
*/
  __pyx_t_1 = (__pyx_v_gamma == NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":3181
 * cdef int free_gammagamma(int64_t nmodels, double ***gamma):
 *     if gamma is NULL:
 *         return 0             # <<<<<<<<<<<<<<
 *     cdef int64_t i, j
 *     if gamma is not NULL:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3180
 * 
 * cdef int free_gammagamma(int64_t nmodels, double ***gamma):
 *     if gamma is NULL:             # <<<<<<<<<<<<<<
 *         return 0
 *     cdef int64_t i, j
*/
  }

  /* "H2MM_C.pyx":3183
 *         return 0
 *     cdef int64_t i, j
 *     if gamma is not NULL:             # <<<<<<<<<<<<<<
 *         for i in range(nmodels):
 *             if gamma[i] is not NULL:
*/
  __pyx_t_1 = (__pyx_v_gamma != NULL);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":3184
 *     cdef int64_t i, j
 *     if gamma is not NULL:
 *         for i in range(nmodels):             # <<<<<<<<<<<<<<
 *             if gamma[i] is not NULL:
 *                 PyMem_Free(gamma[i])
*/
    __pyx_t_2 = __pyx_v_nmodels;
    __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;

      /* "H2MM_C.pyx":3185
 *     if gamma is not NULL:
 *         for i in range(nmodels):
 *             if gamma[i] is not NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(gamma[i])
 *                 gamma[i] = NULL
*/
      __pyx_t_1 = ((__pyx_v_gamma[__pyx_v_i]) != NULL);
      if (__pyx_t_1) {

        /* "H2MM_C.pyx":3186
 *         for i in range(nmodels):
 *             if gamma[i] is not NULL:
 *                 PyMem_Free(gamma[i])             # <<<<<<<<<<<<<<
 *                 gamma[i] = NULL
 *         PyMem_Free(gamma)
*/
        PyMem_Free((__pyx_v_gamma[__pyx_v_i]));

        /* "H2MM_C.pyx":3187
 *             if gamma[i] is not NULL:
 *                 PyMem_Free(gamma[i])
 *                 gamma[i] = NULL             # <<<<<<<<<<<<<<
 *         PyMem_Free(gamma)
 *     return 0
*/
        (__pyx_v_gamma[__pyx_v_i]) = NULL;

        /* "H2MM_C.pyx":3185
 *     if gamma is not NULL:
 *         for i in range(nmodels):
 *             if gamma[i] is not NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(gamma[i])
 *                 gamma[i] = NULL
*/
      }
    }

    /* "H2MM_C.pyx":3188
 *                 PyMem_Free(gamma[i])
 *                 gamma[i] = NULL
 *         PyMem_Free(gamma)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
    PyMem_Free(__pyx_v_gamma);

    /* "H2MM_C.pyx":3183
 *         return 0
 *     cdef int64_t i, j
 *     if gamma is not NULL:             # <<<<<<<<<<<<<<
 *         for i in range(nmodels):
 *             if gamma[i] is not NULL:
*/
  }

  /* "H2MM_C.pyx":3189
 *                 gamma[i] = NULL
 *         PyMem_Free(gamma)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3179
 * 
 * 
 * cdef int free_gammagamma(int64_t nmodels, double ***gamma):             # <<<<<<<<<<<<<<
 *     if gamma is NULL:
 *         return 0
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":3192
 * 
 * 
 * def H2MM_arr(models, indexes, times, num_cores=None, gamma=False):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the logliklihood of every model in a list/array given a set of
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_13H2MM_arr(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_12H2MM_arr, "\n    Calculate the logliklihood of every model in a list/array given a set of\n    data\n\n    Parameters\n    ----------\n    models : list, tuple, or numpy.ndarray of h2mm_model objects\n        All of the :class:`h2mm_model` object for which the loglik will be calculated\n    indexes : list or tuple of NUMPY 1D int arrays\n        A list of the arrival indexes for each photon in each burst.\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The indexes list must maintain  1-to-1 correspondence to the times list\n    times : list or tuple of NUMPY 1D int arrays\n        A list of the arrival times for each photon in each burst\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The times list must maintain  1-to-1 correspondence to the indexes list\n    gamma : bool, optional\n        Whether or not to return the gamma array, which gives the probabilities\n        of each photon being in a given state.\n        the number of C threads (which ignore the gil, thus functioning more\n        like python processes), to use when calculating iterations.\n        \n        .. note:: \n            \n            optimization_limtis sets this to be `os.cpu_count() // 2`, as most machines\n            are multithreaded. Because os.cpu_count() returns the number of threads,\n            not necessarily the number of cpus. For most machines, being multithreaded,\n            this actually returns twice the number of physical cores. Hence the default\n            to set at `os.cpu_count() // 2`. If your machine is not multithreaded, it\n            is best to set `optimization_limits.num_cores = os.cpu_count()`\n            \n        If None (default) use value from optimization_limits. \n        Default is None\n        \n    Returns\n    -------\n    out : list tuple, or numpy.ndarray of h2mm_m""odel\n        A list, tuple, or numpy array of the :class:`h2mm_model` with the loglik computed\n        The converged state is automatically set to 0, and nphot is set\n        in accordance with the number of photons in the data set.\n        The datatype returned is the same as the datatype of h_model\n    gamma_arr : list, tuple or np.ndarray (optional)\n        If gamma = True, this variable is returned, which contains (as numpy arrays)\n        the probabilities of each photon to be in each state, for each burst and model.\n        The arrays are returned in the same order and type as the input models and \n        indexes, individual data points organized as [photon, state] within each data\n        sequence.\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_13H2MM_arr = {"H2MM_arr", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13H2MM_arr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_12H2MM_arr};
static PyObject *__pyx_pw_6H2MM_C_13H2MM_arr(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_models = 0;
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_gamma = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("H2MM_arr (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_models,&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_gamma,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3192, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "H2MM_arr", 0) < (0)) __PYX_ERR(0, 3192, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("H2MM_arr", 0, 3, 5, i); __PYX_ERR(0, 3192, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3192, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3192, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3192, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3192, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    }
    __pyx_v_models = values[0];
    __pyx_v_indexes = values[1];
    __pyx_v_times = values[2];
    __pyx_v_num_cores = values[3];
    __pyx_v_gamma = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("H2MM_arr", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 3192, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.H2MM_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6H2MM_C_12H2MM_arr(__pyx_self, __pyx_v_models, __pyx_v_indexes, __pyx_v_times, __pyx_v_num_cores, __pyx_v_gamma);

  /* function exit code */
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_12H2MM_arr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_models, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_gamma) {
  int __pyx_v_gamma_;
  lm __pyx_v_limits;
  int __pyx_v_burstsingle;
  int64_t __pyx_v_nbursts;
  int64_t *__pyx_v_burst_sizes;
  uint8_t **__pyx_v_idxs;
  int32_t **__pyx_v_deltas;
  PyObject *__pyx_v_burstshape = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_indxs = NULL;
  PyObject *__pyx_v_err = NULL;
  int __pyx_v_modelsingle;
  int64_t __pyx_v_nmodels;
  h2mm_mod *__pyx_v_out_mod;
  PyObject *__pyx_v_modelshape = NULL;
  PyArrayObject *__pyx_v_gamma_out = 0;
  double ***__pyx_v_gamma_arr;
  int __pyx_v_res;
  PyObject *__pyx_v_out = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_gamma_out;
  __Pyx_Buffer __pyx_pybuffer_gamma_out;
  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;
  size_t __pyx_t_6;
  int64_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("H2MM_arr", 0);
  __pyx_pybuffer_gamma_out.pybuffer.buf = NULL;
  __pyx_pybuffer_gamma_out.refcount = 0;
  __pyx_pybuffernd_gamma_out.data = NULL;
  __pyx_pybuffernd_gamma_out.rcbuffer = &__pyx_pybuffer_gamma_out;

  /* "H2MM_C.pyx":3243
 *         sequence.
 *     """
 *     cdef bint gamma_ = bool(gamma)             # <<<<<<<<<<<<<<
 *     cdef lm limits
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gamma); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3243, __pyx_L1_error)
  __pyx_v_gamma_ = (!(!__pyx_t_1));

  /* "H2MM_C.pyx":3245
 *     cdef bint gamma_ = bool(gamma)
 *     cdef lm limits
 *     limits.num_cores = <int64_t> optimization_limits._get_num_cores(num_cores)             # <<<<<<<<<<<<<<
 *     ########################## process input bursts  ##########################
 *     cdef bint burstsingle
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_num_cores); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_num_cores};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 3245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_7 = __Pyx_PyLong_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_7 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_limits.num_cores = ((int64_t)__pyx_t_7);

  /* "H2MM_C.pyx":3248
 *     ########################## process input bursts  ##########################
 *     cdef bint burstsingle
 *     cdef int64_t nbursts = 0             # <<<<<<<<<<<<<<
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
*/
  __pyx_v_nbursts = 0;

  /* "H2MM_C.pyx":3249
 *     cdef bint burstsingle
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL             # <<<<<<<<<<<<<<
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
*/
  __pyx_v_burst_sizes = NULL;

  /* "H2MM_C.pyx":3250
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL             # <<<<<<<<<<<<<<
 *     cdef int32_t **deltas = NULL
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)
*/
  __pyx_v_idxs = NULL;

  /* "H2MM_C.pyx":3251
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL             # <<<<<<<<<<<<<<
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
*/
  __pyx_v_deltas = NULL;

  /* "H2MM_C.pyx":3252
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)             # <<<<<<<<<<<<<<
 *     if err is not None:
 *         raise err
*/
  __pyx_t_2 = __pyx_f_6H2MM_C_cast_indexes_times(__pyx_v_indexes, __pyx_v_times, (&__pyx_v_burstsingle), (&__pyx_v_nbursts), (&__pyx_v_burst_sizes), (&__pyx_v_idxs), (&__pyx_v_deltas)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3252, __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_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3252, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3252, __pyx_L1_error)
  }
  __pyx_v_burstshape = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_indxs = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_err = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3253
 *     cdef int32_t **deltas = NULL
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     ############################ Cast models array ############################
*/
  __pyx_t_1 = (__pyx_v_err != Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":3254
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
 *         raise err             # <<<<<<<<<<<<<<
 *     ############################ Cast models array ############################
 *     cdef bint modelsingle = False
*/
    __Pyx_Raise(__pyx_v_err, 0, 0, 0);
    __PYX_ERR(0, 3254, __pyx_L1_error)

    /* "H2MM_C.pyx":3253
 *     cdef int32_t **deltas = NULL
 *     burstshape, indxs, err = cast_indexes_times(indexes, times, &burstsingle, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     ############################ Cast models array ############################
*/
  }

  /* "H2MM_C.pyx":3256
 *         raise err
 *     ############################ Cast models array ############################
 *     cdef bint modelsingle = False             # <<<<<<<<<<<<<<
 *     cdef int64_t nmodels = 0
 *     cdef h2mm_mod *out_mod = NULL
*/
  __pyx_v_modelsingle = 0;

  /* "H2MM_C.pyx":3257
 *     ############################ Cast models array ############################
 *     cdef bint modelsingle = False
 *     cdef int64_t nmodels = 0             # <<<<<<<<<<<<<<
 *     cdef h2mm_mod *out_mod = NULL
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)
*/
  __pyx_v_nmodels = 0;

  /* "H2MM_C.pyx":3258
 *     cdef bint modelsingle = False
 *     cdef int64_t nmodels = 0
 *     cdef h2mm_mod *out_mod = NULL             # <<<<<<<<<<<<<<
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)
 *     if not modelshape:
*/
  __pyx_v_out_mod = NULL;

  /* "H2MM_C.pyx":3259
 *     cdef int64_t nmodels = 0
 *     cdef h2mm_mod *out_mod = NULL
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)             # <<<<<<<<<<<<<<
 *     if not modelshape:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
  __pyx_t_2 = __pyx_f_6H2MM_C_make_h2mm_arr_modptr(__pyx_v_models, (&__pyx_v_modelsingle), (&__pyx_v_nmodels), (&__pyx_v_out_mod)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3259, __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_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3259, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3259, __pyx_L1_error)
  }
  __pyx_v_modelshape = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":3260
 *     cdef h2mm_mod *out_mod = NULL
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)
 *     if not modelshape:             # <<<<<<<<<<<<<<
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         raise err
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_modelshape); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3260, __pyx_L1_error)
  __pyx_t_8 = (!__pyx_t_1);
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":3261
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)
 *     if not modelshape:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *         raise err
 *     ############################# allocate for gamma ##########################
*/
    __pyx_t_9 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3261, __pyx_L1_error)

    /* "H2MM_C.pyx":3262
 *     if not modelshape:
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         raise err             # <<<<<<<<<<<<<<
 *     ############################# allocate for gamma ##########################
 *     cdef cnp.ndarray[object, ndim=2] gamma_out
*/
    __Pyx_Raise(__pyx_v_err, 0, 0, 0);
    __PYX_ERR(0, 3262, __pyx_L1_error)

    /* "H2MM_C.pyx":3260
 *     cdef h2mm_mod *out_mod = NULL
 *     modelshape, err = make_h2mm_arr_modptr(models, &modelsingle, &nmodels, &out_mod)
 *     if not modelshape:             # <<<<<<<<<<<<<<
 *         free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *         raise err
*/
  }

  /* "H2MM_C.pyx":3265
 *     ############################# allocate for gamma ##########################
 *     cdef cnp.ndarray[object, ndim=2] gamma_out
 *     cdef double ***gamma_arr = NULL             # <<<<<<<<<<<<<<
 *     if gamma_:
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
*/
  __pyx_v_gamma_arr = NULL;

  /* "H2MM_C.pyx":3266
 *     cdef cnp.ndarray[object, ndim=2] gamma_out
 *     cdef double ***gamma_arr = NULL
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
 *         if gamma_arr is NULL:
*/
  if (__pyx_v_gamma_) {

    /* "H2MM_C.pyx":3267
 *     cdef double ***gamma_arr = NULL
 *     if gamma_:
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)             # <<<<<<<<<<<<<<
 *         if gamma_arr is NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
    __pyx_t_2 = ((PyObject *)__pyx_f_6H2MM_C_make_gamma_gamma_arrays(__pyx_v_nmodels, __pyx_v_out_mod, __pyx_v_nbursts, __pyx_v_burst_sizes, (&__pyx_v_gamma_arr))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer);
      __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_9 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_gamma_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        }
        __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
      }
      __pyx_pybuffernd_gamma_out.diminfo[0].strides = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gamma_out.diminfo[0].shape = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_gamma_out.diminfo[1].strides = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_gamma_out.diminfo[1].shape = __pyx_pybuffernd_gamma_out.rcbuffer->pybuffer.shape[1];
      if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3267, __pyx_L1_error)
    }
    __pyx_v_gamma_out = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":3268
 *     if gamma_:
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
 *         if gamma_arr is NULL:             # <<<<<<<<<<<<<<
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             Py_free_models(nmodels, out_mod)
*/
    __pyx_t_8 = (__pyx_v_gamma_arr == NULL);
    if (unlikely(__pyx_t_8)) {

      /* "H2MM_C.pyx":3269
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
 *         if gamma_arr is NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *             Py_free_models(nmodels, out_mod)
 *             raise MemoryError("insufficient memory for gamma")
*/
      __pyx_t_9 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3269, __pyx_L1_error)

      /* "H2MM_C.pyx":3270
 *         if gamma_arr is NULL:
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             Py_free_models(nmodels, out_mod)             # <<<<<<<<<<<<<<
 *             raise MemoryError("insufficient memory for gamma")
 *     ############################ main calculation  ############################
*/
      __pyx_t_9 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_nmodels, __pyx_v_out_mod); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3270, __pyx_L1_error)

      /* "H2MM_C.pyx":3271
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             Py_free_models(nmodels, out_mod)
 *             raise MemoryError("insufficient memory for gamma")             # <<<<<<<<<<<<<<
 *     ############################ main calculation  ############################
 *     cdef int res
*/
      __pyx_t_3 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_for_gamma};
        __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3271, __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(0, 3271, __pyx_L1_error)

      /* "H2MM_C.pyx":3268
 *     if gamma_:
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
 *         if gamma_arr is NULL:             # <<<<<<<<<<<<<<
 *             free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *             Py_free_models(nmodels, out_mod)
*/
    }

    /* "H2MM_C.pyx":3266
 *     cdef cnp.ndarray[object, ndim=2] gamma_out
 *     cdef double ***gamma_arr = NULL
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         gamma_out = make_gamma_gamma_arrays(nmodels, out_mod, nbursts, burst_sizes, &gamma_arr)
 *         if gamma_arr is NULL:
*/
  }

  /* "H2MM_C.pyx":3274
 *     ############################ main calculation  ############################
 *     cdef int res
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if gamma_:
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "H2MM_C.pyx":3275
 *     cdef int res
 *     with nogil:
 *         if gamma_:             # <<<<<<<<<<<<<<
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)
 *         else:
*/
        if (__pyx_v_gamma_) {

          /* "H2MM_C.pyx":3276
 *     with nogil:
 *         if gamma_:
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)             # <<<<<<<<<<<<<<
 *         else:
 *             res = calc_multi(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &limits)
*/
          __pyx_v_res = calc_multi_gamma(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_nmodels, __pyx_v_out_mod, (&__pyx_v_gamma_arr), (&__pyx_v_limits));

          /* "H2MM_C.pyx":3275
 *     cdef int res
 *     with nogil:
 *         if gamma_:             # <<<<<<<<<<<<<<
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)
 *         else:
*/
          goto __pyx_L10;
        }

        /* "H2MM_C.pyx":3278
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)
 *         else:
 *             res = calc_multi(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &limits)             # <<<<<<<<<<<<<<
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_:
*/
        /*else*/ {
          __pyx_v_res = calc_multi(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_nmodels, __pyx_v_out_mod, (&__pyx_v_limits));
        }
        __pyx_L10:;
      }

      /* "H2MM_C.pyx":3274
 *     ############################ main calculation  ############################
 *     cdef int res
 *     with nogil:             # <<<<<<<<<<<<<<
 *         if gamma_:
 *             res = calc_multi_gamma(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &gamma_arr, &limits)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "H2MM_C.pyx":3279
 *         else:
 *             res = calc_multi(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &limits)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *     if gamma_:
 *         free_gammagamma(nmodels, gamma_arr)
*/
  __pyx_t_9 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3279, __pyx_L1_error)

  /* "H2MM_C.pyx":3280
 *             res = calc_multi(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &limits)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         free_gammagamma(nmodels, gamma_arr)
 *     ############################# check for error #############################
*/
  if (__pyx_v_gamma_) {

    /* "H2MM_C.pyx":3281
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_:
 *         free_gammagamma(nmodels, gamma_arr)             # <<<<<<<<<<<<<<
 *     ############################# check for error #############################
 *     if res == 0:
*/
    __pyx_t_9 = __pyx_f_6H2MM_C_free_gammagamma(__pyx_v_nmodels, __pyx_v_gamma_arr); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3281, __pyx_L1_error)

    /* "H2MM_C.pyx":3280
 *             res = calc_multi(nbursts, burst_sizes, deltas, idxs, nmodels, out_mod, &limits)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         free_gammagamma(nmodels, gamma_arr)
 *     ############################# check for error #############################
*/
  }

  /* "H2MM_C.pyx":3283
 *         free_gammagamma(nmodels, gamma_arr)
 *     ############################# check for error #############################
 *     if res == 0:             # <<<<<<<<<<<<<<
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)
 *         if modelsingle:
*/
  __pyx_t_8 = (__pyx_v_res == 0);
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":3284
 *     ############################# check for error #############################
 *     if res == 0:
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)             # <<<<<<<<<<<<<<
 *         if modelsingle:
 *             out = out[0]
*/
    __pyx_t_4 = ((PyObject *)__pyx_f_6H2MM_C_make_h2mm_out_arrays(__pyx_v_nmodels, __pyx_v_out_mod)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_modelshape};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 3284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_v_out = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":3285
 *     if res == 0:
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)
 *         if modelsingle:             # <<<<<<<<<<<<<<
 *             out = out[0]
 *     Py_free_models(nmodels, out_mod)
*/
    if (__pyx_v_modelsingle) {

      /* "H2MM_C.pyx":3286
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)
 *         if modelsingle:
 *             out = out[0]             # <<<<<<<<<<<<<<
 *     Py_free_models(nmodels, out_mod)
 *     out_mod = NULL
*/
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_out, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "H2MM_C.pyx":3285
 *     if res == 0:
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)
 *         if modelsingle:             # <<<<<<<<<<<<<<
 *             out = out[0]
 *     Py_free_models(nmodels, out_mod)
*/
    }

    /* "H2MM_C.pyx":3283
 *         free_gammagamma(nmodels, gamma_arr)
 *     ############################# check for error #############################
 *     if res == 0:             # <<<<<<<<<<<<<<
 *         out = make_h2mm_out_arrays(nmodels, out_mod).reshape(modelshape)
 *         if modelsingle:
*/
  }

  /* "H2MM_C.pyx":3287
 *         if modelsingle:
 *             out = out[0]
 *     Py_free_models(nmodels, out_mod)             # <<<<<<<<<<<<<<
 *     out_mod = NULL
 *     if res == 1:
*/
  __pyx_t_9 = __pyx_f_6H2MM_C_Py_free_models(__pyx_v_nmodels, __pyx_v_out_mod); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3287, __pyx_L1_error)

  /* "H2MM_C.pyx":3288
 *             out = out[0]
 *     Py_free_models(nmodels, out_mod)
 *     out_mod = NULL             # <<<<<<<<<<<<<<
 *     if res == 1:
 *         raise ValueError('Bursts photons are out of order, please check your data')
*/
  __pyx_v_out_mod = NULL;

  /* "H2MM_C.pyx":3289
 *     Py_free_models(nmodels, out_mod)
 *     out_mod = NULL
 *     if res == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Bursts photons are out of order, please check your data')
 *     elif res == 2:
*/
  switch (__pyx_v_res) {
    case 1:

    /* "H2MM_C.pyx":3290
 *     out_mod = NULL
 *     if res == 1:
 *         raise ValueError('Bursts photons are out of order, please check your data')             # <<<<<<<<<<<<<<
 *     elif res == 2:
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Bursts_photons_are_out_of_order};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3290, __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(0, 3290, __pyx_L1_error)

    /* "H2MM_C.pyx":3289
 *     Py_free_models(nmodels, out_mod)
 *     out_mod = NULL
 *     if res == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Bursts photons are out of order, please check your data')
 *     elif res == 2:
*/
    break;
    case 2:

    /* "H2MM_C.pyx":3292
 *         raise ValueError('Bursts photons are out of order, please check your data')
 *     elif res == 2:
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')             # <<<<<<<<<<<<<<
 *     if gamma_:
 *         if modelsingle and burstsingle:
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Too_many_photon_streams_in_data_2};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3292, __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(0, 3292, __pyx_L1_error)

    /* "H2MM_C.pyx":3291
 *     if res == 1:
 *         raise ValueError('Bursts photons are out of order, please check your data')
 *     elif res == 2:             # <<<<<<<<<<<<<<
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
 *     if gamma_:
*/
    break;
    default: break;
  }

  /* "H2MM_C.pyx":3293
 *     elif res == 2:
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         if modelsingle and burstsingle:
 *             out = (out, gamma_out[0])
*/
  if (__pyx_v_gamma_) {

    /* "H2MM_C.pyx":3294
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
 *     if gamma_:
 *         if modelsingle and burstsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out[0])
 *         elif modelsingle:
*/
    if (__pyx_v_modelsingle) {
    } else {
      __pyx_t_8 = __pyx_v_modelsingle;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_8 = __pyx_v_burstsingle;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_8) {

      /* "H2MM_C.pyx":3295
 *     if gamma_:
 *         if modelsingle and burstsingle:
 *             out = (out, gamma_out[0])             # <<<<<<<<<<<<<<
 *         elif modelsingle:
 *             out = (out, gamma_out.reshape(burstshape))
*/
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3295, __pyx_L1_error) }
      __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_gamma_out), 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_GIVEREF(__pyx_v_out);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 3295, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 3295, __pyx_L1_error);
      __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":3294
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
 *     if gamma_:
 *         if modelsingle and burstsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out[0])
 *         elif modelsingle:
*/
      goto __pyx_L15;
    }

    /* "H2MM_C.pyx":3296
 *         if modelsingle and burstsingle:
 *             out = (out, gamma_out[0])
 *         elif modelsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out.reshape(burstshape))
 *         elif burstsingle:
*/
    if (__pyx_v_modelsingle) {

      /* "H2MM_C.pyx":3297
 *             out = (out, gamma_out[0])
 *         elif modelsingle:
 *             out = (out, gamma_out.reshape(burstshape))             # <<<<<<<<<<<<<<
 *         elif burstsingle:
 *             out = (out, gamma_out.reshape(modelshape))
*/
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3297, __pyx_L1_error) }
      __pyx_t_2 = ((PyObject *)__pyx_v_gamma_out);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_burstshape};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3297, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_GIVEREF(__pyx_v_out);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 3297, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3297, __pyx_L1_error);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "H2MM_C.pyx":3296
 *         if modelsingle and burstsingle:
 *             out = (out, gamma_out[0])
 *         elif modelsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out.reshape(burstshape))
 *         elif burstsingle:
*/
      goto __pyx_L15;
    }

    /* "H2MM_C.pyx":3298
 *         elif modelsingle:
 *             out = (out, gamma_out.reshape(burstshape))
 *         elif burstsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out.reshape(modelshape))
 *         else:
*/
    if (__pyx_v_burstsingle) {

      /* "H2MM_C.pyx":3299
 *             out = (out, gamma_out.reshape(burstshape))
 *         elif burstsingle:
 *             out = (out, gamma_out.reshape(modelshape))             # <<<<<<<<<<<<<<
 *         else:
 *             out = (out, gamma_out.reshape(modelshape+burstshape))
*/
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3299, __pyx_L1_error) }
      __pyx_t_4 = ((PyObject *)__pyx_v_gamma_out);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_modelshape};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3299, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_GIVEREF(__pyx_v_out);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 3299, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 3299, __pyx_L1_error);
      __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "H2MM_C.pyx":3298
 *         elif modelsingle:
 *             out = (out, gamma_out.reshape(burstshape))
 *         elif burstsingle:             # <<<<<<<<<<<<<<
 *             out = (out, gamma_out.reshape(modelshape))
 *         else:
*/
      goto __pyx_L15;
    }

    /* "H2MM_C.pyx":3301
 *             out = (out, gamma_out.reshape(modelshape))
 *         else:
 *             out = (out, gamma_out.reshape(modelshape+burstshape))             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
    /*else*/ {
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3301, __pyx_L1_error) }
      __pyx_t_2 = ((PyObject *)__pyx_v_gamma_out);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Add(__pyx_v_modelshape, __pyx_v_burstshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3301, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_out);
      __Pyx_GIVEREF(__pyx_v_out);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_out) != (0)) __PYX_ERR(0, 3301, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_4);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3301, __pyx_L1_error);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L15:;

    /* "H2MM_C.pyx":3293
 *     elif res == 2:
 *         raise ValueError('Too many photon streams in data for one or more H2MM models')
 *     if gamma_:             # <<<<<<<<<<<<<<
 *         if modelsingle and burstsingle:
 *             out = (out, gamma_out[0])
*/
  }

  /* "H2MM_C.pyx":3302
 *         else:
 *             out = (out, gamma_out.reshape(modelshape+burstshape))
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 3302, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3192
 * 
 * 
 * def H2MM_arr(models, indexes, times, num_cores=None, gamma=False):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the logliklihood of every model in a list/array given a set of
*/

  /* 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);
  { 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_gamma_out.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.H2MM_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gamma_out.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_burstshape);
  __Pyx_XDECREF(__pyx_v_indxs);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF(__pyx_v_modelshape);
  __Pyx_XDECREF((PyObject *)__pyx_v_gamma_out);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3306
 * 
 * # viterbi function
 * cdef tuple make_ph_path_arrays(int64_t nbursts, int64_t *burst_sizes, int64_t nstate, ph_path **paths):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] state_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef cnp.ndarray[object, ndim=1] scale_paths = np.empty(nbursts, dtype=np.object_)
*/

static PyObject *__pyx_f_6H2MM_C_make_ph_path_arrays(int64_t __pyx_v_nbursts, int64_t *__pyx_v_burst_sizes, int64_t __pyx_v_nstate, ph_path **__pyx_v_paths) {
  PyArrayObject *__pyx_v_state_paths = 0;
  PyArrayObject *__pyx_v_scale_paths = 0;
  ph_path *__pyx_v_cpaths;
  PyArrayObject *__pyx_v_statetemp = 0;
  PyArrayObject *__pyx_v_scaletemp = 0;
  PyObject *__pyx_v_i = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scale_paths;
  __Pyx_Buffer __pyx_pybuffer_scale_paths;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scaletemp;
  __Pyx_Buffer __pyx_pybuffer_scaletemp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_state_paths;
  __Pyx_Buffer __pyx_pybuffer_state_paths;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_statetemp;
  __Pyx_Buffer __pyx_pybuffer_statetemp;
  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;
  size_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_ph_path_arrays", 0);
  __pyx_pybuffer_state_paths.pybuffer.buf = NULL;
  __pyx_pybuffer_state_paths.refcount = 0;
  __pyx_pybuffernd_state_paths.data = NULL;
  __pyx_pybuffernd_state_paths.rcbuffer = &__pyx_pybuffer_state_paths;
  __pyx_pybuffer_scale_paths.pybuffer.buf = NULL;
  __pyx_pybuffer_scale_paths.refcount = 0;
  __pyx_pybuffernd_scale_paths.data = NULL;
  __pyx_pybuffernd_scale_paths.rcbuffer = &__pyx_pybuffer_scale_paths;
  __pyx_pybuffer_statetemp.pybuffer.buf = NULL;
  __pyx_pybuffer_statetemp.refcount = 0;
  __pyx_pybuffernd_statetemp.data = NULL;
  __pyx_pybuffernd_statetemp.rcbuffer = &__pyx_pybuffer_statetemp;
  __pyx_pybuffer_scaletemp.pybuffer.buf = NULL;
  __pyx_pybuffer_scaletemp.refcount = 0;
  __pyx_pybuffernd_scaletemp.data = NULL;
  __pyx_pybuffernd_scaletemp.rcbuffer = &__pyx_pybuffer_scaletemp;

  /* "H2MM_C.pyx":3307
 * # viterbi function
 * cdef tuple make_ph_path_arrays(int64_t nbursts, int64_t *burst_sizes, int64_t nstate, ph_path **paths):
 *     cdef cnp.ndarray[object, ndim=1] state_paths = np.empty(nbursts, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] scale_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef ph_path *cpaths = <ph_path*> PyMem_Malloc(nbursts*sizeof(ph_path))
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3307, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3307, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_state_paths.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_state_paths = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_state_paths.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3307, __pyx_L1_error)
    } else {__pyx_pybuffernd_state_paths.diminfo[0].strides = __pyx_pybuffernd_state_paths.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_state_paths.diminfo[0].shape = __pyx_pybuffernd_state_paths.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_state_paths = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3308
 * cdef tuple make_ph_path_arrays(int64_t nbursts, int64_t *burst_sizes, int64_t nstate, ph_path **paths):
 *     cdef cnp.ndarray[object, ndim=1] state_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef cnp.ndarray[object, ndim=1] scale_paths = np.empty(nbursts, dtype=np.object_)             # <<<<<<<<<<<<<<
 *     cdef ph_path *cpaths = <ph_path*> PyMem_Malloc(nbursts*sizeof(ph_path))
 *     cdef cnp.ndarray[uint8_t, ndim=1] statetemp
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_object_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_5};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_2, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3308, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3308, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scale_paths.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_scale_paths = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_scale_paths.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3308, __pyx_L1_error)
    } else {__pyx_pybuffernd_scale_paths.diminfo[0].strides = __pyx_pybuffernd_scale_paths.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scale_paths.diminfo[0].shape = __pyx_pybuffernd_scale_paths.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_scale_paths = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3309
 *     cdef cnp.ndarray[object, ndim=1] state_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef cnp.ndarray[object, ndim=1] scale_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef ph_path *cpaths = <ph_path*> PyMem_Malloc(nbursts*sizeof(ph_path))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] statetemp
 *     cdef cnp.ndarray[double, ndim=1] scaletemp
*/
  __pyx_v_cpaths = ((ph_path *)PyMem_Malloc((__pyx_v_nbursts * (sizeof(ph_path)))));

  /* "H2MM_C.pyx":3313
 *     cdef cnp.ndarray[double, ndim=1] scaletemp
 *     cdef i
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         try:
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
*/
  __pyx_t_6 = NULL;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    {
      __pyx_t_1 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3313, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3314
 *     cdef i
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
 *         except:
*/
    {
      __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:*/ {

        /* "H2MM_C.pyx":3315
 *     for i in range(nbursts):
 *         try:
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)             # <<<<<<<<<<<<<<
 *         except:
 *             PyMem_Free(cpaths)
*/
        __pyx_t_6 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3315, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3315, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3315, __pyx_L5_error)
        __pyx_t_2 = __Pyx_PyLong_From_int64_t((__pyx_v_burst_sizes[__pyx_t_12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3315, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3315, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3315, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_t_2};
          __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3315, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_13, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3315, __pyx_L5_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3315, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3315, __pyx_L5_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_statetemp.rcbuffer->pybuffer);
          __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_statetemp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_14 < 0)) {
            PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_statetemp.rcbuffer->pybuffer, (PyObject*)__pyx_v_statetemp, &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
            }
            __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
          }
          __pyx_pybuffernd_statetemp.diminfo[0].strides = __pyx_pybuffernd_statetemp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_statetemp.diminfo[0].shape = __pyx_pybuffernd_statetemp.rcbuffer->pybuffer.shape[0];
          if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 3315, __pyx_L5_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_statetemp, ((PyArrayObject *)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3314
 *     cdef i
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
 *         except:
*/
      }
      __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_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "H2MM_C.pyx":3316
 *         try:
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
 *         except:             # <<<<<<<<<<<<<<
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
*/
      /*except:*/ {
        __Pyx_AddTraceback("H2MM_C.make_ph_path_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 3316, __pyx_L7_except_error)
        __Pyx_XGOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_4);

        /* "H2MM_C.pyx":3317
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
 *         except:
 *             PyMem_Free(cpaths)             # <<<<<<<<<<<<<<
 *             return state_paths, scale_paths
 *         try:
*/
        PyMem_Free(__pyx_v_cpaths);

        /* "H2MM_C.pyx":3318
 *         except:
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths             # <<<<<<<<<<<<<<
 *         try:
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3318, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF((PyObject *)__pyx_v_state_paths);
        __Pyx_GIVEREF((PyObject *)__pyx_v_state_paths);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_state_paths)) != (0)) __PYX_ERR(0, 3318, __pyx_L7_except_error);
        __Pyx_INCREF((PyObject *)__pyx_v_scale_paths);
        __Pyx_GIVEREF((PyObject *)__pyx_v_scale_paths);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_scale_paths)) != (0)) __PYX_ERR(0, 3318, __pyx_L7_except_error);
        __pyx_r = ((PyObject*)__pyx_t_13);
        __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __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;
        goto __pyx_L8_except_return;
      }

      /* "H2MM_C.pyx":3314
 *     cdef i
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
 *         except:
*/
      __pyx_L7_except_error:;
      __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_L8_except_return:;
      __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_L0;
      __pyx_L12_try_end:;
    }

    /* "H2MM_C.pyx":3319
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
 *         try:             # <<<<<<<<<<<<<<
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except:
*/
    {
      __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:*/ {

        /* "H2MM_C.pyx":3320
 *             return state_paths, scale_paths
 *         try:
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)             # <<<<<<<<<<<<<<
 *         except:
 *             PyMem_Free(cpaths)
*/
        __pyx_t_5 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3320, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3320, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3320, __pyx_L15_error)
        __pyx_t_1 = __Pyx_PyLong_From_int64_t((__pyx_v_burst_sizes[__pyx_t_12])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3320, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3320, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3320, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_1};
          __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3320, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3320, __pyx_L15_error)
          __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3320, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3320, __pyx_L15_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scaletemp.rcbuffer->pybuffer);
          __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scaletemp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_14 < 0)) {
            PyErr_Fetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scaletemp.rcbuffer->pybuffer, (PyObject*)__pyx_v_scaletemp, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
            }
            __pyx_t_17 = __pyx_t_16 = __pyx_t_15 = 0;
          }
          __pyx_pybuffernd_scaletemp.diminfo[0].strides = __pyx_pybuffernd_scaletemp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scaletemp.diminfo[0].shape = __pyx_pybuffernd_scaletemp.rcbuffer->pybuffer.shape[0];
          if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 3320, __pyx_L15_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_scaletemp, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "H2MM_C.pyx":3319
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
 *         try:             # <<<<<<<<<<<<<<
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except:
*/
      }
      __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_L22_try_end;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "H2MM_C.pyx":3321
 *         try:
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except:             # <<<<<<<<<<<<<<
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
*/
      /*except:*/ {
        __Pyx_AddTraceback("H2MM_C.make_ph_path_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_13, &__pyx_t_2) < 0) __PYX_ERR(0, 3321, __pyx_L17_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_2);

        /* "H2MM_C.pyx":3322
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except:
 *             PyMem_Free(cpaths)             # <<<<<<<<<<<<<<
 *             return state_paths, scale_paths
 *         state_paths[i] = statetemp
*/
        PyMem_Free(__pyx_v_cpaths);

        /* "H2MM_C.pyx":3323
 *         except:
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths             # <<<<<<<<<<<<<<
 *         state_paths[i] = statetemp
 *         scale_paths[i] = scaletemp
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3323, __pyx_L17_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF((PyObject *)__pyx_v_state_paths);
        __Pyx_GIVEREF((PyObject *)__pyx_v_state_paths);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_state_paths)) != (0)) __PYX_ERR(0, 3323, __pyx_L17_except_error);
        __Pyx_INCREF((PyObject *)__pyx_v_scale_paths);
        __Pyx_GIVEREF((PyObject *)__pyx_v_scale_paths);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_scale_paths)) != (0)) __PYX_ERR(0, 3323, __pyx_L17_except_error);
        __pyx_r = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;
        __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_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L18_except_return;
      }

      /* "H2MM_C.pyx":3319
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
 *         try:             # <<<<<<<<<<<<<<
 *             scaletemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except:
*/
      __pyx_L17_except_error:;
      __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_L18_except_return:;
      __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_L0;
      __pyx_L22_try_end:;
    }

    /* "H2MM_C.pyx":3324
 *             PyMem_Free(cpaths)
 *             return state_paths, scale_paths
 *         state_paths[i] = statetemp             # <<<<<<<<<<<<<<
 *         scale_paths[i] = scaletemp
 *         cpaths[i].path = <uint8_t*> statetemp.data
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_state_paths), __pyx_v_i, ((PyObject *)__pyx_v_statetemp)) < 0))) __PYX_ERR(0, 3324, __pyx_L1_error)

    /* "H2MM_C.pyx":3325
 *             return state_paths, scale_paths
 *         state_paths[i] = statetemp
 *         scale_paths[i] = scaletemp             # <<<<<<<<<<<<<<
 *         cpaths[i].path = <uint8_t*> statetemp.data
 *         cpaths[i].scale = <double*> scaletemp.data
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_scale_paths), __pyx_v_i, ((PyObject *)__pyx_v_scaletemp)) < 0))) __PYX_ERR(0, 3325, __pyx_L1_error)

    /* "H2MM_C.pyx":3326
 *         state_paths[i] = statetemp
 *         scale_paths[i] = scaletemp
 *         cpaths[i].path = <uint8_t*> statetemp.data             # <<<<<<<<<<<<<<
 *         cpaths[i].scale = <double*> scaletemp.data
 *         cpaths[i].nstate = nstate
*/
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3326, __pyx_L1_error)
    (__pyx_v_cpaths[__pyx_t_12]).path = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_statetemp)));

    /* "H2MM_C.pyx":3327
 *         scale_paths[i] = scaletemp
 *         cpaths[i].path = <uint8_t*> statetemp.data
 *         cpaths[i].scale = <double*> scaletemp.data             # <<<<<<<<<<<<<<
 *         cpaths[i].nstate = nstate
 *         cpaths[i].nphot = burst_sizes[i]
*/
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3327, __pyx_L1_error)
    (__pyx_v_cpaths[__pyx_t_12]).scale = ((double *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_scaletemp)));

    /* "H2MM_C.pyx":3328
 *         cpaths[i].path = <uint8_t*> statetemp.data
 *         cpaths[i].scale = <double*> scaletemp.data
 *         cpaths[i].nstate = nstate             # <<<<<<<<<<<<<<
 *         cpaths[i].nphot = burst_sizes[i]
 *     paths[0] = cpaths
*/
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3328, __pyx_L1_error)
    (__pyx_v_cpaths[__pyx_t_12]).nstate = __pyx_v_nstate;

    /* "H2MM_C.pyx":3329
 *         cpaths[i].scale = <double*> scaletemp.data
 *         cpaths[i].nstate = nstate
 *         cpaths[i].nphot = burst_sizes[i]             # <<<<<<<<<<<<<<
 *     paths[0] = cpaths
 *     return state_paths, scale_paths
*/
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3329, __pyx_L1_error)
    __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3329, __pyx_L1_error)
    (__pyx_v_cpaths[__pyx_t_18]).nphot = (__pyx_v_burst_sizes[__pyx_t_12]);

    /* "H2MM_C.pyx":3313
 *     cdef cnp.ndarray[double, ndim=1] scaletemp
 *     cdef i
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         try:
 *             statetemp = np.empty(burst_sizes[i], dtype=np.uint8)
*/
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "H2MM_C.pyx":3330
 *         cpaths[i].nstate = nstate
 *         cpaths[i].nphot = burst_sizes[i]
 *     paths[0] = cpaths             # <<<<<<<<<<<<<<
 *     return state_paths, scale_paths
 * 
*/
  (__pyx_v_paths[0]) = __pyx_v_cpaths;

  /* "H2MM_C.pyx":3331
 *         cpaths[i].nphot = burst_sizes[i]
 *     paths[0] = cpaths
 *     return state_paths, scale_paths             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_state_paths);
  __Pyx_GIVEREF((PyObject *)__pyx_v_state_paths);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_state_paths)) != (0)) __PYX_ERR(0, 3331, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_scale_paths);
  __Pyx_GIVEREF((PyObject *)__pyx_v_scale_paths);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_scale_paths)) != (0)) __PYX_ERR(0, 3331, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3306
 * 
 * # viterbi function
 * cdef tuple make_ph_path_arrays(int64_t nbursts, int64_t *burst_sizes, int64_t nstate, ph_path **paths):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] state_paths = np.empty(nbursts, dtype=np.object_)
 *     cdef cnp.ndarray[object, ndim=1] scale_paths = np.empty(nbursts, dtype=np.object_)
*/

  /* 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_13);
  { 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_scale_paths.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scaletemp.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_state_paths.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_statetemp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.make_ph_path_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale_paths.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scaletemp.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_state_paths.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_statetemp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_state_paths);
  __Pyx_XDECREF((PyObject *)__pyx_v_scale_paths);
  __Pyx_XDECREF((PyObject *)__pyx_v_statetemp);
  __Pyx_XDECREF((PyObject *)__pyx_v_scaletemp);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3334
 * 
 * 
 * def viterbi_path(h2mm_model h_mod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the most likely state path through a set of data given a H2MM model
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_15viterbi_path(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_14viterbi_path, "\n    Calculate the most likely state path through a set of data given a H2MM model\n\n    Parameters\n    ----------\n    h_model : h2mm_model\n        An :class:`h2mm_model`, should be optimized for the given data set\n        (result of :func:`EM_H2MM_C` or :meth:`h2mm_model.optimize`) to ensure results correspond to give the most likely\n        path\n    indexes : list or tuple of NUMPY 1D int arrays\n        A list of the arrival indexes for each photon in each burst.\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The indexes list must maintain  1-to-1 correspondence to the times list\n    times : list or tuple of NUMPY 1D int arrays\n        A list of the arrival times for each photon in each burst\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The times list must maintain  1-to-1 correspondence to the indexes list\n    num_cores : int or None, optional\n        the number of C threads (which ignore the gil, thus functioning more\n        like python processes), to use when calculating iterations.\n        Note that os.cpu_count() returns number of threads, but it is ideal \n        to take the number of physical cores. Therefore, unless reset by user,\n        optimization_limtis sets this to be os.cpu_count() // 2, as most machines\n        are multithreaded. If None (default) use value from optimization_limits. \n        Default is None\n    \n    Returns\n    -------\n    path : list of NUMPY 1D int arrays\n        The most likely state path for each photon\n    scale : list of NUMPY 1D float arrays\n        The posterior probability for each photon\n    ll : NUMPY 1D float array\n        loglikelihood of each burst\n    icl : float\n        Integrated complete likelihood, essentially the BIC for the *Viterbi* path\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_15viterbi_path = {"viterbi_path", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_15viterbi_path, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_14viterbi_path};
static PyObject *__pyx_pw_6H2MM_C_15viterbi_path(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_h_mod = 0;
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_num_cores = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("viterbi_path (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_h_mod,&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_num_cores,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3334, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3334, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3334, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3334, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3334, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "viterbi_path", 0) < (0)) __PYX_ERR(0, 3334, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("viterbi_path", 0, 3, 4, i); __PYX_ERR(0, 3334, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3334, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3334, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3334, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3334, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_h_mod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_indexes = values[1];
    __pyx_v_times = values[2];
    __pyx_v_num_cores = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("viterbi_path", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 3334, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.viterbi_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_h_mod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "h_mod", 0))) __PYX_ERR(0, 3334, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_14viterbi_path(__pyx_self, __pyx_v_h_mod, __pyx_v_indexes, __pyx_v_times, __pyx_v_num_cores);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_14viterbi_path(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_h_mod, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores) {
  int __pyx_v_single;
  int64_t __pyx_v_nbursts;
  int64_t *__pyx_v_burst_sizes;
  uint8_t **__pyx_v_idxs;
  int32_t **__pyx_v_deltas;
  PyObject *__pyx_v_shape = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_indxs = NULL;
  PyObject *__pyx_v_err = NULL;
  int64_t __pyx_v_i;
  int64_t __pyx_v_nphot;
  int64_t __pyx_v_n_core;
  ph_path *__pyx_v_cpaths;
  PyArrayObject *__pyx_v_paths = 0;
  PyArrayObject *__pyx_v_scale = 0;
  CYTHON_UNUSED int __pyx_v_ret;
  PyArrayObject *__pyx_v_ll = 0;
  double __pyx_v_loglik;
  double __pyx_v_icl;
  PyObject *__pyx_v_out = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ll;
  __Pyx_Buffer __pyx_pybuffer_ll;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_paths;
  __Pyx_Buffer __pyx_pybuffer_paths;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scale;
  __Pyx_Buffer __pyx_pybuffer_scale;
  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;
  int64_t __pyx_t_6;
  int64_t __pyx_t_7;
  int64_t __pyx_t_8;
  size_t __pyx_t_9;
  int __pyx_t_10;
  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;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  double __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("viterbi_path", 0);
  __pyx_pybuffer_paths.pybuffer.buf = NULL;
  __pyx_pybuffer_paths.refcount = 0;
  __pyx_pybuffernd_paths.data = NULL;
  __pyx_pybuffernd_paths.rcbuffer = &__pyx_pybuffer_paths;
  __pyx_pybuffer_scale.pybuffer.buf = NULL;
  __pyx_pybuffer_scale.refcount = 0;
  __pyx_pybuffernd_scale.data = NULL;
  __pyx_pybuffernd_scale.rcbuffer = &__pyx_pybuffer_scale;
  __pyx_pybuffer_ll.pybuffer.buf = NULL;
  __pyx_pybuffer_ll.refcount = 0;
  __pyx_pybuffernd_ll.data = NULL;
  __pyx_pybuffernd_ll.rcbuffer = &__pyx_pybuffer_ll;

  /* "H2MM_C.pyx":3374
 *         Integrated complete likelihood, essentially the BIC for the *Viterbi* path
 *     """
 *     cdef bint single = False             # <<<<<<<<<<<<<<
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
*/
  __pyx_v_single = 0;

  /* "H2MM_C.pyx":3375
 *     """
 *     cdef bint single = False
 *     cdef int64_t nbursts = 0             # <<<<<<<<<<<<<<
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
*/
  __pyx_v_nbursts = 0;

  /* "H2MM_C.pyx":3376
 *     cdef bint single = False
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL             # <<<<<<<<<<<<<<
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
*/
  __pyx_v_burst_sizes = NULL;

  /* "H2MM_C.pyx":3377
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL             # <<<<<<<<<<<<<<
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
*/
  __pyx_v_idxs = NULL;

  /* "H2MM_C.pyx":3378
 *     cdef int64_t *burst_sizes = NULL
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL             # <<<<<<<<<<<<<<
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
*/
  __pyx_v_deltas = NULL;

  /* "H2MM_C.pyx":3379
 *     cdef uint8_t **idxs = NULL
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)             # <<<<<<<<<<<<<<
 *     if err is not None:
 *         raise err
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_cast_indexes_times(__pyx_v_indexes, __pyx_v_times, (&__pyx_v_single), (&__pyx_v_nbursts), (&__pyx_v_burst_sizes), (&__pyx_v_idxs), (&__pyx_v_deltas)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3379, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3379, __pyx_L1_error)
  }
  __pyx_v_shape = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_indxs = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_err = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3380
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t i
*/
  __pyx_t_5 = (__pyx_v_err != Py_None);
  if (unlikely(__pyx_t_5)) {

    /* "H2MM_C.pyx":3381
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:
 *         raise err             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     cdef int64_t nphot = 0
*/
    __Pyx_Raise(__pyx_v_err, 0, 0, 0);
    __PYX_ERR(0, 3381, __pyx_L1_error)

    /* "H2MM_C.pyx":3380
 *     cdef int32_t **deltas = NULL
 *     shape, indxs, err = cast_indexes_times(indexes, times, &single, &nbursts, &burst_sizes, &idxs, &deltas)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t i
*/
  }

  /* "H2MM_C.pyx":3383
 *         raise err
 *     cdef int64_t i
 *     cdef int64_t nphot = 0             # <<<<<<<<<<<<<<
 *     for i in range(nbursts):
 *         nphot += burst_sizes[i]
*/
  __pyx_v_nphot = 0;

  /* "H2MM_C.pyx":3384
 *     cdef int64_t i
 *     cdef int64_t nphot = 0
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         nphot += burst_sizes[i]
 *     cdef int64_t n_core = <int64_t> optimization_limits._get_num_cores(num_cores)
*/
  __pyx_t_6 = __pyx_v_nbursts;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "H2MM_C.pyx":3385
 *     cdef int64_t nphot = 0
 *     for i in range(nbursts):
 *         nphot += burst_sizes[i]             # <<<<<<<<<<<<<<
 *     cdef int64_t n_core = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     cdef ph_path *cpaths = NULL
*/
    __pyx_v_nphot = (__pyx_v_nphot + (__pyx_v_burst_sizes[__pyx_v_i]));
  }

  /* "H2MM_C.pyx":3386
 *     for i in range(nbursts):
 *         nphot += burst_sizes[i]
 *     cdef int64_t n_core = <int64_t> optimization_limits._get_num_cores(num_cores)             # <<<<<<<<<<<<<<
 *     cdef ph_path *cpaths = NULL
 *     cdef cnp.ndarray[object,ndim=1] paths
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_num_cores); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_9 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_num_cores};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 3386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyLong_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n_core = ((int64_t)__pyx_t_6);

  /* "H2MM_C.pyx":3387
 *         nphot += burst_sizes[i]
 *     cdef int64_t n_core = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     cdef ph_path *cpaths = NULL             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object,ndim=1] paths
 *     cdef cnp.ndarray[object,ndim=1] scale
*/
  __pyx_v_cpaths = NULL;

  /* "H2MM_C.pyx":3390
 *     cdef cnp.ndarray[object,ndim=1] paths
 *     cdef cnp.ndarray[object,ndim=1] scale
 *     paths, scale = make_ph_path_arrays(nbursts, burst_sizes, h_mod.model.nstate, &cpaths)             # <<<<<<<<<<<<<<
 *     if cpaths == NULL:
 *         raise MemoryError("insufficent memory to allocate path arrays")
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_make_ph_path_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_h_mod->model->nstate, (&__pyx_v_cpaths)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3390, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3390, __pyx_L1_error)
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3390, __pyx_L1_error)
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3390, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_paths.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_paths.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_paths.rcbuffer->pybuffer, (PyObject*)__pyx_v_paths, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_paths.diminfo[0].strides = __pyx_pybuffernd_paths.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_paths.diminfo[0].shape = __pyx_pybuffernd_paths.rcbuffer->pybuffer.shape[0];
    if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3390, __pyx_L1_error)
  }
  __pyx_v_paths = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scale.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_scale.rcbuffer->pybuffer, (PyObject*)__pyx_v_scale, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_scale.diminfo[0].strides = __pyx_pybuffernd_scale.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scale.diminfo[0].shape = __pyx_pybuffernd_scale.rcbuffer->pybuffer.shape[0];
    if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3390, __pyx_L1_error)
  }
  __pyx_v_scale = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3391
 *     cdef cnp.ndarray[object,ndim=1] scale
 *     paths, scale = make_ph_path_arrays(nbursts, burst_sizes, h_mod.model.nstate, &cpaths)
 *     if cpaths == NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError("insufficent memory to allocate path arrays")
 *     cdef int ret
*/
  __pyx_t_5 = (__pyx_v_cpaths == NULL);
  if (unlikely(__pyx_t_5)) {

    /* "H2MM_C.pyx":3392
 *     paths, scale = make_ph_path_arrays(nbursts, burst_sizes, h_mod.model.nstate, &cpaths)
 *     if cpaths == NULL:
 *         raise MemoryError("insufficent memory to allocate path arrays")             # <<<<<<<<<<<<<<
 *     cdef int ret
 *     with nogil:
*/
    __pyx_t_4 = NULL;
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_insufficent_memory_to_allocate_p};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3392, __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, 3392, __pyx_L1_error)

    /* "H2MM_C.pyx":3391
 *     cdef cnp.ndarray[object,ndim=1] scale
 *     paths, scale = make_ph_path_arrays(nbursts, burst_sizes, h_mod.model.nstate, &cpaths)
 *     if cpaths == NULL:             # <<<<<<<<<<<<<<
 *         raise MemoryError("insufficent memory to allocate path arrays")
 *     cdef int ret
*/
  }

  /* "H2MM_C.pyx":3394
 *         raise MemoryError("insufficent memory to allocate path arrays")
 *     cdef int ret
 *     with nogil:             # <<<<<<<<<<<<<<
 *         ret = viterbi(nbursts, burst_sizes, deltas, idxs, h_mod.model, cpaths, n_core)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
  {
      PyThreadState * _save;
      _save = PyEval_SaveThread();
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "H2MM_C.pyx":3395
 *     cdef int ret
 *     with nogil:
 *         ret = viterbi(nbursts, burst_sizes, deltas, idxs, h_mod.model, cpaths, n_core)             # <<<<<<<<<<<<<<
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     cdef cnp.ndarray[double] ll
*/
        __pyx_v_ret = viterbi(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_deltas, __pyx_v_idxs, __pyx_v_h_mod->model, __pyx_v_cpaths, __pyx_v_n_core);
      }

      /* "H2MM_C.pyx":3394
 *         raise MemoryError("insufficent memory to allocate path arrays")
 *     cdef int ret
 *     with nogil:             # <<<<<<<<<<<<<<
 *         ret = viterbi(nbursts, burst_sizes, deltas, idxs, h_mod.model, cpaths, n_core)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          PyEval_RestoreThread(_save);
          goto __pyx_L9;
        }
        __pyx_L9:;
      }
  }

  /* "H2MM_C.pyx":3396
 *     with nogil:
 *         ret = viterbi(nbursts, burst_sizes, deltas, idxs, h_mod.model, cpaths, n_core)
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double] ll
 *     try:
*/
  __pyx_t_10 = __pyx_f_6H2MM_C_free_idx_diffs_arrays(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_idxs, __pyx_v_deltas); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3396, __pyx_L1_error)

  /* "H2MM_C.pyx":3398
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     cdef cnp.ndarray[double] ll
 *     try:             # <<<<<<<<<<<<<<
 *         ll = np.empty(nbursts, dtype=np.double)
 *     except:
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    /*try:*/ {

      /* "H2MM_C.pyx":3399
 *     cdef cnp.ndarray[double] ll
 *     try:
 *         ll = np.empty(nbursts, dtype=np.double)             # <<<<<<<<<<<<<<
 *     except:
 *         PyMem_Free(cpaths)
*/
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3399, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3399, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3399, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3399, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3399, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_9 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_9 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_2};
        __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3399, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_15, __pyx_t_14, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3399, __pyx_L10_error)
        __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3399, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3399, __pyx_L10_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ll.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ll.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ll.rcbuffer->pybuffer, (PyObject*)__pyx_v_ll, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          }
          __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
        }
        __pyx_pybuffernd_ll.diminfo[0].strides = __pyx_pybuffernd_ll.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ll.diminfo[0].shape = __pyx_pybuffernd_ll.rcbuffer->pybuffer.shape[0];
        if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3399, __pyx_L10_error)
      }
      __pyx_v_ll = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "H2MM_C.pyx":3398
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     cdef cnp.ndarray[double] ll
 *     try:             # <<<<<<<<<<<<<<
 *         ll = np.empty(nbursts, dtype=np.double)
 *     except:
*/
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "H2MM_C.pyx":3400
 *     try:
 *         ll = np.empty(nbursts, dtype=np.double)
 *     except:             # <<<<<<<<<<<<<<
 *         PyMem_Free(cpaths)
 *         raise MemoryError("insufficient memory to allocate loglik array")
*/
    /*except:*/ {
      __Pyx_AddTraceback("H2MM_C.viterbi_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_14) < 0) __PYX_ERR(0, 3400, __pyx_L12_except_error)
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_14);

      /* "H2MM_C.pyx":3401
 *         ll = np.empty(nbursts, dtype=np.double)
 *     except:
 *         PyMem_Free(cpaths)             # <<<<<<<<<<<<<<
 *         raise MemoryError("insufficient memory to allocate loglik array")
 * 
*/
      PyMem_Free(__pyx_v_cpaths);

      /* "H2MM_C.pyx":3402
 *     except:
 *         PyMem_Free(cpaths)
 *         raise MemoryError("insufficient memory to allocate loglik array")             # <<<<<<<<<<<<<<
 * 
 *     cdef double loglik = 0.0
*/
      __pyx_t_2 = NULL;
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_insufficient_memory_to_allocate};
        __pyx_t_15 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3402, __pyx_L12_except_error)
        __Pyx_GOTREF(__pyx_t_15);
      }
      __Pyx_Raise(__pyx_t_15, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __PYX_ERR(0, 3402, __pyx_L12_except_error)
    }

    /* "H2MM_C.pyx":3398
 *     free_idx_diffs_arrays(nbursts, burst_sizes, idxs, deltas)
 *     cdef cnp.ndarray[double] ll
 *     try:             # <<<<<<<<<<<<<<
 *         ll = np.empty(nbursts, dtype=np.double)
 *     except:
*/
    __pyx_L12_except_error:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    goto __pyx_L1_error;
    __pyx_L15_try_end:;
  }

  /* "H2MM_C.pyx":3404
 *         raise MemoryError("insufficient memory to allocate loglik array")
 * 
 *     cdef double loglik = 0.0             # <<<<<<<<<<<<<<
 *     for i in range(nbursts):
 *         loglik += cpaths[i].loglik
*/
  __pyx_v_loglik = 0.0;

  /* "H2MM_C.pyx":3405
 * 
 *     cdef double loglik = 0.0
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         loglik += cpaths[i].loglik
 *         ll[i] = cpaths[i].loglik
*/
  __pyx_t_6 = __pyx_v_nbursts;
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "H2MM_C.pyx":3406
 *     cdef double loglik = 0.0
 *     for i in range(nbursts):
 *         loglik += cpaths[i].loglik             # <<<<<<<<<<<<<<
 *         ll[i] = cpaths[i].loglik
 *     PyMem_Free(cpaths)
*/
    __pyx_v_loglik = (__pyx_v_loglik + (__pyx_v_cpaths[__pyx_v_i]).loglik);

    /* "H2MM_C.pyx":3407
 *     for i in range(nbursts):
 *         loglik += cpaths[i].loglik
 *         ll[i] = cpaths[i].loglik             # <<<<<<<<<<<<<<
 *     PyMem_Free(cpaths)
 *     cdef double icl = ((h_mod.nstate**2 + ((h_mod.ndet - 1) * h_mod.nstate) - 1) * np.log(nphot)) - 2 * loglik
*/
    __pyx_t_19 = (__pyx_v_cpaths[__pyx_v_i]).loglik;
    __pyx_t_20 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_pybuffernd_ll.diminfo[0].shape;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ll.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      __PYX_ERR(0, 3407, __pyx_L1_error)
    }
    *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ll.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ll.diminfo[0].strides) = __pyx_t_19;
  }

  /* "H2MM_C.pyx":3408
 *         loglik += cpaths[i].loglik
 *         ll[i] = cpaths[i].loglik
 *     PyMem_Free(cpaths)             # <<<<<<<<<<<<<<
 *     cdef double icl = ((h_mod.nstate**2 + ((h_mod.ndet - 1) * h_mod.nstate) - 1) * np.log(nphot)) - 2 * loglik
 *     out = paths[0] if single else paths.reshape(shape), scale[0] if single else scale.reshape(shape), ll[0] if single else ll.reshape(shape), icl
*/
  PyMem_Free(__pyx_v_cpaths);

  /* "H2MM_C.pyx":3409
 *         ll[i] = cpaths[i].loglik
 *     PyMem_Free(cpaths)
 *     cdef double icl = ((h_mod.nstate**2 + ((h_mod.ndet - 1) * h_mod.nstate) - 1) * np.log(nphot)) - 2 * loglik             # <<<<<<<<<<<<<<
 *     out = paths[0] if single else paths.reshape(shape), scale[0] if single else scale.reshape(shape), ll[0] if single else ll.reshape(shape), icl
 *     return out
*/
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_h_mod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_3 = PyNumber_Power(__pyx_t_14, __pyx_mstate_global->__pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_h_mod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_1 = __Pyx_PyLong_SubtractObjC(__pyx_t_14, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_h_mod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyNumber_Multiply(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_Add(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyLong_SubtractObjC(__pyx_t_14, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyLong_From_int64_t(__pyx_v_nphot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
    __pyx_t_9 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1};
    __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
  }
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyFloat_FromDouble((2.0 * __pyx_v_loglik)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyNumber_Subtract(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_19 = __Pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3409, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_v_icl = __pyx_t_19;

  /* "H2MM_C.pyx":3410
 *     PyMem_Free(cpaths)
 *     cdef double icl = ((h_mod.nstate**2 + ((h_mod.ndet - 1) * h_mod.nstate) - 1) * np.log(nphot)) - 2 * loglik
 *     out = paths[0] if single else paths.reshape(shape), scale[0] if single else scale.reshape(shape), ll[0] if single else ll.reshape(shape), icl             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
  if (__pyx_v_single) {
    __pyx_t_20 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_pybuffernd_paths.diminfo[0].shape;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_paths.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      __PYX_ERR(0, 3410, __pyx_L1_error)
    }
    __pyx_t_14 = (PyObject *) *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_paths.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_paths.diminfo[0].strides);
    if (unlikely(__pyx_t_14 == NULL)) __pyx_t_14 = Py_None;
    __Pyx_INCREF((PyObject*)__pyx_t_14);
    __pyx_t_15 = __pyx_t_14;
    __pyx_t_14 = 0;
  } else {
    __pyx_t_2 = ((PyObject *)__pyx_v_paths);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_shape};
      __pyx_t_14 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
    }
    __pyx_t_15 = __pyx_t_14;
    __pyx_t_14 = 0;
  }
  if (__pyx_v_single) {
    __pyx_t_20 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_pybuffernd_scale.diminfo[0].shape;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_scale.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      __PYX_ERR(0, 3410, __pyx_L1_error)
    }
    __pyx_t_2 = (PyObject *) *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_scale.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_scale.diminfo[0].strides);
    if (unlikely(__pyx_t_2 == NULL)) __pyx_t_2 = Py_None;
    __Pyx_INCREF((PyObject*)__pyx_t_2);
    __pyx_t_14 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = ((PyObject *)__pyx_v_scale);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_shape};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_14 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  if (__pyx_v_single) {
    __pyx_t_20 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_pybuffernd_ll.diminfo[0].shape;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ll.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      __PYX_ERR(0, 3410, __pyx_L1_error)
    }
    __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ll.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ll.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = ((PyObject *)__pyx_v_ll);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_shape};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_icl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_15);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15) != (0)) __PYX_ERR(0, 3410, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_14);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14) != (0)) __PYX_ERR(0, 3410, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 3410, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1) != (0)) __PYX_ERR(0, 3410, __pyx_L1_error);
  __pyx_t_15 = 0;
  __pyx_t_14 = 0;
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_v_out = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H2MM_C.pyx":3411
 *     cdef double icl = ((h_mod.nstate**2 + ((h_mod.ndet - 1) * h_mod.nstate) - 1) * np.log(nphot)) - 2 * loglik
 *     out = paths[0] if single else paths.reshape(shape), scale[0] if single else scale.reshape(shape), ll[0] if single else ll.reshape(shape), icl
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3334
 * 
 * 
 * def viterbi_path(h2mm_model h_mod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the most likely state path through a set of data given a H2MM model
*/

  /* 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_14);
  __Pyx_XDECREF(__pyx_t_15);
  { 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_ll.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_paths.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.viterbi_path", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ll.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_paths.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_indxs);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF((PyObject *)__pyx_v_paths);
  __Pyx_XDECREF((PyObject *)__pyx_v_scale);
  __Pyx_XDECREF((PyObject *)__pyx_v_ll);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3414
 * 
 * 
 * def viterbi_sort(h2mm_model hmod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     An all inclusive viterbi processing algorithm. Returns the ICL, the most likely
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_17viterbi_sort(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_16viterbi_sort, "\n    An all inclusive viterbi processing algorithm. Returns the ICL, the most likely\n    state path, posterior probabilities, and a host of information sorted by\n    bursts and dwells\n\n    Parameters\n    ----------\n    h_model : h2mm_model\n        An :class:`h2mm_model`, should be optimized for the given data set\n        (result of :func:`EM_H2MM_C` or :meth:`h2mm_model.optimize`) to ensure results correspond to give the most likely\n        path\n    indexes : list or tuple of NUMPY 1D int arrays\n        A list of the arrival indexes for each photon in each burst.\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The indexes list must maintain  1-to-1 correspondence to the times list\n    times : list or tuple of NUMPY 1D int arrays\n        A list of the arrival times for each photon in each burst\n        Each element of the list (a numpy array) corresponds to a burst, and\n        each element of the array is a singular photon.\n        The times list must maintain  1-to-1 correspondence to the indexes list\n    num_cores : int or None, optional\n        the number of C threads (which ignore the gil, thus functioning more\n        like python processes), to use when calculating iterations.\n        \n        .. note:: \n            \n            optimization_limtis sets this to be `os.cpu_count() // 2`, as most machines\n            are multithreaded. Because os.cpu_count() returns the number of threads,\n            not necessarily the number of cpus. For most machines, being multithreaded,\n            this actually returns twice the number of physical cores. Hence the default\n            to set at `os.cpu_count() // 2`. If your machine is not multithreaded, it\n            is best to set `optimization_limits.num_cores = os.cpu_count()`\n            \n        If None (default) use value from optimization_limits. \n        Default is None\n\n    Returns\n   "" -------\n    icl : float\n        Integrated complete likelihood, essentially the BIC for the *Viterbi* path\n    path : list of NUMPY 1D int arrays\n        The most likely state path for each photon\n    scale : list of NUMPY 1D float arrays\n        The posterior probability for each photon\n    ll : NUMPY 1D float array\n        loglikelihood of each burst\n    burst_type : NUMPY 1D int array\n        Identifies which states are present in the burst, identified in a binary\n        format, ie if states 0 and 2 are present in a burst, that element will\n        be 0b101 = 5\n    dwell_mid : square list of lists of NUMPY 1D int arrays\n        Gives the dwell times of all dwells with full residence time in the data\n        set, sorted by the state of the dwell (Top level list), and the successor\n        state (Lower level list), each element of the numpy array is the duration\n        of the dwell in the clock rate of the data set.\n    dwell_beg : square list of lists of NUMPY 1D int arrays\n        Gives the dwell times of all dwells that start at the beginning of a burst,\n        sorted by the state of the dwell (Top level list), and the successor\n        state (Lower level list), each element of the numpy array is the duration\n        of the dwell in the clock rate of the data set.\n    dwell_end : square list of lists of NUMPY 1D int arrays\n        Gives the dwell times of all dwells that start at the end of a burst,\n        sorted by the state of the dwell (Top level list), and the preceding\n        state (Lower level list), each element of the numpy array is the duration\n        of the dwell in the clock rate of the data set.\n    dwell_burst : list of NUMPY 1D int arrays\n        List of bursts that were only in one state, giving their durations.\n    ph_counts : list of NUMPY 2D int arrays\n        Counts of photons in each dwell, sorted by index and state of the dwell\n        The index of the list identifies the state of the burst, the 1 index""\n        identifies the index of photon, and the 0 index are individual dwells.\n    ph_mid : square list of NUMPY 2D arrays\n        Gives the photon counts of dwells in the middle of bursts, sorted\n        by state of the dwell (top level of the list) and the state of the next\n        dwell in the burst (lower level burst), each row in an array is a single\n        dwell, the columns correspond to the counts of each photon stream.\n    ph_beg : square list of NUMPY 2D arrays\n        Gives the photon counts of dwells at the beginning of bursts, sorted\n        by state of the dwell (top level of the list) and the state of the next\n        dwell in the burst  (lower level list), each row in an array is a single\n        dwell, the columns correspond to the counts of each photon stream.\n    ph_end : square list of NUMPY 2D arrays\n        Gives the photon counts of dwells at the ends of bursts, sorted\n        by state of the dwell (top level of the list) and the state of the previous\n        dwell in the burst, each row in an array is a single dwell, the columns \n        correspond to the counts of each photon stream.\n    ph_burst : list of NUMPY 2D arrays\n        Gives the counts of photons in bursts with only a single state. Sorted\n        according to the state of the burst. Each row in an array is a single\n        dwell, the columns correspond to the counts of each photon stream.\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_17viterbi_sort = {"viterbi_sort", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_17viterbi_sort, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_16viterbi_sort};
static PyObject *__pyx_pw_6H2MM_C_17viterbi_sort(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod = 0;
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_num_cores = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[4] = {0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("viterbi_sort (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_hmod,&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_num_cores,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3414, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3414, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3414, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3414, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3414, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "viterbi_sort", 0) < (0)) __PYX_ERR(0, 3414, __pyx_L3_error)
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("viterbi_sort", 0, 3, 4, i); __PYX_ERR(0, 3414, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3414, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3414, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3414, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3414, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_hmod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_indexes = values[1];
    __pyx_v_times = values[2];
    __pyx_v_num_cores = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("viterbi_sort", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 3414, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.viterbi_sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "hmod", 0))) __PYX_ERR(0, 3414, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_16viterbi_sort(__pyx_self, __pyx_v_hmod, __pyx_v_indexes, __pyx_v_times, __pyx_v_num_cores);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_16viterbi_sort(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_num_cores) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_b;
  Py_ssize_t __pyx_v_e;
  Py_ssize_t __pyx_v_st;
  PyObject *__pyx_v_paths = 0;
  PyObject *__pyx_v_scale = 0;
  PyArrayObject *__pyx_v_ll = 0;
  double __pyx_v_icl;
  PyArrayObject *__pyx_v_burst_type = 0;
  PyObject *__pyx_v_burst_type_temp = NULL;
  PyObject *__pyx_v_dwell_mid = 0;
  PyObject *__pyx_v_dwell_beg = 0;
  PyObject *__pyx_v_dwell_end = 0;
  PyObject *__pyx_v_dwell_burst = 0;
  PyObject *__pyx_v_ph_mid = 0;
  PyObject *__pyx_v_ph_beg = 0;
  PyObject *__pyx_v_ph_end = 0;
  PyObject *__pyx_v_ph_burst = 0;
  PyObject *__pyx_v_ph_counts = 0;
  PyArrayObject *__pyx_v_time = 0;
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_state = 0;
  PyArrayObject *__pyx_v_ph_counts_temp = 0;
  PyObject *__pyx_v_demar = NULL;
  PyObject *__pyx_v_begs = NULL;
  PyObject *__pyx_v_ends = NULL;
  PyObject *__pyx_v_j = NULL;
  CYTHON_UNUSED PyObject *__pyx_9genexpr11__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr12__pyx_v_i;
  CYTHON_UNUSED PyObject *__pyx_9genexpr13__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr14__pyx_v_i;
  CYTHON_UNUSED PyObject *__pyx_9genexpr15__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr16__pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr17__pyx_v_i;
  CYTHON_UNUSED PyObject *__pyx_9genexpr18__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr19__pyx_v_i;
  CYTHON_UNUSED PyObject *__pyx_9genexpr20__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr21__pyx_v_i;
  CYTHON_UNUSED PyObject *__pyx_9genexpr22__pyx_v_j = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr23__pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr24__pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_9genexpr25__pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_burst_type;
  __Pyx_Buffer __pyx_pybuffer_burst_type;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ll;
  __Pyx_Buffer __pyx_pybuffer_ll;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ph_counts_temp;
  __Pyx_Buffer __pyx_pybuffer_ph_counts_temp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  double __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_t_22;
  PyObject *(*__pyx_t_23)(PyObject *);
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *(*__pyx_t_26)(PyObject *);
  PyObject *__pyx_t_27 = NULL;
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_t_30;
  int __pyx_t_31;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("viterbi_sort", 0);
  __pyx_pybuffer_ll.pybuffer.buf = NULL;
  __pyx_pybuffer_ll.refcount = 0;
  __pyx_pybuffernd_ll.data = NULL;
  __pyx_pybuffernd_ll.rcbuffer = &__pyx_pybuffer_ll;
  __pyx_pybuffer_burst_type.pybuffer.buf = NULL;
  __pyx_pybuffer_burst_type.refcount = 0;
  __pyx_pybuffernd_burst_type.data = NULL;
  __pyx_pybuffernd_burst_type.rcbuffer = &__pyx_pybuffer_burst_type;
  __pyx_pybuffer_ph_counts_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_ph_counts_temp.refcount = 0;
  __pyx_pybuffernd_ph_counts_temp.data = NULL;
  __pyx_pybuffernd_ph_counts_temp.rcbuffer = &__pyx_pybuffer_ph_counts_temp;

  /* "H2MM_C.pyx":3512
 *     cdef cnp.ndarray[double,ndim=1] ll
 *     cdef double icl
 *     paths, scale, ll, icl = viterbi_path(hmod,indexes,times,num_cores=num_cores)             # <<<<<<<<<<<<<<
 * 
 *     # sorting bursts based on which dwells occur in them
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_viterbi_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_hmod), __pyx_v_indexes, __pyx_v_times};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num_cores, __pyx_v_num_cores, __pyx_t_5, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 3512, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__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 (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3512, __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 != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3512, __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_INCREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
      __Pyx_INCREF(__pyx_t_6);
    } else {
      __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3512, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3512, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3512, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3512, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_6);
    }
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3512, __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_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 3512, __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, 3512, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_3))) __PYX_ERR(0, 3512, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_5))) __PYX_ERR(0, 3512, __pyx_L1_error)
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3512, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_paths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_scale = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ll.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ll.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_ll.rcbuffer->pybuffer, (PyObject*)__pyx_v_ll, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_ll.diminfo[0].strides = __pyx_pybuffernd_ll.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ll.diminfo[0].shape = __pyx_pybuffernd_ll.rcbuffer->pybuffer.shape[0];
    if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 3512, __pyx_L1_error)
  }
  __pyx_v_ll = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_icl = __pyx_t_9;

  /* "H2MM_C.pyx":3515
 * 
 *     # sorting bursts based on which dwells occur in them
 *     cdef cnp.ndarray[int, ndim=1] burst_type = np.zeros(len(indexes),dtype=int)             # <<<<<<<<<<<<<<
 *     for i in range(len(indexes)):
 *         # determine the "type" of burst it is, the index represents if a state is present, using binary, minus 1 because there are no bursts with no dwells
*/
  __pyx_t_6 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = PyObject_Length(__pyx_v_indexes); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3515, __pyx_L1_error)
  __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_6);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_t_2};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3515, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3515, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_burst_type.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_burst_type = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_burst_type.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3515, __pyx_L1_error)
    } else {__pyx_pybuffernd_burst_type.diminfo[0].strides = __pyx_pybuffernd_burst_type.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_burst_type.diminfo[0].shape = __pyx_pybuffernd_burst_type.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_burst_type = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3516
 *     # sorting bursts based on which dwells occur in them
 *     cdef cnp.ndarray[int, ndim=1] burst_type = np.zeros(len(indexes),dtype=int)
 *     for i in range(len(indexes)):             # <<<<<<<<<<<<<<
 *         # determine the "type" of burst it is, the index represents if a state is present, using binary, minus 1 because there are no bursts with no dwells
 *         burst_type_temp = 0
*/
  __pyx_t_14 = PyObject_Length(__pyx_v_indexes); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3516, __pyx_L1_error)
  __pyx_t_15 = __pyx_t_14;
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
    __pyx_v_i = __pyx_t_16;

    /* "H2MM_C.pyx":3518
 *     for i in range(len(indexes)):
 *         # determine the "type" of burst it is, the index represents if a state is present, using binary, minus 1 because there are no bursts with no dwells
 *         burst_type_temp = 0             # <<<<<<<<<<<<<<
 *         for st in range(hmod.nstate):
 *             if np.any(paths[i] == st):
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_burst_type_temp, __pyx_mstate_global->__pyx_int_0);

    /* "H2MM_C.pyx":3519
 *         # determine the "type" of burst it is, the index represents if a state is present, using binary, minus 1 because there are no bursts with no dwells
 *         burst_type_temp = 0
 *         for st in range(hmod.nstate):             # <<<<<<<<<<<<<<
 *             if np.any(paths[i] == st):
 *                 burst_type_temp += 2**st
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_18 = __pyx_t_17;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_st = __pyx_t_19;

      /* "H2MM_C.pyx":3520
 *         burst_type_temp = 0
 *         for st in range(hmod.nstate):
 *             if np.any(paths[i] == st):             # <<<<<<<<<<<<<<
 *                 burst_type_temp += 2**st
 *         burst_type[i] = burst_type_temp
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__pyx_v_paths == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 3520, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_paths, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyLong_FromSsize_t(__pyx_v_st); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_5);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3520, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 3520, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_20) {

        /* "H2MM_C.pyx":3521
 *         for st in range(hmod.nstate):
 *             if np.any(paths[i] == st):
 *                 burst_type_temp += 2**st             # <<<<<<<<<<<<<<
 *         burst_type[i] = burst_type_temp
 *     # sorting dwells based on transition rates, and calculating their E and S values
*/
        __pyx_t_1 = PyFloat_FromDouble(pow(2.0, ((double)__pyx_v_st))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_burst_type_temp, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_burst_type_temp, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "H2MM_C.pyx":3520
 *         burst_type_temp = 0
 *         for st in range(hmod.nstate):
 *             if np.any(paths[i] == st):             # <<<<<<<<<<<<<<
 *                 burst_type_temp += 2**st
 *         burst_type[i] = burst_type_temp
*/
      }
    }

    /* "H2MM_C.pyx":3522
 *             if np.any(paths[i] == st):
 *                 burst_type_temp += 2**st
 *         burst_type[i] = burst_type_temp             # <<<<<<<<<<<<<<
 *     # sorting dwells based on transition rates, and calculating their E and S values
 *     cdef list dwell_mid = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
*/
    __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_burst_type_temp); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3522, __pyx_L1_error)
    __pyx_t_21 = __pyx_v_i;
    __pyx_t_22 = -1;
    if (__pyx_t_21 < 0) {
      __pyx_t_21 += __pyx_pybuffernd_burst_type.diminfo[0].shape;
      if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 0;
    } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_burst_type.diminfo[0].shape)) __pyx_t_22 = 0;
    if (unlikely(__pyx_t_22 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_22);
      __PYX_ERR(0, 3522, __pyx_L1_error)
    }
    *__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_burst_type.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_burst_type.diminfo[0].strides) = __pyx_t_10;
  }

  /* "H2MM_C.pyx":3524
 *         burst_type[i] = burst_type_temp
 *     # sorting dwells based on transition rates, and calculating their E and S values
 *     cdef list dwell_mid = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list dwell_beg = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_end = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3524, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3524, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 3524, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3524, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3524, __pyx_L12_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      {
        __pyx_t_1 = __pyx_t_23(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3524, __pyx_L12_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_j, __pyx_t_1);
      __pyx_t_1 = 0;
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3524, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3524, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3524, __pyx_L12_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr12__pyx_v_i = __pyx_t_16;
          __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3524, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 3524, __pyx_L12_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3524, __pyx_L12_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_j); __pyx_9genexpr11__pyx_v_j = 0;
    goto __pyx_L18_exit_scope;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_j); __pyx_9genexpr11__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L18_exit_scope:;
  } /* exit inner scope */
  __pyx_v_dwell_mid = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3525
 *     # sorting dwells based on transition rates, and calculating their E and S values
 *     cdef list dwell_mid = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_beg = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list dwell_end = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_burst = [[] for i in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3525, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3525, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3525, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3525, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3525, __pyx_L21_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      {
        __pyx_t_5 = __pyx_t_23(__pyx_t_7);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3525, __pyx_L21_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_j, __pyx_t_5);
      __pyx_t_5 = 0;
      { /* enter inner scope */
        __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3525, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3525, __pyx_L21_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3525, __pyx_L21_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr14__pyx_v_i = __pyx_t_16;
          __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3525, __pyx_L21_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3525, __pyx_L21_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 3525, __pyx_L21_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_j); __pyx_9genexpr13__pyx_v_j = 0;
    goto __pyx_L27_exit_scope;
    __pyx_L21_error:;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_j); __pyx_9genexpr13__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L27_exit_scope:;
  } /* exit inner scope */
  __pyx_v_dwell_beg = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3526
 *     cdef list dwell_mid = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_beg = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_end = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list dwell_burst = [[] for i in range(hmod.nstate)]
 *     cdef list ph_mid = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3526, __pyx_L30_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3526, __pyx_L30_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3526, __pyx_L30_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3526, __pyx_L30_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3526, __pyx_L30_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      {
        __pyx_t_7 = __pyx_t_23(__pyx_t_1);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3526, __pyx_L30_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_j, __pyx_t_7);
      __pyx_t_7 = 0;
      { /* enter inner scope */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3526, __pyx_L30_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3526, __pyx_L30_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3526, __pyx_L30_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr16__pyx_v_i = __pyx_t_16;
          __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3526, __pyx_L30_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 3526, __pyx_L30_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 3526, __pyx_L30_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_j); __pyx_9genexpr15__pyx_v_j = 0;
    goto __pyx_L36_exit_scope;
    __pyx_L30_error:;
    __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_j); __pyx_9genexpr15__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L36_exit_scope:;
  } /* exit inner scope */
  __pyx_v_dwell_end = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3527
 *     cdef list dwell_beg = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_end = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_burst = [[] for i in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list ph_mid = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_beg = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3527, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_9genexpr17__pyx_v_i = __pyx_t_16;
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3527, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  } /* exit inner scope */
  __pyx_v_dwell_burst = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3528
 *     cdef list dwell_end = [[[]for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list dwell_burst = [[] for i in range(hmod.nstate)]
 *     cdef list ph_mid = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list ph_beg = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_end = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3528, __pyx_L41_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = NULL;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3528, __pyx_L41_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __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, 3528, __pyx_L41_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3528, __pyx_L41_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3528, __pyx_L41_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      {
        __pyx_t_1 = __pyx_t_23(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3528, __pyx_L41_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_9genexpr18__pyx_v_j, __pyx_t_1);
      __pyx_t_1 = 0;
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3528, __pyx_L41_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3528, __pyx_L41_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3528, __pyx_L41_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr19__pyx_v_i = __pyx_t_16;
          __pyx_t_6 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3528, __pyx_L41_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3528, __pyx_L41_error)
          __Pyx_GOTREF(__pyx_t_24);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3528, __pyx_L41_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3528, __pyx_L41_error)
          __Pyx_GOTREF(__pyx_t_25);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 3528, __pyx_L41_error);
          __Pyx_GIVEREF(__pyx_t_3);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 3528, __pyx_L41_error);
          __pyx_t_3 = 0;
          __pyx_t_4 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_24))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_24);
            assert(__pyx_t_6);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_24);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_24, __pyx__function);
            __pyx_t_4 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_t_25};
            __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3528, __pyx_L41_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3528, __pyx_L41_error)
            __pyx_t_7 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3528, __pyx_L41_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 3528, __pyx_L41_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3528, __pyx_L41_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_j); __pyx_9genexpr18__pyx_v_j = 0;
    goto __pyx_L47_exit_scope;
    __pyx_L41_error:;
    __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_j); __pyx_9genexpr18__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L47_exit_scope:;
  } /* exit inner scope */
  __pyx_v_ph_mid = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3529
 *     cdef list dwell_burst = [[] for i in range(hmod.nstate)]
 *     cdef list ph_mid = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_beg = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list ph_end = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_burst = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3529, __pyx_L50_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3529, __pyx_L50_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3529, __pyx_L50_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3529, __pyx_L50_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3529, __pyx_L50_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      {
        __pyx_t_5 = __pyx_t_23(__pyx_t_7);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3529, __pyx_L50_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_j, __pyx_t_5);
      __pyx_t_5 = 0;
      { /* enter inner scope */
        __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3529, __pyx_L50_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3529, __pyx_L50_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3529, __pyx_L50_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr21__pyx_v_i = __pyx_t_16;
          __pyx_t_24 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3529, __pyx_L50_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3529, __pyx_L50_error)
          __Pyx_GOTREF(__pyx_t_25);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3529, __pyx_L50_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3529, __pyx_L50_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 3529, __pyx_L50_error);
          __Pyx_GIVEREF(__pyx_t_3);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 3529, __pyx_L50_error);
          __pyx_t_3 = 0;
          __pyx_t_4 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_25))) {
            __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_25);
            assert(__pyx_t_24);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_25);
            __Pyx_INCREF(__pyx_t_24);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_25, __pyx__function);
            __pyx_t_4 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_24, __pyx_t_6};
            __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3529, __pyx_L50_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3529, __pyx_L50_error)
            __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_25, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
            __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3529, __pyx_L50_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3529, __pyx_L50_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 3529, __pyx_L50_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_j); __pyx_9genexpr20__pyx_v_j = 0;
    goto __pyx_L56_exit_scope;
    __pyx_L50_error:;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_j); __pyx_9genexpr20__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L56_exit_scope:;
  } /* exit inner scope */
  __pyx_v_ph_beg = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3530
 *     cdef list ph_mid = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_beg = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_end = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list ph_burst = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
 *     cdef list ph_counts = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3530, __pyx_L59_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3530, __pyx_L59_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3530, __pyx_L59_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3530, __pyx_L59_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3530, __pyx_L59_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      {
        __pyx_t_7 = __pyx_t_23(__pyx_t_1);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3530, __pyx_L59_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_j, __pyx_t_7);
      __pyx_t_7 = 0;
      { /* enter inner scope */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3530, __pyx_L59_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3530, __pyx_L59_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3530, __pyx_L59_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_15 = __pyx_t_14;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_9genexpr23__pyx_v_i = __pyx_t_16;
          __pyx_t_25 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3530, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3530, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3530, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3530, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_24);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 3530, __pyx_L59_error);
          __Pyx_GIVEREF(__pyx_t_3);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 3530, __pyx_L59_error);
          __pyx_t_3 = 0;
          __pyx_t_4 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_6);
            assert(__pyx_t_25);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_25);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
            __pyx_t_4 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_25, __pyx_t_24};
            __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3530, __pyx_L59_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3530, __pyx_L59_error)
            __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
            __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
            __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3530, __pyx_L59_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 3530, __pyx_L59_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      } /* exit inner scope */
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 3530, __pyx_L59_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_j); __pyx_9genexpr22__pyx_v_j = 0;
    goto __pyx_L65_exit_scope;
    __pyx_L59_error:;
    __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_j); __pyx_9genexpr22__pyx_v_j = 0;
    goto __pyx_L1_error;
    __pyx_L65_exit_scope:;
  } /* exit inner scope */
  __pyx_v_ph_end = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3531
 *     cdef list ph_beg = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_end = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_burst = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef list ph_counts = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
 *     cdef cnp.ndarray time, index, state
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3531, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_9genexpr24__pyx_v_i = __pyx_t_16;
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 3531, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3531, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_t_3};
        __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3531, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3531, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3531, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3531, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  } /* exit inner scope */
  __pyx_v_ph_burst = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3532
 *     cdef list ph_end = [[np.zeros((0,hmod.ndet),dtype=int)for i in range(hmod.nstate)] for j in range(hmod.nstate)]
 *     cdef list ph_burst = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
 *     cdef list ph_counts = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray time, index, state
 *     cdef cnp.ndarray[long,ndim=2] ph_counts_temp = np.zeros((1,hmod.ndet),dtype=int)
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3532, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_9genexpr25__pyx_v_i = __pyx_t_16;
      __pyx_t_6 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 3532, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_5);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3532, __pyx_L1_error);
      __pyx_t_5 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_6);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_t_7};
        __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3532, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3532, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __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 (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3532, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 3532, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  } /* exit inner scope */
  __pyx_v_ph_counts = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3534
 *     cdef list ph_counts = [np.zeros((0,hmod.ndet),dtype=int) for i in range(hmod.nstate)]
 *     cdef cnp.ndarray time, index, state
 *     cdef cnp.ndarray[long,ndim=2] ph_counts_temp = np.zeros((1,hmod.ndet),dtype=int)             # <<<<<<<<<<<<<<
 *     #sorts the dwells into dwell times and photon counts
 *     for time, index, state in zip(times, indexes, paths):
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_mstate_global->__pyx_int_1) != (0)) __PYX_ERR(0, 3534, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 3534, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_7};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)(&PyLong_Type)), __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3534, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3534, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_ph_counts_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3534, __pyx_L1_error)
    } else {__pyx_pybuffernd_ph_counts_temp.diminfo[0].strides = __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ph_counts_temp.diminfo[0].shape = __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ph_counts_temp.diminfo[1].strides = __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ph_counts_temp.diminfo[1].shape = __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_v_ph_counts_temp = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3536
 *     cdef cnp.ndarray[long,ndim=2] ph_counts_temp = np.zeros((1,hmod.ndet),dtype=int)
 *     #sorts the dwells into dwell times and photon counts
 *     for time, index, state in zip(times, indexes, paths):             # <<<<<<<<<<<<<<
 *         demar = np.append(1,np.diff(state))
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
*/
  __pyx_t_5 = NULL;
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_times, __pyx_v_indexes, __pyx_v_paths};
    __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_14 = 0;
    __pyx_t_23 = NULL;
  } else {
    __pyx_t_14 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3536, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_23)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3536, __pyx_L1_error)
          #endif
          if (__pyx_t_14 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_14, __Pyx_ReferenceSharing_OwnStrongReference);
        ++__pyx_t_14;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3536, __pyx_L1_error)
          #endif
          if (__pyx_t_14 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_14));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_14);
        #endif
        ++__pyx_t_14;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3536, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_23(__pyx_t_5);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3536, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __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 != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3536, __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_INCREF(__pyx_t_3);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2);
        __Pyx_INCREF(__pyx_t_1);
      } else {
        __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3536, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_7);
        __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3536, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_t_1);
      }
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3536, __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_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L72_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_L72_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 2; __pyx_t_1 = __pyx_t_8(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L72_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 3536, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L73_unpacking_done;
      __pyx_L72_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, 3536, __pyx_L1_error)
      __pyx_L73_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3536, __pyx_L1_error)
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3536, __pyx_L1_error)
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3536, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_time, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_index, ((PyArrayObject *)__pyx_t_7));
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_state, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3537
 *     #sorts the dwells into dwell times and photon counts
 *     for time, index, state in zip(times, indexes, paths):
 *         demar = np.append(1,np.diff(state))             # <<<<<<<<<<<<<<
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array
*/
    __pyx_t_1 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_append); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_24, __pyx_mstate_global->__pyx_n_u_diff); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_25))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_25);
      assert(__pyx_t_6);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_25);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_25, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_state)};
      __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_25, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_1);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_int_1, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3537, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_demar, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":3538
 *     for time, index, state in zip(times, indexes, paths):
 *         demar = np.append(1,np.diff(state))
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes             # <<<<<<<<<<<<<<
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array
 *         for b, e in zip(begs,ends):
*/
    __pyx_t_3 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_argwhere); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyLong_NeObjC(__pyx_v_demar, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      assert(__pyx_t_3);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3538, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[11]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_begs, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3539
 *         demar = np.append(1,np.diff(state))
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array             # <<<<<<<<<<<<<<
 *         for b, e in zip(begs,ends):
 *             for i in range(hmod.ndet):
*/
    __pyx_t_2 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); 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_mstate_global->__pyx_n_u_append); 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_GetSlice(__pyx_v_begs, 1, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[3], 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_25 = __Pyx_PyLong_From_npy_intp((__pyx_f_5numpy_7ndarray_5shape_shape(__pyx_v_time)[0])); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __pyx_t_4 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_2);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_4 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_25};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_ends, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3540
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array
 *         for b, e in zip(begs,ends):             # <<<<<<<<<<<<<<
 *             for i in range(hmod.ndet):
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_begs, __pyx_v_ends};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    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_15 = 0;
      __pyx_t_26 = NULL;
    } else {
      __pyx_t_15 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_26 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 3540, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_26)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3540, __pyx_L1_error)
            #endif
            if (__pyx_t_15 >= __pyx_temp) break;
          }
          __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_15, __Pyx_ReferenceSharing_OwnStrongReference);
          ++__pyx_t_15;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3540, __pyx_L1_error)
            #endif
            if (__pyx_t_15 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_15));
          #else
          __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_15);
          #endif
          ++__pyx_t_15;
        }
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3540, __pyx_L1_error)
      } else {
        __pyx_t_1 = __pyx_t_26(__pyx_t_3);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3540, __pyx_L1_error)
            PyErr_Clear();
          }
          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, 3540, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_25 = PyTuple_GET_ITEM(sequence, 0);
          __Pyx_INCREF(__pyx_t_25);
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
          __Pyx_INCREF(__pyx_t_7);
        } else {
          __pyx_t_25 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3540, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_25);
          __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3540, __pyx_L1_error)
          __Pyx_XGOTREF(__pyx_t_7);
        }
        #else
        __pyx_t_25 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3540, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3540, __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_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3540, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
        index = 0; __pyx_t_25 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_25)) goto __pyx_L76_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_25);
        index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_7)) goto __pyx_L76_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 3540, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L77_unpacking_done;
        __pyx_L76_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 3540, __pyx_L1_error)
        __pyx_L77_unpacking_done:;
      }
      __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_25); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3540, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3540, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_b = __pyx_t_16;
      __pyx_v_e = __pyx_t_17;

      /* "H2MM_C.pyx":3541
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array
 *         for b, e in zip(begs,ends):
 *             for i in range(hmod.ndet):             # <<<<<<<<<<<<<<
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))
*/
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_ndet_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3541, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_16 = __pyx_t_17;
      for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_16; __pyx_t_18+=1) {
        __pyx_v_i = __pyx_t_18;

        /* "H2MM_C.pyx":3542
 *         for b, e in zip(begs,ends):
 *             for i in range(hmod.ndet):
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')             # <<<<<<<<<<<<<<
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))
 *             if b!= 0 and e != time.shape[0]:
*/
        __pyx_t_6 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_index), __pyx_v_b, __pyx_v_e, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3542, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_24 = PyLong_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3542, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_27 = PyObject_RichCompare(__pyx_t_6, __pyx_t_24, Py_EQ); __Pyx_XGOTREF(__pyx_t_27); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3542, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __pyx_t_2 = __pyx_t_27;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
          __pyx_t_25 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_7 = __pyx_t_25;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_28 = __Pyx_PyLong_As_long(__pyx_t_1); if (unlikely((__pyx_t_28 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3542, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_21 = 0;
        __pyx_t_29 = __pyx_v_i;
        __pyx_t_10 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_21 += __pyx_pybuffernd_ph_counts_temp.diminfo[0].shape;
          if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ph_counts_temp.diminfo[0].shape)) __pyx_t_10 = 0;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_ph_counts_temp.diminfo[1].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 1;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ph_counts_temp.diminfo[1].shape)) __pyx_t_10 = 1;
        if (unlikely(__pyx_t_10 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_10);
          __PYX_ERR(0, 3542, __pyx_L1_error)
        }
        *__Pyx_BufPtrStrided2d(long *, __pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_ph_counts_temp.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_ph_counts_temp.diminfo[1].strides) = __pyx_t_28;
      }

      /* "H2MM_C.pyx":3543
 *             for i in range(hmod.ndet):
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))             # <<<<<<<<<<<<<<
 *             if b!= 0 and e != time.shape[0]:
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
*/
      __pyx_t_25 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ph_counts, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_2);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3543, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_ph_counts_temp);
      __Pyx_GIVEREF((PyObject *)__pyx_v_ph_counts_temp);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_ph_counts_temp)) != (0)) __PYX_ERR(0, 3543, __pyx_L1_error);
      __pyx_t_2 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_27))) {
        __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_27);
        assert(__pyx_t_25);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_27);
        __Pyx_INCREF(__pyx_t_25);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_27, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_25, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_27, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3543, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      if (unlikely((PyObject_SetItem(__pyx_v_ph_counts, __pyx_t_27, __pyx_t_1) < 0))) __PYX_ERR(0, 3543, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "H2MM_C.pyx":3544
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))
 *             if b!= 0 and e != time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
*/
      __pyx_t_30 = (__pyx_v_b != 0);
      if (__pyx_t_30) {
      } else {
        __pyx_t_20 = __pyx_t_30;
        goto __pyx_L81_bool_binop_done;
      }
      __pyx_t_30 = (__pyx_v_e != (__pyx_f_5numpy_7ndarray_5shape_shape(__pyx_v_time)[0]));
      __pyx_t_20 = __pyx_t_30;
      __pyx_L81_bool_binop_done:;
      if (__pyx_t_20) {

        /* "H2MM_C.pyx":3545
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))
 *             if b!= 0 and e != time.shape[0]:
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])             # <<<<<<<<<<<<<<
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
 *             elif b==0 and e != time.shape[0]:
*/
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_27 = __Pyx_PyObject_GetItem(__pyx_v_dwell_mid, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_27, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_25 = PyNumber_Subtract(__pyx_t_1, __pyx_t_27); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_27 = PyLong_FromSsize_t((__pyx_v_e - __pyx_v_b)); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_25);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_25) != (0)) __PYX_ERR(0, 3545, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_27);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_27) != (0)) __PYX_ERR(0, 3545, __pyx_L1_error);
        __pyx_t_25 = 0;
        __pyx_t_27 = 0;
        __pyx_t_31 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_1); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 3545, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3546
 *             if b!= 0 and e != time.shape[0]:
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))             # <<<<<<<<<<<<<<
 *             elif b==0 and e != time.shape[0]:
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
*/
        __pyx_t_7 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ph_mid, __pyx_t_27); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_27); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_27 = PyTuple_New(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_GIVEREF(__pyx_t_24);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_24) != (0)) __PYX_ERR(0, 3546, __pyx_L1_error);
        __Pyx_INCREF((PyObject *)__pyx_v_ph_counts_temp);
        __Pyx_GIVEREF((PyObject *)__pyx_v_ph_counts_temp);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 1, ((PyObject *)__pyx_v_ph_counts_temp)) != (0)) __PYX_ERR(0, 3546, __pyx_L1_error);
        __pyx_t_24 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_25))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_25);
          assert(__pyx_t_7);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_25);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_25, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_27};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_25, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_27 = __Pyx_PyObject_GetItem(__pyx_v_ph_mid, __pyx_t_25); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        if (unlikely((PyObject_SetItem(__pyx_t_27, __pyx_t_25, __pyx_t_1) < 0))) __PYX_ERR(0, 3546, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3544
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
 *             ph_counts[state[b]] = np.concatenate((ph_counts[state[b]],ph_counts_temp))
 *             if b!= 0 and e != time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
*/
        goto __pyx_L80;
      }

      /* "H2MM_C.pyx":3547
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
 *             elif b==0 and e != time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
*/
      __pyx_t_30 = (__pyx_v_b == 0);
      if (__pyx_t_30) {
      } else {
        __pyx_t_20 = __pyx_t_30;
        goto __pyx_L83_bool_binop_done;
      }
      __pyx_t_30 = (__pyx_v_e != (__pyx_f_5numpy_7ndarray_5shape_shape(__pyx_v_time)[0]));
      __pyx_t_20 = __pyx_t_30;
      __pyx_L83_bool_binop_done:;
      if (__pyx_t_20) {

        /* "H2MM_C.pyx":3548
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
 *             elif b==0 and e != time.shape[0]:
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])             # <<<<<<<<<<<<<<
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
 *             elif b!=0 and e== time.shape[0]:
*/
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_v_dwell_beg, __pyx_t_1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_27 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_7 = PyNumber_Subtract(__pyx_t_1, __pyx_t_25); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_25 = PyLong_FromSsize_t((__pyx_v_e - __pyx_v_b)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_7);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 3548, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_25);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_25) != (0)) __PYX_ERR(0, 3548, __pyx_L1_error);
        __pyx_t_7 = 0;
        __pyx_t_25 = 0;
        __pyx_t_31 = __Pyx_PyObject_Append(__pyx_t_27, __pyx_t_1); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 3548, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3549
 *             elif b==0 and e != time.shape[0]:
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))             # <<<<<<<<<<<<<<
 *             elif b!=0 and e== time.shape[0]:
 *                 dwell_end[state[b]][state[b-1]].append([time[e-1]-time[b], e - b])
*/
        __pyx_t_27 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_25, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_v_ph_beg, __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_24, __pyx_t_25); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_GIVEREF(__pyx_t_2);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3549, __pyx_L1_error);
        __Pyx_INCREF((PyObject *)__pyx_v_ph_counts_temp);
        __Pyx_GIVEREF((PyObject *)__pyx_v_ph_counts_temp);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_25, 1, ((PyObject *)__pyx_v_ph_counts_temp)) != (0)) __PYX_ERR(0, 3549, __pyx_L1_error);
        __pyx_t_2 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_7);
          assert(__pyx_t_27);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_27);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_27, __pyx_t_25};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3549, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_v_ph_beg, __pyx_t_7); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_e, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (unlikely((PyObject_SetItem(__pyx_t_25, __pyx_t_7, __pyx_t_1) < 0))) __PYX_ERR(0, 3549, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3547
 *                 dwell_mid[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_mid[state[b]][state[e]] = np.concatenate((ph_mid[state[b]][state[e]],ph_counts_temp))
 *             elif b==0 and e != time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
*/
        goto __pyx_L80;
      }

      /* "H2MM_C.pyx":3550
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
 *             elif b!=0 and e== time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_end[state[b]][state[b-1]].append([time[e-1]-time[b], e - b])
 *                 ph_end[state[b]][state[b-1]] = np.concatenate((ph_end[state[b]][state[b-1]],ph_counts_temp))
*/
      __pyx_t_30 = (__pyx_v_b != 0);
      if (__pyx_t_30) {
      } else {
        __pyx_t_20 = __pyx_t_30;
        goto __pyx_L85_bool_binop_done;
      }
      __pyx_t_30 = (__pyx_v_e == (__pyx_f_5numpy_7ndarray_5shape_shape(__pyx_v_time)[0]));
      __pyx_t_20 = __pyx_t_30;
      __pyx_L85_bool_binop_done:;
      if (__pyx_t_20) {

        /* "H2MM_C.pyx":3551
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
 *             elif b!=0 and e== time.shape[0]:
 *                 dwell_end[state[b]][state[b-1]].append([time[e-1]-time[b], e - b])             # <<<<<<<<<<<<<<
 *                 ph_end[state[b]][state[b-1]] = np.concatenate((ph_end[state[b]][state[b-1]],ph_counts_temp))
 *             else:
*/
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_dwell_end, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = (__pyx_v_b - 1);
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_t_17, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = (__pyx_v_e - 1);
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_t_17, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_27 = PyNumber_Subtract(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyLong_FromSsize_t((__pyx_v_e - __pyx_v_b)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_27);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_27) != (0)) __PYX_ERR(0, 3551, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_7);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 3551, __pyx_L1_error);
        __pyx_t_27 = 0;
        __pyx_t_7 = 0;
        __pyx_t_31 = __Pyx_PyObject_Append(__pyx_t_25, __pyx_t_1); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 3551, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3552
 *             elif b!=0 and e== time.shape[0]:
 *                 dwell_end[state[b]][state[b-1]].append([time[e-1]-time[b], e - b])
 *                 ph_end[state[b]][state[b-1]] = np.concatenate((ph_end[state[b]][state[b-1]],ph_counts_temp))             # <<<<<<<<<<<<<<
 *             else:
 *                 dwell_burst[state[b]].append([time[e-1] - time[b], e - b])
*/
        __pyx_t_25 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ph_end, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_17 = (__pyx_v_b - 1);
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_t_17, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_24);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_24) != (0)) __PYX_ERR(0, 3552, __pyx_L1_error);
        __Pyx_INCREF((PyObject *)__pyx_v_ph_counts_temp);
        __Pyx_GIVEREF((PyObject *)__pyx_v_ph_counts_temp);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_ph_counts_temp)) != (0)) __PYX_ERR(0, 3552, __pyx_L1_error);
        __pyx_t_24 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_27))) {
          __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_27);
          assert(__pyx_t_25);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_27);
          __Pyx_INCREF(__pyx_t_25);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_27, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_25, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_27, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3552, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_ph_end, __pyx_t_27); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_17 = (__pyx_v_b - 1);
        __pyx_t_27 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_t_17, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        if (unlikely((PyObject_SetItem(__pyx_t_7, __pyx_t_27, __pyx_t_1) < 0))) __PYX_ERR(0, 3552, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3550
 *                 dwell_beg[state[b]][state[e]].append([time[e]-time[b], e - b])
 *                 ph_beg[state[b]][state[e]] = np.concatenate((ph_beg[state[b]][state[e]],ph_counts_temp))
 *             elif b!=0 and e== time.shape[0]:             # <<<<<<<<<<<<<<
 *                 dwell_end[state[b]][state[b-1]].append([time[e-1]-time[b], e - b])
 *                 ph_end[state[b]][state[b-1]] = np.concatenate((ph_end[state[b]][state[b-1]],ph_counts_temp))
*/
        goto __pyx_L80;
      }

      /* "H2MM_C.pyx":3554
 *                 ph_end[state[b]][state[b-1]] = np.concatenate((ph_end[state[b]][state[b-1]],ph_counts_temp))
 *             else:
 *                 dwell_burst[state[b]].append([time[e-1] - time[b], e - b])             # <<<<<<<<<<<<<<
 *                 ph_burst[state[b]] = np.concatenate((ph_burst[state[b]],ph_counts_temp))
 *     for i in range(hmod.nstate):
*/
      /*else*/ {
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_27 = __Pyx_PyObject_GetItem(__pyx_v_dwell_burst, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = (__pyx_v_e - 1);
        __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_t_17, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_time), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_25 = PyNumber_Subtract(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyLong_FromSsize_t((__pyx_v_e - __pyx_v_b)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_25);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_25) != (0)) __PYX_ERR(0, 3554, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_7);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 3554, __pyx_L1_error);
        __pyx_t_25 = 0;
        __pyx_t_7 = 0;
        __pyx_t_31 = __Pyx_PyObject_Append(__pyx_t_27, __pyx_t_1); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 3554, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "H2MM_C.pyx":3555
 *             else:
 *                 dwell_burst[state[b]].append([time[e-1] - time[b], e - b])
 *                 ph_burst[state[b]] = np.concatenate((ph_burst[state[b]],ph_counts_temp))             # <<<<<<<<<<<<<<
 *     for i in range(hmod.nstate):
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')
*/
        __pyx_t_27 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_concatenate); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_v_ph_burst, __pyx_t_7); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_24);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_24) != (0)) __PYX_ERR(0, 3555, __pyx_L1_error);
        __Pyx_INCREF((PyObject *)__pyx_v_ph_counts_temp);
        __Pyx_GIVEREF((PyObject *)__pyx_v_ph_counts_temp);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_ph_counts_temp)) != (0)) __PYX_ERR(0, 3555, __pyx_L1_error);
        __pyx_t_24 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_25))) {
          __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_25);
          assert(__pyx_t_27);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_25);
          __Pyx_INCREF(__pyx_t_27);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_25, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_27, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_25, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3555, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_state), __pyx_v_b, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        if (unlikely((PyObject_SetItem(__pyx_v_ph_burst, __pyx_t_25, __pyx_t_1) < 0))) __PYX_ERR(0, 3555, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L80:;

      /* "H2MM_C.pyx":3540
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array
 *         for b, e in zip(begs,ends):             # <<<<<<<<<<<<<<
 *             for i in range(hmod.ndet):
 *                 ph_counts_temp[0,i] = (index[b:e] == i).sum().astype('long')
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "H2MM_C.pyx":3536
 *     cdef cnp.ndarray[long,ndim=2] ph_counts_temp = np.zeros((1,hmod.ndet),dtype=int)
 *     #sorts the dwells into dwell times and photon counts
 *     for time, index, state in zip(times, indexes, paths):             # <<<<<<<<<<<<<<
 *         demar = np.append(1,np.diff(state))
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
*/
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":3556
 *                 dwell_burst[state[b]].append([time[e-1] - time[b], e - b])
 *                 ph_burst[state[b]] = np.concatenate((ph_burst[state[b]],ph_counts_temp))
 *     for i in range(hmod.nstate):             # <<<<<<<<<<<<<<
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')
 *         for j in range(hmod.nstate):
*/
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_15 = __pyx_t_14;
  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_15; __pyx_t_17+=1) {
    __pyx_v_i = __pyx_t_17;

    /* "H2MM_C.pyx":3557
 *                 ph_burst[state[b]] = np.concatenate((ph_burst[state[b]],ph_counts_temp))
 *     for i in range(hmod.nstate):
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')             # <<<<<<<<<<<<<<
 *         for j in range(hmod.nstate):
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
*/
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dwell_burst, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3557, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_20 = (__pyx_t_16 > 0);
    if (__pyx_t_20) {
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_27 = __Pyx_GetItemInt_List(__pyx_v_dwell_burst, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_24))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_24);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_24);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_24, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_27};
        __pyx_t_25 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
      }
      __pyx_t_1 = __pyx_t_25;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_n_u_long};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_24 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_24);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_24);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_24, __pyx_mstate_global->__pyx_tuple[14]};
        __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_25 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_25);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_25, __pyx_mstate_global->__pyx_n_u_long};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    if (unlikely((__Pyx_SetItemInt(__pyx_v_dwell_burst, __pyx_v_i, __pyx_t_5, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 3557, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H2MM_C.pyx":3558
 *     for i in range(hmod.nstate):
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')
 *         for j in range(hmod.nstate):             # <<<<<<<<<<<<<<
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')
*/
    __pyx_t_3 = NULL;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_n_u_nstate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3558, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_23 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 3558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      {
        __pyx_t_5 = __pyx_t_23(__pyx_t_1);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3558, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "H2MM_C.pyx":3559
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')
 *         for j in range(hmod.nstate):
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')             # <<<<<<<<<<<<<<
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_end[i][j] = np.array(dwell_end[i][j]).astype('long') if len(dwell_end[i][j]) > 0 else np.zeros((0,2)).astype('long')
*/
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dwell_mid, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_16 = PyObject_Length(__pyx_t_25); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_20 = (__pyx_t_16 > 0);
      if (__pyx_t_20) {
        __pyx_t_24 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_27 = __Pyx_GetItemInt_List(__pyx_v_dwell_mid, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_27, __pyx_v_j); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_2);
          assert(__pyx_t_24);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_24);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_24, __pyx_t_6};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3559, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_3 = __pyx_t_7;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_25 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3559, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_5 = __pyx_t_25;
        __pyx_t_25 = 0;
      } else {
        __pyx_t_2 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_24))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_24);
          assert(__pyx_t_2);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_24);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_24, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_tuple[14]};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3559, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_7 = __pyx_t_3;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_25 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3559, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_5 = __pyx_t_25;
        __pyx_t_25 = 0;
      }
      __pyx_t_25 = __Pyx_GetItemInt_List(__pyx_v_dwell_mid, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      if (unlikely((PyObject_SetItem(__pyx_t_25, __pyx_v_j, __pyx_t_5) < 0))) __PYX_ERR(0, 3559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "H2MM_C.pyx":3560
 *         for j in range(hmod.nstate):
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')             # <<<<<<<<<<<<<<
 *             dwell_end[i][j] = np.array(dwell_end[i][j]).astype('long') if len(dwell_end[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *     return icl, paths, scale, ll, burst_type, dwell_mid, dwell_beg, dwell_end, dwell_burst, ph_counts, ph_mid, ph_beg, ph_end, ph_burst
*/
      __pyx_t_25 = __Pyx_GetItemInt_List(__pyx_v_dwell_beg, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_16 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3560, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_20 = (__pyx_t_16 > 0);
      if (__pyx_t_20) {
        __pyx_t_24 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_dwell_beg, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_27 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_j); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_6);
          assert(__pyx_t_24);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_24);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_24, __pyx_t_27};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_25 = __pyx_t_7;
        __Pyx_INCREF(__pyx_t_25);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_25, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __pyx_t_6 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3560, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_24))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_24);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_24);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_24, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_tuple[14]};
          __pyx_t_25 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_7 = __pyx_t_25;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dwell_beg, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_v_j, __pyx_t_5) < 0))) __PYX_ERR(0, 3560, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "H2MM_C.pyx":3561
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_end[i][j] = np.array(dwell_end[i][j]).astype('long') if len(dwell_end[i][j]) > 0 else np.zeros((0,2)).astype('long')             # <<<<<<<<<<<<<<
 *     return icl, paths, scale, ll, burst_type, dwell_mid, dwell_beg, dwell_end, dwell_burst, ph_counts, ph_mid, ph_beg, ph_end, ph_burst
 * 
*/
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dwell_end, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_16 = PyObject_Length(__pyx_t_25); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3561, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_20 = (__pyx_t_16 > 0);
      if (__pyx_t_20) {
        __pyx_t_24 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_dwell_end, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_27))) {
          __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_27);
          assert(__pyx_t_24);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_27);
          __Pyx_INCREF(__pyx_t_24);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_27, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_24, __pyx_t_2};
          __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_27, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3561, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_3 = __pyx_t_7;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_25 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3561, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_5 = __pyx_t_25;
        __pyx_t_25 = 0;
      } else {
        __pyx_t_27 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 3561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_24))) {
          __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_24);
          assert(__pyx_t_27);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_24);
          __Pyx_INCREF(__pyx_t_27);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_24, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_27, __pyx_mstate_global->__pyx_tuple[14]};
          __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_24, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3561, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_7 = __pyx_t_3;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_n_u_long};
          __pyx_t_25 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3561, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_25);
        }
        __pyx_t_5 = __pyx_t_25;
        __pyx_t_25 = 0;
      }
      __pyx_t_25 = __Pyx_GetItemInt_List(__pyx_v_dwell_end, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      if (unlikely((PyObject_SetItem(__pyx_t_25, __pyx_v_j, __pyx_t_5) < 0))) __PYX_ERR(0, 3561, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "H2MM_C.pyx":3558
 *     for i in range(hmod.nstate):
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')
 *         for j in range(hmod.nstate):             # <<<<<<<<<<<<<<
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')
*/
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "H2MM_C.pyx":3562
 *             dwell_beg[i][j] = np.array(dwell_beg[i][j]).astype('long') if len(dwell_beg[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *             dwell_end[i][j] = np.array(dwell_end[i][j]).astype('long') if len(dwell_end[i][j]) > 0 else np.zeros((0,2)).astype('long')
 *     return icl, paths, scale, ll, burst_type, dwell_mid, dwell_beg, dwell_end, dwell_burst, ph_counts, ph_mid, ph_beg, ph_end, ph_burst             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_icl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_paths);
  __Pyx_GIVEREF(__pyx_v_paths);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_paths) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_scale);
  __Pyx_GIVEREF(__pyx_v_scale);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_scale) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_ll);
  __Pyx_GIVEREF((PyObject *)__pyx_v_ll);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_ll)) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_burst_type);
  __Pyx_GIVEREF((PyObject *)__pyx_v_burst_type);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_burst_type)) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dwell_mid);
  __Pyx_GIVEREF(__pyx_v_dwell_mid);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_dwell_mid) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dwell_beg);
  __Pyx_GIVEREF(__pyx_v_dwell_beg);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_dwell_beg) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dwell_end);
  __Pyx_GIVEREF(__pyx_v_dwell_end);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_dwell_end) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dwell_burst);
  __Pyx_GIVEREF(__pyx_v_dwell_burst);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 8, __pyx_v_dwell_burst) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ph_counts);
  __Pyx_GIVEREF(__pyx_v_ph_counts);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 9, __pyx_v_ph_counts) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ph_mid);
  __Pyx_GIVEREF(__pyx_v_ph_mid);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 10, __pyx_v_ph_mid) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ph_beg);
  __Pyx_GIVEREF(__pyx_v_ph_beg);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 11, __pyx_v_ph_beg) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ph_end);
  __Pyx_GIVEREF(__pyx_v_ph_end);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 12, __pyx_v_ph_end) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_ph_burst);
  __Pyx_GIVEREF(__pyx_v_ph_burst);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 13, __pyx_v_ph_burst) != (0)) __PYX_ERR(0, 3562, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3414
 * 
 * 
 * def viterbi_sort(h2mm_model hmod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     An all inclusive viterbi processing algorithm. Returns the ICL, the most likely
*/

  /* 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_24);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_XDECREF(__pyx_t_27);
  { 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_burst_type.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ll.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.viterbi_sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_burst_type.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ll.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ph_counts_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_paths);
  __Pyx_XDECREF(__pyx_v_scale);
  __Pyx_XDECREF((PyObject *)__pyx_v_ll);
  __Pyx_XDECREF((PyObject *)__pyx_v_burst_type);
  __Pyx_XDECREF(__pyx_v_burst_type_temp);
  __Pyx_XDECREF(__pyx_v_dwell_mid);
  __Pyx_XDECREF(__pyx_v_dwell_beg);
  __Pyx_XDECREF(__pyx_v_dwell_end);
  __Pyx_XDECREF(__pyx_v_dwell_burst);
  __Pyx_XDECREF(__pyx_v_ph_mid);
  __Pyx_XDECREF(__pyx_v_ph_beg);
  __Pyx_XDECREF(__pyx_v_ph_end);
  __Pyx_XDECREF(__pyx_v_ph_burst);
  __Pyx_XDECREF(__pyx_v_ph_counts);
  __Pyx_XDECREF((PyObject *)__pyx_v_time);
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XDECREF((PyObject *)__pyx_v_state);
  __Pyx_XDECREF((PyObject *)__pyx_v_ph_counts_temp);
  __Pyx_XDECREF(__pyx_v_demar);
  __Pyx_XDECREF(__pyx_v_begs);
  __Pyx_XDECREF(__pyx_v_ends);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr18__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_j);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3568
 * ### Function specifically for path_loglik
 * #########################################
 * cdef int free_idx_diffs_path_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs, uint8_t **ist_path):             # <<<<<<<<<<<<<<
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
*/

static int __pyx_f_6H2MM_C_free_idx_diffs_path_arrays(int64_t __pyx_v_i, int64_t *__pyx_v_ilens, uint8_t **__pyx_v_iidxs, int32_t **__pyx_v_idiffs, uint8_t **__pyx_v_ist_path) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "H2MM_C.pyx":3569
 * #########################################
 * cdef int free_idx_diffs_path_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs, uint8_t **ist_path):
 *     free_deltas(i, idiffs)             # <<<<<<<<<<<<<<
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_free_deltas(__pyx_v_i, __pyx_v_idiffs); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3569, __pyx_L1_error)

  /* "H2MM_C.pyx":3570
 * cdef int free_idx_diffs_path_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs, uint8_t **ist_path):
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)             # <<<<<<<<<<<<<<
 *     PyMem_Free(ilens)
 *     PyMem_Free(ist_path)
*/
  PyMem_Free(__pyx_v_iidxs);

  /* "H2MM_C.pyx":3571
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)             # <<<<<<<<<<<<<<
 *     PyMem_Free(ist_path)
 *     return 0
*/
  PyMem_Free(__pyx_v_ilens);

  /* "H2MM_C.pyx":3572
 *     PyMem_Free(iidxs)
 *     PyMem_Free(ilens)
 *     PyMem_Free(ist_path)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  PyMem_Free(__pyx_v_ist_path);

  /* "H2MM_C.pyx":3573
 *     PyMem_Free(ilens)
 *     PyMem_Free(ist_path)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3568
 * ### Function specifically for path_loglik
 * #########################################
 * cdef int free_idx_diffs_path_arrays(int64_t i, int64_t *ilens, uint8_t **iidxs, int32_t **idiffs, uint8_t **ist_path):             # <<<<<<<<<<<<<<
 *     free_deltas(i, idiffs)
 *     PyMem_Free(iidxs)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.free_idx_diffs_path_arrays", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "H2MM_C.pyx":3576
 * 
 * 
 * cdef tuple cast_indexes_times_paths(indexes, times, paths, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas, uint8_t ***stpath):             # <<<<<<<<<<<<<<
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
*/

static PyObject *__pyx_f_6H2MM_C_cast_indexes_times_paths(PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_paths, int *__pyx_v_single, int64_t *__pyx_v_nbursts, int64_t **__pyx_v_len_bursts, uint8_t ***__pyx_v_idxs, int32_t ***__pyx_v_deltas, uint8_t ***__pyx_v_stpath) {
  PyObject *__pyx_v_shape = NULL;
  PyObject *__pyx_v_sngl = NULL;
  PyObject *__pyx_v_haserr = NULL;
  PyObject *__pyx_v_err = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = 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;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cast_indexes_times_paths", 0);
  __Pyx_INCREF(__pyx_v_indexes);
  __Pyx_INCREF(__pyx_v_times);
  __Pyx_INCREF(__pyx_v_paths);

  /* "H2MM_C.pyx":3577
 * 
 * cdef tuple cast_indexes_times_paths(indexes, times, paths, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas, uint8_t ***stpath):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")             # <<<<<<<<<<<<<<
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_reshape_burst_arrays(__pyx_v_indexes, __pyx_mstate_global->__pyx_n_u_indexes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3577, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
      for (i=0; i < 5; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3577, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3577, __pyx_L1_error)
  }
  __Pyx_DECREF_SET(__pyx_v_indexes, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_shape = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_sngl = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_haserr = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_err = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "H2MM_C.pyx":3578
 * cdef tuple cast_indexes_times_paths(indexes, times, paths, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas, uint8_t ***stpath):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_haserr); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3578, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3579
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_4 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 3579, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 3579, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 3579, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_err) != (0)) __PYX_ERR(0, 3579, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3578
 * cdef tuple cast_indexes_times_paths(indexes, times, paths, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas, uint8_t ***stpath):
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
*/
  }

  /* "H2MM_C.pyx":3580
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")             # <<<<<<<<<<<<<<
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err
*/
  __pyx_t_4 = __pyx_f_6H2MM_C_reshape_burst_arrays(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_times); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(__pyx_t_4 != Py_None)) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3580, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_2);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_5,&__pyx_t_6,&__pyx_t_1,&__pyx_t_3,&__pyx_t_2};
      for (i=0; i < 5; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3580, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3580, __pyx_L1_error)
  }
  __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v__ = __pyx_t_6;
  __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_haserr, __pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3581
 *         return tuple(), tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), err
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_haserr); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3581, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3582
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
 *     if haserr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_3 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_1 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 3582, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 3582, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 3582, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_err) != (0)) __PYX_ERR(0, 3582, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3581
 *         return tuple(), tuple(), tuple(), err
 *     times, _, _, haserr, err = reshape_burst_arrays(times, "times")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), err
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
*/
  }

  /* "H2MM_C.pyx":3583
 *     if haserr:
 *         return tuple(), tuple(), tuple(), err
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")             # <<<<<<<<<<<<<<
 *     if haserr:
 *         return tuple(), tuple(), err
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_reshape_burst_arrays(__pyx_v_paths, __pyx_mstate_global->__pyx_n_u_state_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 5)) {
      if (size > 5) __Pyx_RaiseTooManyValuesError(5);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3583, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_6,&__pyx_t_5};
      for (i=0; i < 5; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3583, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3583, __pyx_L1_error)
  }
  __Pyx_DECREF_SET(__pyx_v_paths, __pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v__, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_haserr, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "H2MM_C.pyx":3584
 *         return tuple(), tuple(), tuple(), err
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_haserr); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3584, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3585
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
 *     if haserr:
 *         return tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 3585, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3585, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_err) != (0)) __PYX_ERR(0, 3585, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3584
 *         return tuple(), tuple(), tuple(), err
 *     paths, _, _, haserr, err = reshape_burst_arrays(paths, "state_path")
 *     if haserr:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
*/
  }

  /* "H2MM_C.pyx":3586
 *     if haserr:
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)             # <<<<<<<<<<<<<<
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), tuple(), indexes
*/
  __pyx_t_6 = __pyx_f_6H2MM_C_cast_burst_uint8(__pyx_v_indexes, __pyx_mstate_global->__pyx_n_u_indexes, __pyx_v_nbursts, __pyx_v_len_bursts, __pyx_v_idxs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF_SET(__pyx_v_indexes, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "H2MM_C.pyx":3587
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), indexes
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
*/
  __pyx_t_7 = ((__pyx_v_idxs[0]) == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3588
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), tuple(), indexes             # <<<<<<<<<<<<<<
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
 *     if stpath[0] is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_1 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_4 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 3588, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3588, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1) != (0)) __PYX_ERR(0, 3588, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_indexes);
    __Pyx_GIVEREF(__pyx_v_indexes);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_indexes) != (0)) __PYX_ERR(0, 3588, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3587
 *         return tuple(), tuple(), err
 *     indexes = cast_burst_uint8(indexes, "indexes", nbursts, len_bursts, idxs)
 *     if idxs[0] is NULL:             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), indexes
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
*/
  }

  /* "H2MM_C.pyx":3589
 *     if idxs[0] is NULL:
 *         return tuple(), tuple(), tuple(), indexes
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)             # <<<<<<<<<<<<<<
 *     if stpath[0] is NULL:
 *         PyMem_Free(idxs[0])
*/
  __pyx_t_4 = __pyx_f_6H2MM_C_cast_burst_uint8(__pyx_v_paths, __pyx_mstate_global->__pyx_n_u_state_path, __pyx_v_nbursts, __pyx_v_len_bursts, __pyx_v_stpath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_paths, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3590
 *         return tuple(), tuple(), tuple(), indexes
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
 *     if stpath[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
*/
  __pyx_t_7 = ((__pyx_v_stpath[0]) == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3591
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
 *     if stpath[0] is NULL:
 *         PyMem_Free(idxs[0])             # <<<<<<<<<<<<<<
 *         idxs[0] = NULL
 *         return tuple(), tuple(), tuple(), paths
*/
    PyMem_Free((__pyx_v_idxs[0]));

    /* "H2MM_C.pyx":3592
 *     if stpath[0] is NULL:
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), tuple(), paths
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
*/
    (__pyx_v_idxs[0]) = NULL;

    /* "H2MM_C.pyx":3593
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
 *         return tuple(), tuple(), tuple(), paths             # <<<<<<<<<<<<<<
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_6 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 3593, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 3593, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 3593, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_paths);
    __Pyx_GIVEREF(__pyx_v_paths);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_paths) != (0)) __PYX_ERR(0, 3593, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3590
 *         return tuple(), tuple(), tuple(), indexes
 *     paths = cast_burst_uint8(paths, "state_path", nbursts, len_bursts, stpath)
 *     if stpath[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
*/
  }

  /* "H2MM_C.pyx":3594
 *         idxs[0] = NULL
 *         return tuple(), tuple(), tuple(), paths
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)             # <<<<<<<<<<<<<<
 *     if deltas[0] is NULL:
 *         PyMem_Free(stpath[0])
*/
  __pyx_t_6 = __pyx_f_6H2MM_C_cast_bursts_deltas(__pyx_v_times, (__pyx_v_nbursts[0]), (__pyx_v_len_bursts[0]), __pyx_v_deltas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF_SET(__pyx_v_err, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "H2MM_C.pyx":3595
 *         return tuple(), tuple(), tuple(), paths
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(stpath[0])
 *         stpath[0] = NULL
*/
  __pyx_t_7 = ((__pyx_v_deltas[0]) == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3596
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:
 *         PyMem_Free(stpath[0])             # <<<<<<<<<<<<<<
 *         stpath[0] = NULL
 *         PyMem_Free(idxs[0])
*/
    PyMem_Free((__pyx_v_stpath[0]));

    /* "H2MM_C.pyx":3597
 *     if deltas[0] is NULL:
 *         PyMem_Free(stpath[0])
 *         stpath[0] = NULL             # <<<<<<<<<<<<<<
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
*/
    (__pyx_v_stpath[0]) = NULL;

    /* "H2MM_C.pyx":3598
 *         PyMem_Free(stpath[0])
 *         stpath[0] = NULL
 *         PyMem_Free(idxs[0])             # <<<<<<<<<<<<<<
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err
*/
    PyMem_Free((__pyx_v_idxs[0]));

    /* "H2MM_C.pyx":3599
 *         stpath[0] = NULL
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL             # <<<<<<<<<<<<<<
 *         return tuple(), tuple(), err
 *     single[0] = sngl
*/
    (__pyx_v_idxs[0]) = NULL;

    /* "H2MM_C.pyx":3600
 *         PyMem_Free(idxs[0])
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err             # <<<<<<<<<<<<<<
 *     single[0] = sngl
 *     return shape, indexes, paths, None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_1 = NULL;
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 3600, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 3600, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_err);
    __Pyx_GIVEREF(__pyx_v_err);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_err) != (0)) __PYX_ERR(0, 3600, __pyx_L1_error);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3595
 *         return tuple(), tuple(), tuple(), paths
 *     err = cast_bursts_deltas(times, nbursts[0], len_bursts[0], deltas)
 *     if deltas[0] is NULL:             # <<<<<<<<<<<<<<
 *         PyMem_Free(stpath[0])
 *         stpath[0] = NULL
*/
  }

  /* "H2MM_C.pyx":3601
 *         idxs[0] = NULL
 *         return tuple(), tuple(), err
 *     single[0] = sngl             # <<<<<<<<<<<<<<
 *     return shape, indexes, paths, None
 * 
*/
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_sngl); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3601, __pyx_L1_error)
  (__pyx_v_single[0]) = __pyx_t_7;

  /* "H2MM_C.pyx":3602
 *         return tuple(), tuple(), err
 *     single[0] = sngl
 *     return shape, indexes, paths, None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_shape);
  __Pyx_GIVEREF(__pyx_v_shape);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(0, 3602, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_indexes);
  __Pyx_GIVEREF(__pyx_v_indexes);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_indexes) != (0)) __PYX_ERR(0, 3602, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_paths);
  __Pyx_GIVEREF(__pyx_v_paths);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_paths) != (0)) __PYX_ERR(0, 3602, __pyx_L1_error);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, Py_None) != (0)) __PYX_ERR(0, 3602, __pyx_L1_error);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3576
 * 
 * 
 * cdef tuple cast_indexes_times_paths(indexes, times, paths, bint *single, int64_t *nbursts, int64_t **len_bursts, uint8_t ***idxs, int32_t ***deltas, uint8_t ***stpath):             # <<<<<<<<<<<<<<
 *     indexes, shape, sngl, haserr, err = reshape_burst_arrays(indexes, "indexes")
 *     if haserr:
*/

  /* 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("H2MM_C.cast_indexes_times_paths", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_sngl);
  __Pyx_XDECREF(__pyx_v_haserr);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_indexes);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XDECREF(__pyx_v_paths);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3605
 * 
 * 
 * cdef tuple cpath_ll_full(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] loglik = np.empty(nbursts, dtype=object)
 *     cdef object obtemp
*/

static PyObject *__pyx_f_6H2MM_C_cpath_ll_full(int64_t __pyx_v_nbursts, int64_t *__pyx_v_burst_sizes, int32_t **__pyx_v_cdeltas, uint8_t **__pyx_v_cindexes, uint8_t **__pyx_v_cstate_path, h2mm_mod *__pyx_v_model, int64_t __pyx_v_ncore) {
  PyArrayObject *__pyx_v_loglik = 0;
  PyObject *__pyx_v_obtemp = 0;
  PyArrayObject *__pyx_v_temp = 0;
  int64_t __pyx_v_i;
  double **__pyx_v_ll;
  PyObject *__pyx_v_exception = NULL;
  int __pyx_v_ret;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_loglik;
  __Pyx_Buffer __pyx_pybuffer_loglik;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_temp;
  __Pyx_Buffer __pyx_pybuffer_temp;
  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;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  int64_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  Py_ssize_t __pyx_t_25;
  PyObject **__pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cpath_ll_full", 0);
  __pyx_pybuffer_loglik.pybuffer.buf = NULL;
  __pyx_pybuffer_loglik.refcount = 0;
  __pyx_pybuffernd_loglik.data = NULL;
  __pyx_pybuffernd_loglik.rcbuffer = &__pyx_pybuffer_loglik;
  __pyx_pybuffer_temp.pybuffer.buf = NULL;
  __pyx_pybuffer_temp.refcount = 0;
  __pyx_pybuffernd_temp.data = NULL;
  __pyx_pybuffernd_temp.rcbuffer = &__pyx_pybuffer_temp;

  /* "H2MM_C.pyx":3606
 * 
 * cdef tuple cpath_ll_full(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):
 *     cdef cnp.ndarray[object, ndim=1] loglik = np.empty(nbursts, dtype=object)             # <<<<<<<<<<<<<<
 *     cdef object obtemp
 *     cdef cnp.ndarray[double, ndim=1] temp
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_builtin_object, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3606, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3606, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_loglik.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_loglik = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_loglik.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3606, __pyx_L1_error)
    } else {__pyx_pybuffernd_loglik.diminfo[0].strides = __pyx_pybuffernd_loglik.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_loglik.diminfo[0].shape = __pyx_pybuffernd_loglik.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_loglik = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3611
 *     cdef int64_t i
 *     # allocate loglik arrays
 *     cdef double **ll = <double**> PyMem_Malloc(sizeof(double*)*nbursts)             # <<<<<<<<<<<<<<
 *     if ll is NULL:
 *         return MemoryError("insufficient memory"), loglik
*/
  __pyx_v_ll = ((double **)PyMem_Malloc(((sizeof(double *)) * __pyx_v_nbursts)));

  /* "H2MM_C.pyx":3612
 *     # allocate loglik arrays
 *     cdef double **ll = <double**> PyMem_Malloc(sizeof(double*)*nbursts)
 *     if ll is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):
*/
  __pyx_t_7 = (__pyx_v_ll == NULL);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3613
 *     cdef double **ll = <double**> PyMem_Malloc(sizeof(double*)*nbursts)
 *     if ll is NULL:
 *         return MemoryError("insufficient memory"), loglik             # <<<<<<<<<<<<<<
 *     for i in range(nbursts):
 *         try:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_insufficient_memory};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3613, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 3613, __pyx_L1_error);
    __Pyx_INCREF((PyObject *)__pyx_v_loglik);
    __Pyx_GIVEREF((PyObject *)__pyx_v_loglik);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_loglik)) != (0)) __PYX_ERR(0, 3613, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "H2MM_C.pyx":3612
 *     # allocate loglik arrays
 *     cdef double **ll = <double**> PyMem_Malloc(sizeof(double*)*nbursts)
 *     if ll is NULL:             # <<<<<<<<<<<<<<
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):
*/
  }

  /* "H2MM_C.pyx":3614
 *     if ll is NULL:
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):             # <<<<<<<<<<<<<<
 *         try:
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
*/
  __pyx_t_8 = __pyx_v_nbursts;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "H2MM_C.pyx":3615
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      /*try:*/ {

        /* "H2MM_C.pyx":3616
 *     for i in range(nbursts):
 *         try:
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)             # <<<<<<<<<<<<<<
 *         except Exception as exception:
 *             PyMem_Free(ll)
*/
        __pyx_t_1 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3616, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3616, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyLong_From_int64_t((__pyx_v_burst_sizes[__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3616, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3616, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3616, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_6};
          __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3616, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_14, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3616, __pyx_L6_error)
          __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3616, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_obtemp, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "H2MM_C.pyx":3615
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:
*/
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "H2MM_C.pyx":3617
 *         try:
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:             # <<<<<<<<<<<<<<
 *             PyMem_Free(ll)
 *             return exception, loglik
*/
      __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception))));
      if (__pyx_t_15) {
        __Pyx_AddTraceback("H2MM_C.cpath_ll_full", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 3617, __pyx_L8_except_error)
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_3);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_v_exception = __pyx_t_3;
        /*try:*/ {

          /* "H2MM_C.pyx":3618
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:
 *             PyMem_Free(ll)             # <<<<<<<<<<<<<<
 *             return exception, loglik
 *         temp = obtemp
*/
          PyMem_Free(__pyx_v_ll);

          /* "H2MM_C.pyx":3619
 *         except Exception as exception:
 *             PyMem_Free(ll)
 *             return exception, loglik             # <<<<<<<<<<<<<<
 *         temp = obtemp
 *         loglik[i] = obtemp
*/
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3619, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_INCREF(__pyx_v_exception);
          __Pyx_GIVEREF(__pyx_v_exception);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_exception) != (0)) __PYX_ERR(0, 3619, __pyx_L19_error);
          __Pyx_INCREF((PyObject *)__pyx_v_loglik);
          __Pyx_GIVEREF((PyObject *)__pyx_v_loglik);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_v_loglik)) != (0)) __PYX_ERR(0, 3619, __pyx_L19_error);
          __pyx_r = ((PyObject*)__pyx_t_14);
          __pyx_t_14 = 0;
          __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;
          goto __pyx_L18_return;
        }

        /* "H2MM_C.pyx":3617
 *         try:
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:             # <<<<<<<<<<<<<<
 *             PyMem_Free(ll)
 *             return exception, loglik
*/
        /*finally:*/ {
          __pyx_L19_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
             __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
            if ( unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_18);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_22);
            __Pyx_XGOTREF(__pyx_t_23);
            __pyx_t_15 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_exception); __pyx_v_exception = 0;
            }
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
            __Pyx_XGIVEREF(__pyx_t_18);
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
            __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
            goto __pyx_L8_except_error;
          }
          __pyx_L18_return: {
            __pyx_t_24 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_exception); __pyx_v_exception = 0;
            __pyx_r = __pyx_t_24;
            __pyx_t_24 = 0;
            goto __pyx_L9_except_return;
          }
        }
      }
      goto __pyx_L8_except_error;

      /* "H2MM_C.pyx":3615
 *         return MemoryError("insufficient memory"), loglik
 *     for i in range(nbursts):
 *         try:             # <<<<<<<<<<<<<<
 *             obtemp = np.empty(burst_sizes[i], dtype=np.double)
 *         except Exception as exception:
*/
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      goto __pyx_L1_error;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      goto __pyx_L0;
      __pyx_L13_try_end:;
    }

    /* "H2MM_C.pyx":3620
 *             PyMem_Free(ll)
 *             return exception, loglik
 *         temp = obtemp             # <<<<<<<<<<<<<<
 *         loglik[i] = obtemp
 *         ll[i] = <double*> temp.data
*/
    __pyx_t_2 = __pyx_v_obtemp;
    __Pyx_INCREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3620, __pyx_L1_error)
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_temp.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 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_temp.diminfo[0].strides = __pyx_pybuffernd_temp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp.diminfo[0].shape = __pyx_pybuffernd_temp.rcbuffer->pybuffer.shape[0];
      if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 3620, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_temp, ((PyArrayObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "H2MM_C.pyx":3621
 *             return exception, loglik
 *         temp = obtemp
 *         loglik[i] = obtemp             # <<<<<<<<<<<<<<
 *         ll[i] = <double*> temp.data
 *     cdef int ret = pathloglik_path(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
*/
    __pyx_t_25 = __pyx_v_i;
    __pyx_t_16 = -1;
    if (__pyx_t_25 < 0) {
      __pyx_t_25 += __pyx_pybuffernd_loglik.diminfo[0].shape;
      if (unlikely(__pyx_t_25 < 0)) __pyx_t_16 = 0;
    } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_loglik.diminfo[0].shape)) __pyx_t_16 = 0;
    if (unlikely(__pyx_t_16 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_16);
      __PYX_ERR(0, 3621, __pyx_L1_error)
    }
    __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_loglik.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_loglik.diminfo[0].strides);
    __Pyx_XGOTREF(*__pyx_t_26);
    __Pyx_INCREF(__pyx_v_obtemp); __Pyx_XDECREF(*__pyx_t_26);
    *__pyx_t_26 = __pyx_v_obtemp;
    __Pyx_XGIVEREF(*__pyx_t_26);

    /* "H2MM_C.pyx":3622
 *         temp = obtemp
 *         loglik[i] = obtemp
 *         ll[i] = <double*> temp.data             # <<<<<<<<<<<<<<
 *     cdef int ret = pathloglik_path(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
 *     PyMem_Free(ll)
*/
    (__pyx_v_ll[__pyx_v_i]) = ((double *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_temp)));
  }

  /* "H2MM_C.pyx":3623
 *         loglik[i] = obtemp
 *         ll[i] = <double*> temp.data
 *     cdef int ret = pathloglik_path(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)             # <<<<<<<<<<<<<<
 *     PyMem_Free(ll)
 *     return ret, loglik
*/
  __pyx_v_ret = pathloglik_path(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_cdeltas, __pyx_v_cindexes, __pyx_v_cstate_path, __pyx_v_model, __pyx_v_ll, __pyx_v_ncore);

  /* "H2MM_C.pyx":3624
 *         ll[i] = <double*> temp.data
 *     cdef int ret = pathloglik_path(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
 *     PyMem_Free(ll)             # <<<<<<<<<<<<<<
 *     return ret, loglik
 * 
*/
  PyMem_Free(__pyx_v_ll);

  /* "H2MM_C.pyx":3625
 *     cdef int ret = pathloglik_path(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
 *     PyMem_Free(ll)
 *     return ret, loglik             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 3625, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_loglik);
  __Pyx_GIVEREF((PyObject *)__pyx_v_loglik);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_loglik)) != (0)) __PYX_ERR(0, 3625, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3605
 * 
 * 
 * cdef tuple cpath_ll_full(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[object, ndim=1] loglik = np.empty(nbursts, dtype=object)
 *     cdef object obtemp
*/

  /* 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_14);
  { 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_loglik.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.cpath_ll_full", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_loglik.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_temp.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_loglik);
  __Pyx_XDECREF(__pyx_v_obtemp);
  __Pyx_XDECREF((PyObject *)__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_exception);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3628
 * 
 * 
 * cdef tuple cpath_ll(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)
 *     cdef double *ll = <double*> loglik.data
*/

static PyObject *__pyx_f_6H2MM_C_cpath_ll(int64_t __pyx_v_nbursts, int64_t *__pyx_v_burst_sizes, int32_t **__pyx_v_cdeltas, uint8_t **__pyx_v_cindexes, uint8_t **__pyx_v_cstate_path, h2mm_mod *__pyx_v_model, int64_t __pyx_v_ncore) {
  PyArrayObject *__pyx_v_loglik = 0;
  double *__pyx_v_ll;
  int __pyx_v_ret;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_loglik;
  __Pyx_Buffer __pyx_pybuffer_loglik;
  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;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cpath_ll", 0);
  __pyx_pybuffer_loglik.pybuffer.buf = NULL;
  __pyx_pybuffer_loglik.refcount = 0;
  __pyx_pybuffernd_loglik.data = NULL;
  __pyx_pybuffernd_loglik.rcbuffer = &__pyx_pybuffer_loglik;

  /* "H2MM_C.pyx":3629
 * 
 * cdef tuple cpath_ll(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):
 *     cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)             # <<<<<<<<<<<<<<
 *     cdef double *ll = <double*> loglik.data
 *     cdef int ret = pathloglik(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_nbursts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3629, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3629, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_loglik.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_loglik = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_loglik.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3629, __pyx_L1_error)
    } else {__pyx_pybuffernd_loglik.diminfo[0].strides = __pyx_pybuffernd_loglik.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_loglik.diminfo[0].shape = __pyx_pybuffernd_loglik.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_loglik = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3630
 * cdef tuple cpath_ll(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):
 *     cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)
 *     cdef double *ll = <double*> loglik.data             # <<<<<<<<<<<<<<
 *     cdef int ret = pathloglik(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
 *     return ret, loglik
*/
  __pyx_v_ll = ((double *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_loglik)));

  /* "H2MM_C.pyx":3631
 *     cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)
 *     cdef double *ll = <double*> loglik.data
 *     cdef int ret = pathloglik(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)             # <<<<<<<<<<<<<<
 *     return ret, loglik
 * 
*/
  __pyx_v_ret = pathloglik(__pyx_v_nbursts, __pyx_v_burst_sizes, __pyx_v_cdeltas, __pyx_v_cindexes, __pyx_v_cstate_path, __pyx_v_model, __pyx_v_ll, __pyx_v_ncore);

  /* "H2MM_C.pyx":3632
 *     cdef double *ll = <double*> loglik.data
 *     cdef int ret = pathloglik(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model, ll, ncore)
 *     return ret, loglik             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 3632, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_loglik);
  __Pyx_GIVEREF((PyObject *)__pyx_v_loglik);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_loglik)) != (0)) __PYX_ERR(0, 3632, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3628
 * 
 * 
 * cdef tuple cpath_ll(int64_t nbursts, int64_t *burst_sizes, int32_t **cdeltas, uint8_t **cindexes, uint8_t **cstate_path, h2mm_mod *model, int64_t ncore):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)
 *     cdef double *ll = <double*> loglik.data
*/

  /* 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);
  { 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_loglik.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.cpath_ll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_loglik.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_loglik);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_19path_loglik(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_18path_loglik, "\n    Function for calculating the statistical parameters of a specific state path \n    and data set given a model (ln(P(XY|lambda))). By default returns the BIC of\n    the entire data set, can also return the base logliklihood in total and/or\n    per burst. Which return values selected are defined in keyword arguments.\n\n    Parameters\n    ----------\n    model : h2mm_model\n        :class:`h2mm_model` for which to calculate the loglik of the path.\n    indexes : list[numpy.ndarray], tuple[numpy.ndarray] or numpy.ndarray[numpy.ndarray]\n        Indexes of photons in bursts in data (simulated or real).\n    times : list, tuple, or numpy.ndarray of integer numpy.ndarray\n        Arrival times of photons in bursts in (simulated or real).\n    state_path : list, tuple, or numpy.ndarray of integer numpy.ndarray\n        state for each photon in bursts in data (must be infered through\n        viterbi or other algorithm).\n    num_cores : int, optional\n        Number of cores to use in calculation, if None, then use value in \n        optimization_limits. The default is None.\n    BIC : bool, optional\n        Whether to return the Bayes Information Criterion of the calculation. \n        The default is True.\n    total_loglik : bool, optional\n        Whether to return the loglikelihood of the entire data set as a single number.\n        The default is False.\n    loglikarray : bool, optional\n        Whether to return the loglikelihoods of each burst as a numpy array. \n        The default is False.\n    loglikpath : bool, optional\n        Whether to return the loglikelihoods of each photon in each burst\n        as a numpy array of numpy arrays. The default is False\n\n    Raises\n    ------\n    TypeError\n        One or more inputs did not contain the proper data types.\n    ValueError\n        One or more values out of the acceptable ranges given the input model\n    RuntimeError\n        Deeper issue, raise issue on github.\n\n    Returns\n    -------\n    ""bic : float\n        Bayes information criterion of entire data set and path.\n    loglik : float\n        Log likelihood of entire dataset\n    loglik_array : numpy.ndarray\n        Loglikelihood of each burst separately\n    loglikpath: numpy.ndarray\n        Loglikelihood of each photon of each burst array.\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_19path_loglik = {"path_loglik", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_19path_loglik, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_18path_loglik};
static PyObject *__pyx_pw_6H2MM_C_19path_loglik(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model = 0;
  PyObject *__pyx_v_indexes = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_state_path = 0;
  PyObject *__pyx_v_num_cores = 0;
  PyObject *__pyx_v_BIC = 0;
  PyObject *__pyx_v_total_loglik = 0;
  PyObject *__pyx_v_loglikarray = 0;
  PyObject *__pyx_v_loglikpath = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("path_loglik (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_model,&__pyx_mstate_global->__pyx_n_u_indexes,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_state_path,&__pyx_mstate_global->__pyx_n_u_num_cores,&__pyx_mstate_global->__pyx_n_u_BIC,&__pyx_mstate_global->__pyx_n_u_total_loglik,&__pyx_mstate_global->__pyx_n_u_loglikarray,&__pyx_mstate_global->__pyx_n_u_loglikpath,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3635, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "path_loglik", 0) < (0)) __PYX_ERR(0, 3635, __pyx_L3_error)
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "H2MM_C.pyx":3636
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):             # <<<<<<<<<<<<<<
 *     """
 *     Function for calculating the statistical parameters of a specific state path
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("path_loglik", 0, 4, 9, i); __PYX_ERR(0, 3635, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  9:
        values[8] = __Pyx_ArgRef_FASTCALL(__pyx_args, 8);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  6:
        values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  5:
        values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3635, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  4:
        values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3635, __pyx_L3_error)
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3635, __pyx_L3_error)
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3635, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3635, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_True)));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
      if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
    }
    __pyx_v_model = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_indexes = values[1];
    __pyx_v_times = values[2];
    __pyx_v_state_path = values[3];
    __pyx_v_num_cores = values[4];
    __pyx_v_BIC = values[5];
    __pyx_v_total_loglik = values[6];
    __pyx_v_loglikarray = values[7];
    __pyx_v_loglikpath = values[8];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("path_loglik", 0, 4, 9, __pyx_nargs); __PYX_ERR(0, 3635, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.path_loglik", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "model", 0))) __PYX_ERR(0, 3635, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_18path_loglik(__pyx_self, __pyx_v_model, __pyx_v_indexes, __pyx_v_times, __pyx_v_state_path, __pyx_v_num_cores, __pyx_v_BIC, __pyx_v_total_loglik, __pyx_v_loglikarray, __pyx_v_loglikpath);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6H2MM_C_11path_loglik_2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "H2MM_C.pyx":3702
 *         raise err
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))             # <<<<<<<<<<<<<<
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
*/

static PyObject *__pyx_pf_6H2MM_C_11path_loglik_genexpr(PyObject *__pyx_self, int64_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_10_genexpr(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3702, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6H2MM_C_11path_loglik_2generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_path_loglik_locals_genexpr, __pyx_mstate_global->__pyx_n_u_H2MM_C); if (unlikely(!gen)) __PYX_ERR(0, 3702, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.path_loglik.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6H2MM_C_11path_loglik_2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int64_t __pyx_t_1;
  int64_t __pyx_t_2;
  int64_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(__pyx_sent_value != Py_None)) {
    if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
    __PYX_ERR(0, 3702, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyLong_From_int64_t((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_burst_sizes[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3702, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/

static PyObject *__pyx_pf_6H2MM_C_18path_loglik(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_model, PyObject *__pyx_v_indexes, PyObject *__pyx_v_times, PyObject *__pyx_v_state_path, PyObject *__pyx_v_num_cores, PyObject *__pyx_v_BIC, PyObject *__pyx_v_total_loglik, PyObject *__pyx_v_loglikarray, PyObject *__pyx_v_loglikpath) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *__pyx_cur_scope;
  int64_t __pyx_v_ncore;
  int __pyx_v_single;
  int64_t __pyx_v_nbursts;
  int32_t **__pyx_v_cdeltas;
  uint8_t **__pyx_v_cindexes;
  uint8_t **__pyx_v_cstate_path;
  PyObject *__pyx_v_shape = NULL;
  PyObject *__pyx_v_err = NULL;
  int64_t __pyx_v_nphot;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_loglikp = NULL;
  PyObject *__pyx_v_loglik = NULL;
  PyObject *__pyx_v_out = NULL;
  double __pyx_v_sum_loglik;
  PyObject *__pyx_gb_6H2MM_C_11path_loglik_2generator7 = 0;
  PyObject *__pyx_9genexpr27__pyx_v_l = 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;
  size_t __pyx_t_5;
  int64_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  double __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("path_loglik", 0);
  __pyx_cur_scope = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_9_path_loglik(__pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3635, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_indexes);
  __Pyx_INCREF(__pyx_v_state_path);

  /* "H2MM_C.pyx":3691
 * 
 *     """
 *     cdef int64_t ncore = <int64_t> optimization_limits._get_num_cores(num_cores)             # <<<<<<<<<<<<<<
 *     cdef bint single
 *     cdef int64_t nbursts = 0
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_optimization_limits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_num_cores); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_num_cores};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 3691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyLong_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ncore = ((int64_t)__pyx_t_6);

  /* "H2MM_C.pyx":3693
 *     cdef int64_t ncore = <int64_t> optimization_limits._get_num_cores(num_cores)
 *     cdef bint single
 *     cdef int64_t nbursts = 0             # <<<<<<<<<<<<<<
 *     cdef int64_t *burst_sizes = NULL
 *     cdef int32_t **cdeltas = NULL
*/
  __pyx_v_nbursts = 0;

  /* "H2MM_C.pyx":3694
 *     cdef bint single
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL             # <<<<<<<<<<<<<<
 *     cdef int32_t **cdeltas = NULL
 *     cdef uint8_t **cindexes = NULL
*/
  __pyx_cur_scope->__pyx_v_burst_sizes = NULL;

  /* "H2MM_C.pyx":3695
 *     cdef int64_t nbursts = 0
 *     cdef int64_t *burst_sizes = NULL
 *     cdef int32_t **cdeltas = NULL             # <<<<<<<<<<<<<<
 *     cdef uint8_t **cindexes = NULL
 *     cdef uint8_t **cstate_path = NULL
*/
  __pyx_v_cdeltas = NULL;

  /* "H2MM_C.pyx":3696
 *     cdef int64_t *burst_sizes = NULL
 *     cdef int32_t **cdeltas = NULL
 *     cdef uint8_t **cindexes = NULL             # <<<<<<<<<<<<<<
 *     cdef uint8_t **cstate_path = NULL
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)
*/
  __pyx_v_cindexes = NULL;

  /* "H2MM_C.pyx":3697
 *     cdef int32_t **cdeltas = NULL
 *     cdef uint8_t **cindexes = NULL
 *     cdef uint8_t **cstate_path = NULL             # <<<<<<<<<<<<<<
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)
 *     if err is not None:
*/
  __pyx_v_cstate_path = NULL;

  /* "H2MM_C.pyx":3698
 *     cdef uint8_t **cindexes = NULL
 *     cdef uint8_t **cstate_path = NULL
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)             # <<<<<<<<<<<<<<
 *     if err is not None:
 *         raise err
*/
  __pyx_t_1 = __pyx_f_6H2MM_C_cast_indexes_times_paths(__pyx_v_indexes, __pyx_v_times, __pyx_v_state_path, (&__pyx_v_single), (&__pyx_v_nbursts), (&__pyx_cur_scope->__pyx_v_burst_sizes), (&__pyx_v_cindexes), (&__pyx_v_cdeltas), (&__pyx_v_cstate_path)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3698, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
    __Pyx_INCREF(__pyx_t_7);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_2,&__pyx_t_3,&__pyx_t_7};
      for (i=0; i < 4; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 3698, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3698, __pyx_L1_error)
  }
  __pyx_v_shape = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_indexes, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_state_path, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_err = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "H2MM_C.pyx":3699
 *     cdef uint8_t **cstate_path = NULL
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t i
*/
  __pyx_t_8 = (__pyx_v_err != Py_None);
  if (unlikely(__pyx_t_8)) {

    /* "H2MM_C.pyx":3700
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)
 *     if err is not None:
 *         raise err             # <<<<<<<<<<<<<<
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))
*/
    __Pyx_Raise(__pyx_v_err, 0, 0, 0);
    __PYX_ERR(0, 3700, __pyx_L1_error)

    /* "H2MM_C.pyx":3699
 *     cdef uint8_t **cstate_path = NULL
 *     shape, indexes, state_path, err = cast_indexes_times_paths(indexes, times, state_path, &single, &nbursts, &burst_sizes, &cindexes, &cdeltas, &cstate_path)
 *     if err is not None:             # <<<<<<<<<<<<<<
 *         raise err
 *     cdef int64_t i
*/
  }

  /* "H2MM_C.pyx":3702
 *         raise err
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))             # <<<<<<<<<<<<<<
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
*/
  __pyx_t_7 = NULL;
  __pyx_t_3 = __pyx_pf_6H2MM_C_11path_loglik_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_nbursts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_sum, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __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, 3702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_6 = __Pyx_PyLong_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3702, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nphot = __pyx_t_6;

  /* "H2MM_C.pyx":3703
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))
 *     if loglikpath:             # <<<<<<<<<<<<<<
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
 *         if not isinstance(res, Exception):
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_loglikpath); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 3703, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":3704
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)             # <<<<<<<<<<<<<<
 *         if not isinstance(res, Exception):
 *             loglik = np.array([l.sum() for l in loglikp], dtype=np.double)
*/
    __pyx_t_1 = __pyx_f_6H2MM_C_cpath_ll_full(__pyx_v_nbursts, __pyx_cur_scope->__pyx_v_burst_sizes, __pyx_v_cdeltas, __pyx_v_cindexes, __pyx_v_cstate_path, __pyx_v_model->model, __pyx_v_ncore); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3704, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3704, __pyx_L1_error)
    }
    __pyx_v_res = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_loglikp = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "H2MM_C.pyx":3705
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
 *         if not isinstance(res, Exception):             # <<<<<<<<<<<<<<
 *             loglik = np.array([l.sum() for l in loglikp], dtype=np.double)
 *     else:
*/
    __pyx_t_8 = __Pyx_PyException_Check(__pyx_v_res); 
    __pyx_t_9 = (!__pyx_t_8);
    if (__pyx_t_9) {

      /* "H2MM_C.pyx":3706
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
 *         if not isinstance(res, Exception):
 *             loglik = np.array([l.sum() for l in loglikp], dtype=np.double)             # <<<<<<<<<<<<<<
 *     else:
 *         res, loglik = cpath_ll(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
*/
      __pyx_t_7 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3706, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (likely(PyList_CheckExact(__pyx_v_loglikp)) || PyTuple_CheckExact(__pyx_v_loglikp)) {
          __pyx_t_4 = __pyx_v_loglikp; __Pyx_INCREF(__pyx_t_4);
          __pyx_t_10 = 0;
          __pyx_t_11 = NULL;
        } else {
          __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_loglikp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3706, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3706, __pyx_L8_error)
        }
        for (;;) {
          if (likely(!__pyx_t_11)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3706, __pyx_L8_error)
                #endif
                if (__pyx_t_10 >= __pyx_temp) break;
              }
              __pyx_t_12 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
              ++__pyx_t_10;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3706, __pyx_L8_error)
                #endif
                if (__pyx_t_10 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_12 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10));
              #else
              __pyx_t_12 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10);
              #endif
              ++__pyx_t_10;
            }
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3706, __pyx_L8_error)
          } else {
            __pyx_t_12 = __pyx_t_11(__pyx_t_4);
            if (unlikely(!__pyx_t_12)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3706, __pyx_L8_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_XDECREF_SET(__pyx_9genexpr27__pyx_v_l, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_13 = __pyx_9genexpr27__pyx_v_l;
          __Pyx_INCREF(__pyx_t_13);
          __pyx_t_5 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
            __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3706, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_12);
          }
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 3706, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_l); __pyx_9genexpr27__pyx_v_l = 0;
        goto __pyx_L12_exit_scope;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_l); __pyx_9genexpr27__pyx_v_l = 0;
        goto __pyx_L1_error;
        __pyx_L12_exit_scope:;
      } /* exit inner scope */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_double); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        assert(__pyx_t_7);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_t_3};
        __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3706, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_12, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3706, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3706, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_loglik = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "H2MM_C.pyx":3705
 *     if loglikpath:
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
 *         if not isinstance(res, Exception):             # <<<<<<<<<<<<<<
 *             loglik = np.array([l.sum() for l in loglikp], dtype=np.double)
 *     else:
*/
    }

    /* "H2MM_C.pyx":3703
 *     cdef int64_t i
 *     cdef int64_t nphot = sum(burst_sizes[i] for i in range(nbursts))
 *     if loglikpath:             # <<<<<<<<<<<<<<
 *         res, loglikp = cpath_ll_full(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)
 *         if not isinstance(res, Exception):
*/
    goto __pyx_L4;
  }

  /* "H2MM_C.pyx":3708
 *             loglik = np.array([l.sum() for l in loglikp], dtype=np.double)
 *     else:
 *         res, loglik = cpath_ll(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ncore)             # <<<<<<<<<<<<<<
 *     # cdef cnp.ndarray[double, ndim=1] loglik = np.empty(nbursts, dtype=np.double)
 *     # cdef double *ll = <double*> loglik.data
*/
  /*else*/ {
    __pyx_t_1 = __pyx_f_6H2MM_C_cpath_ll(__pyx_v_nbursts, __pyx_cur_scope->__pyx_v_burst_sizes, __pyx_v_cdeltas, __pyx_v_cindexes, __pyx_v_cstate_path, __pyx_v_model->model, __pyx_v_ncore); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(__pyx_t_1 != Py_None)) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3708, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 3708, __pyx_L1_error)
    }
    __pyx_v_res = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_loglik = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "H2MM_C.pyx":3712
 *     # cdef double *ll = <double*> loglik.data
 *     # cdef res = pathloglik(nbursts, burst_sizes, cdeltas, cindexes, cstate_path, model.model, ll, ncore)
 *     free_idx_diffs_path_arrays(nbursts, burst_sizes, cindexes, cdeltas, cstate_path)             # <<<<<<<<<<<<<<
 *     # catch errors
 *     if isinstance(res, Exception):
*/
  __pyx_t_14 = __pyx_f_6H2MM_C_free_idx_diffs_path_arrays(__pyx_v_nbursts, __pyx_cur_scope->__pyx_v_burst_sizes, __pyx_v_cindexes, __pyx_v_cdeltas, __pyx_v_cstate_path); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3712, __pyx_L1_error)

  /* "H2MM_C.pyx":3714
 *     free_idx_diffs_path_arrays(nbursts, burst_sizes, cindexes, cdeltas, cstate_path)
 *     # catch errors
 *     if isinstance(res, Exception):             # <<<<<<<<<<<<<<
 *         raise res
 *     elif res == -2:
*/
  __pyx_t_9 = __Pyx_PyException_Check(__pyx_v_res); 
  if (unlikely(__pyx_t_9)) {

    /* "H2MM_C.pyx":3715
 *     # catch errors
 *     if isinstance(res, Exception):
 *         raise res             # <<<<<<<<<<<<<<
 *     elif res == -2:
 *         raise ValueError("Detector indexes out of range")
*/
    __Pyx_Raise(__pyx_v_res, 0, 0, 0);
    __PYX_ERR(0, 3715, __pyx_L1_error)

    /* "H2MM_C.pyx":3714
 *     free_idx_diffs_path_arrays(nbursts, burst_sizes, cindexes, cdeltas, cstate_path)
 *     # catch errors
 *     if isinstance(res, Exception):             # <<<<<<<<<<<<<<
 *         raise res
 *     elif res == -2:
*/
  }

  /* "H2MM_C.pyx":3716
 *     if isinstance(res, Exception):
 *         raise res
 *     elif res == -2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Detector indexes out of range")
 *     elif res == -1:
*/
  __pyx_t_9 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_res, __pyx_mstate_global->__pyx_int_neg_2, -2L, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3716, __pyx_L1_error)
  if (unlikely(__pyx_t_9)) {

    /* "H2MM_C.pyx":3717
 *         raise res
 *     elif res == -2:
 *         raise ValueError("Detector indexes out of range")             # <<<<<<<<<<<<<<
 *     elif res == -1:
 *         raise ValueError("Empty or null array, raise issue on github")
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Detector_indexes_out_of_range};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3717, __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, 3717, __pyx_L1_error)

    /* "H2MM_C.pyx":3716
 *     if isinstance(res, Exception):
 *         raise res
 *     elif res == -2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Detector indexes out of range")
 *     elif res == -1:
*/
  }

  /* "H2MM_C.pyx":3718
 *     elif res == -2:
 *         raise ValueError("Detector indexes out of range")
 *     elif res == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Empty or null array, raise issue on github")
 *     elif res < -2:
*/
  __pyx_t_9 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_res, __pyx_mstate_global->__pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3718, __pyx_L1_error)
  if (unlikely(__pyx_t_9)) {

    /* "H2MM_C.pyx":3719
 *         raise ValueError("Detector indexes out of range")
 *     elif res == -1:
 *         raise ValueError("Empty or null array, raise issue on github")             # <<<<<<<<<<<<<<
 *     elif res < -2:
 *         raise RuntimeError("Uknown error, raise issue on github")
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Empty_or_null_array_raise_issue};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3719, __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, 3719, __pyx_L1_error)

    /* "H2MM_C.pyx":3718
 *     elif res == -2:
 *         raise ValueError("Detector indexes out of range")
 *     elif res == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Empty or null array, raise issue on github")
 *     elif res < -2:
*/
  }

  /* "H2MM_C.pyx":3720
 *     elif res == -1:
 *         raise ValueError("Empty or null array, raise issue on github")
 *     elif res < -2:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Uknown error, raise issue on github")
 *     # build output
*/
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_res, __pyx_mstate_global->__pyx_int_neg_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3720, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_9)) {

    /* "H2MM_C.pyx":3721
 *         raise ValueError("Empty or null array, raise issue on github")
 *     elif res < -2:
 *         raise RuntimeError("Uknown error, raise issue on github")             # <<<<<<<<<<<<<<
 *     # build output
 *     out = list()
*/
    __pyx_t_4 = NULL;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Uknown_error_raise_issue_on_gith};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3721, __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, 3721, __pyx_L1_error)

    /* "H2MM_C.pyx":3720
 *     elif res == -1:
 *         raise ValueError("Empty or null array, raise issue on github")
 *     elif res < -2:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Uknown error, raise issue on github")
 *     # build output
*/
  }

  /* "H2MM_C.pyx":3723
 *         raise RuntimeError("Uknown error, raise issue on github")
 *     # build output
 *     out = list()             # <<<<<<<<<<<<<<
 *     cdef double sum_loglik = np.sum(loglik)
 *     if BIC:
*/
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3724
 *     # build output
 *     out = list()
 *     cdef double sum_loglik = np.sum(loglik)             # <<<<<<<<<<<<<<
 *     if BIC:
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_sum); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_v_loglik)) { __Pyx_RaiseUnboundLocalError("loglik"); __PYX_ERR(0, 3724, __pyx_L1_error) }
  __pyx_t_5 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
    __pyx_t_5 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_loglik};
    __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_15 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3724, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sum_loglik = __pyx_t_15;

  /* "H2MM_C.pyx":3725
 *     out = list()
 *     cdef double sum_loglik = np.sum(loglik)
 *     if BIC:             # <<<<<<<<<<<<<<
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
 *     if total_loglik:
*/
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_BIC); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3725, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":3726
 *     cdef double sum_loglik = np.sum(loglik)
 *     if BIC:
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))             # <<<<<<<<<<<<<<
 *     if total_loglik:
 *         out.append(sum_loglik)
*/
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_model), __pyx_mstate_global->__pyx_n_u_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_nphot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_4);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_5 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyFloat_FromDouble((2.0 * __pyx_v_sum_loglik)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_16 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 3726, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3725
 *     out = list()
 *     cdef double sum_loglik = np.sum(loglik)
 *     if BIC:             # <<<<<<<<<<<<<<
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
 *     if total_loglik:
*/
  }

  /* "H2MM_C.pyx":3727
 *     if BIC:
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
 *     if total_loglik:             # <<<<<<<<<<<<<<
 *         out.append(sum_loglik)
 *     if loglikarray:
*/
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_total_loglik); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3727, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":3728
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
 *     if total_loglik:
 *         out.append(sum_loglik)             # <<<<<<<<<<<<<<
 *     if loglikarray:
 *         out.append(loglik.reshape(shape))
*/
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sum_loglik); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_16 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 3728, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3727
 *     if BIC:
 *         out.append((model.k * np.log(nphot)) - (2*sum_loglik))
 *     if total_loglik:             # <<<<<<<<<<<<<<
 *         out.append(sum_loglik)
 *     if loglikarray:
*/
  }

  /* "H2MM_C.pyx":3729
 *     if total_loglik:
 *         out.append(sum_loglik)
 *     if loglikarray:             # <<<<<<<<<<<<<<
 *         out.append(loglik.reshape(shape))
 *     if loglikpath:
*/
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_loglikarray); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3729, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":3730
 *         out.append(sum_loglik)
 *     if loglikarray:
 *         out.append(loglik.reshape(shape))             # <<<<<<<<<<<<<<
 *     if loglikpath:
 *         out.append(loglikp.reshape(shape))
*/
    if (unlikely(!__pyx_v_loglik)) { __Pyx_RaiseUnboundLocalError("loglik"); __PYX_ERR(0, 3730, __pyx_L1_error) }
    __pyx_t_12 = __pyx_v_loglik;
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_shape};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_16 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 3730, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3729
 *     if total_loglik:
 *         out.append(sum_loglik)
 *     if loglikarray:             # <<<<<<<<<<<<<<
 *         out.append(loglik.reshape(shape))
 *     if loglikpath:
*/
  }

  /* "H2MM_C.pyx":3731
 *     if loglikarray:
 *         out.append(loglik.reshape(shape))
 *     if loglikpath:             # <<<<<<<<<<<<<<
 *         out.append(loglikp.reshape(shape))
 *     if len(out) == 1:
*/
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_loglikpath); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 3731, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":3732
 *         out.append(loglik.reshape(shape))
 *     if loglikpath:
 *         out.append(loglikp.reshape(shape))             # <<<<<<<<<<<<<<
 *     if len(out) == 1:
 *         out = out[0]
*/
    if (unlikely(!__pyx_v_loglikp)) { __Pyx_RaiseUnboundLocalError("loglikp"); __PYX_ERR(0, 3732, __pyx_L1_error) }
    __pyx_t_12 = __pyx_v_loglikp;
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_shape};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reshape, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_16 = __Pyx_PyObject_Append(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 3732, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3731
 *     if loglikarray:
 *         out.append(loglik.reshape(shape))
 *     if loglikpath:             # <<<<<<<<<<<<<<
 *         out.append(loglikp.reshape(shape))
 *     if len(out) == 1:
*/
  }

  /* "H2MM_C.pyx":3733
 *     if loglikpath:
 *         out.append(loglikp.reshape(shape))
 *     if len(out) == 1:             # <<<<<<<<<<<<<<
 *         out = out[0]
 *     else:
*/
  __pyx_t_10 = PyObject_Length(__pyx_v_out); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3733, __pyx_L1_error)
  __pyx_t_9 = (__pyx_t_10 == 1);
  if (__pyx_t_9) {

    /* "H2MM_C.pyx":3734
 *         out.append(loglikp.reshape(shape))
 *     if len(out) == 1:
 *         out = out[0]             # <<<<<<<<<<<<<<
 *     else:
 *         out = tuple(out)
*/
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_out, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "H2MM_C.pyx":3733
 *     if loglikpath:
 *         out.append(loglikp.reshape(shape))
 *     if len(out) == 1:             # <<<<<<<<<<<<<<
 *         out = out[0]
 *     else:
*/
    goto __pyx_L18;
  }

  /* "H2MM_C.pyx":3736
 *         out = out[0]
 *     else:
 *         out = tuple(out)             # <<<<<<<<<<<<<<
 *     return out
 * 
*/
  /*else*/ {
    __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L18:;

  /* "H2MM_C.pyx":3737
 *     else:
 *         out = tuple(out)
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=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_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("H2MM_C.path_loglik", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shape);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_loglikp);
  __Pyx_XDECREF(__pyx_v_loglik);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_gb_6H2MM_C_11path_loglik_2generator7);
  __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_indexes);
  __Pyx_XDECREF(__pyx_v_state_path);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3741
 * 
 * # simulation functions
 * def sim_statepath(h2mm_model hmod, int lenp, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     A function to generate a dense statepath (HMM as opposed to H2MM) of length lenp
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_21sim_statepath(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_20sim_statepath, "\n    A function to generate a dense statepath (HMM as opposed to H2MM) of length lenp\n\n    Parameters\n    ----------\n    hmod : h2mm_model\n        An :class:`h2mm_model` to build the state path from\n    lenp : int\n        The length of the path you want to generate\n    seed : positive int, optional\n        The initial random seed, use if you want to be able to replicate results.\n        If None, then uses the current time as the seed.\n        The default is None.\n\n    Raises\n    ------\n    RuntimeError\n        A problem with the C code, this is for future proofing\n    \n    Returns\n    -------\n    path_ret : numpy ndarray, positive integer\n        The random dense state-path\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_21sim_statepath = {"sim_statepath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_21sim_statepath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_20sim_statepath};
static PyObject *__pyx_pw_6H2MM_C_21sim_statepath(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod = 0;
  int __pyx_v_lenp;
  PyObject *__pyx_v_seed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sim_statepath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_hmod,&__pyx_mstate_global->__pyx_n_u_lenp,&__pyx_mstate_global->__pyx_n_u_seed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3741, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3741, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3741, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3741, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "sim_statepath", 0) < (0)) __PYX_ERR(0, 3741, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("sim_statepath", 0, 2, 3, i); __PYX_ERR(0, 3741, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3741, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3741, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3741, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_hmod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_lenp = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_lenp == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3741, __pyx_L3_error)
    __pyx_v_seed = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sim_statepath", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3741, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.sim_statepath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "hmod", 0))) __PYX_ERR(0, 3741, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_20sim_statepath(__pyx_self, __pyx_v_hmod, __pyx_v_lenp, __pyx_v_seed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_20sim_statepath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, int __pyx_v_lenp, PyObject *__pyx_v_seed) {
  PyArrayObject *__pyx_v_path = 0;
  uint8_t *__pyx_v_path_n;
  unsigned int __pyx_v_seedp;
  int __pyx_v_exp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_path;
  __Pyx_Buffer __pyx_pybuffer_path;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sim_statepath", 0);
  __pyx_pybuffer_path.pybuffer.buf = NULL;
  __pyx_pybuffer_path.refcount = 0;
  __pyx_pybuffernd_path.data = NULL;
  __pyx_pybuffernd_path.rcbuffer = &__pyx_pybuffer_path;

  /* "H2MM_C.pyx":3767
 * 
 *     """
 *     if lenp < 2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Length must be at least 3")
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
*/
  __pyx_t_1 = (__pyx_v_lenp < 2);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":3768
 *     """
 *     if lenp < 2:
 *         raise ValueError("Length must be at least 3")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
*/
    __pyx_t_3 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Length_must_be_at_least_3};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3768, __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(0, 3768, __pyx_L1_error)

    /* "H2MM_C.pyx":3767
 * 
 *     """
 *     if lenp < 2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Length must be at least 3")
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
*/
  }

  /* "H2MM_C.pyx":3769
 *     if lenp < 2:
 *         raise ValueError("Length must be at least 3")
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
*/
  __pyx_t_3 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_lenp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    assert(__pyx_t_3);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
    __pyx_t_4 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_5};
    __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_8, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3769, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3769, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_path.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_path = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_path.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3769, __pyx_L1_error)
    } else {__pyx_pybuffernd_path.diminfo[0].strides = __pyx_pybuffernd_path.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_path.diminfo[0].shape = __pyx_pybuffernd_path.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_path = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "H2MM_C.pyx":3770
 *         raise ValueError("Length must be at least 3")
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data             # <<<<<<<<<<<<<<
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
*/
  __pyx_v_path_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_path)));

  /* "H2MM_C.pyx":3771
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0             # <<<<<<<<<<<<<<
 *     if seed is not None:
 *         seedp = <unsigned int> seed
*/
  __pyx_v_seedp = 0;

  /* "H2MM_C.pyx":3772
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
*/
  __pyx_t_1 = (__pyx_v_seed != Py_None);
  if (__pyx_t_1) {

    /* "H2MM_C.pyx":3773
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
 *         seedp = <unsigned int> seed             # <<<<<<<<<<<<<<
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
 *     if exp != 0:
*/
    __pyx_t_9 = __Pyx_PyLong_As_unsigned_int(__pyx_v_seed); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3773, __pyx_L1_error)
    __pyx_v_seedp = ((unsigned int)__pyx_t_9);

    /* "H2MM_C.pyx":3772
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
*/
  }

  /* "H2MM_C.pyx":3774
 *     if seed is not None:
 *         seedp = <unsigned int> seed
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)             # <<<<<<<<<<<<<<
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
*/
  __pyx_v_exp = statepath(__pyx_v_hmod->model, __pyx_v_lenp, __pyx_v_path_n, __pyx_v_seedp);

  /* "H2MM_C.pyx":3775
 *         seedp = <unsigned int> seed
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path
*/
  __pyx_t_1 = (__pyx_v_exp != 0);
  if (unlikely(__pyx_t_1)) {

    /* "H2MM_C.pyx":3776
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")             # <<<<<<<<<<<<<<
 *     return path
 * 
*/
    __pyx_t_6 = NULL;
    __pyx_t_4 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Unknown_error_raise_issue_on_git};
      __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3776, __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(0, 3776, __pyx_L1_error)

    /* "H2MM_C.pyx":3775
 *         seedp = <unsigned int> seed
 *     cdef int exp = statepath(hmod.model, lenp, path_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path
*/
  }

  /* "H2MM_C.pyx":3777
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_path);
  __pyx_r = ((PyObject *)__pyx_v_path);
  goto __pyx_L0;

  /* "H2MM_C.pyx":3741
 * 
 * # simulation functions
 * def sim_statepath(h2mm_model hmod, int lenp, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     A function to generate a dense statepath (HMM as opposed to H2MM) of length lenp
*/

  /* function exit code */
  __pyx_L1_error:;
  __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);
  { 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_path.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.sim_statepath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_path.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3780
 * 
 * 
 * def sim_sparsestatepath(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path from a model and a sparse set of arrival times
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_23sim_sparsestatepath(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_22sim_sparsestatepath, "\n    Generate a state path from a model and a sparse set of arrival times\n\n    Parameters\n    ----------\n    hmod : h2mm_model\n        An :class:`h2mm_model` to build the state path from\n    times : numpy ndarray 1D int\n        An unsigned integer of monotonically increasing times for the burst\n    seed : positive int, optional\n        The initial random seed, use if you want to be able to replicate results.\n        If None, then uses the current time as the seed.\n        The default is None.\n\n    Raises\n    ------\n    TypeError\n        Your array was not 1D\n    ValueError\n        Your time were not monotonically increasing\n    RuntimeError\n        Unknown error, please raise issue on github\n\n    Returns\n    -------\n    path : numpy ndarray 1D long int\n        A randomly generated statepath based on the input model and times\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_23sim_sparsestatepath = {"sim_sparsestatepath", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_23sim_sparsestatepath, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_22sim_sparsestatepath};
static PyObject *__pyx_pw_6H2MM_C_23sim_sparsestatepath(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_seed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sim_sparsestatepath (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_hmod,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_seed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3780, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3780, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3780, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3780, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "sim_sparsestatepath", 0) < (0)) __PYX_ERR(0, 3780, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("sim_sparsestatepath", 0, 2, 3, i); __PYX_ERR(0, 3780, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3780, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3780, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3780, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_hmod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_times = values[1];
    __pyx_v_seed = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sim_sparsestatepath", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3780, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.sim_sparsestatepath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "hmod", 0))) __PYX_ERR(0, 3780, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_22sim_sparsestatepath(__pyx_self, __pyx_v_hmod, __pyx_v_times, __pyx_v_seed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_22sim_sparsestatepath(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_times, PyObject *__pyx_v_seed) {
  PyArrayObject *__pyx_v_times_arr = 0;
  int64_t __pyx_v_lenp;
  int64_t *__pyx_v_times_n;
  PyArrayObject *__pyx_v_path = 0;
  uint8_t *__pyx_v_path_n;
  unsigned int __pyx_v_seedp;
  int __pyx_v_exp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_path;
  __Pyx_Buffer __pyx_pybuffer_path;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_times_arr;
  __Pyx_Buffer __pyx_pybuffer_times_arr;
  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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sim_sparsestatepath", 0);
  __Pyx_INCREF(__pyx_v_times);
  __pyx_pybuffer_times_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_times_arr.refcount = 0;
  __pyx_pybuffernd_times_arr.data = NULL;
  __pyx_pybuffernd_times_arr.rcbuffer = &__pyx_pybuffer_times_arr;
  __pyx_pybuffer_path.pybuffer.buf = NULL;
  __pyx_pybuffer_path.refcount = 0;
  __pyx_pybuffernd_path.data = NULL;
  __pyx_pybuffernd_path.rcbuffer = &__pyx_pybuffer_path;

  /* "H2MM_C.pyx":3810
 * 
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_times};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3810, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__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;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3811
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 3:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3811, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3812
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")             # <<<<<<<<<<<<<<
 *     if times.shape[0] < 3:
 *         raise ValueError("Must have at least 3 times")
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_times_array_must_be_1D};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3812, __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, 3812, __pyx_L1_error)

    /* "H2MM_C.pyx":3811
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 3:
*/
  }

  /* "H2MM_C.pyx":3813
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 3:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 3 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_mstate_global->__pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3813, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3814
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 3:
 *         raise ValueError("Must have at least 3 times")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times
 *     cdef int64_t lenp = <int64_t> times_arr.shape[0]
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Must_have_at_least_3_times};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3814, __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, 3814, __pyx_L1_error)

    /* "H2MM_C.pyx":3813
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 3:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 3 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times
*/
  }

  /* "H2MM_C.pyx":3815
 *     if times.shape[0] < 3:
 *         raise ValueError("Must have at least 3 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times             # <<<<<<<<<<<<<<
 *     cdef int64_t lenp = <int64_t> times_arr.shape[0]
 *     cdef int64_t* times_n = <int64_t*> times_arr.data
*/
  __pyx_t_1 = __pyx_v_times;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3815, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_times_arr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_times_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_times_arr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3815, __pyx_L1_error)
    } else {__pyx_pybuffernd_times_arr.diminfo[0].strides = __pyx_pybuffernd_times_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_times_arr.diminfo[0].shape = __pyx_pybuffernd_times_arr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_times_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3816
 *         raise ValueError("Must have at least 3 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times
 *     cdef int64_t lenp = <int64_t> times_arr.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int64_t* times_n = <int64_t*> times_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
*/
  __pyx_v_lenp = ((int64_t)(__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_times_arr))[0]));

  /* "H2MM_C.pyx":3817
 *     cdef cnp.ndarray[int64_t, ndim=1] times_arr = times
 *     cdef int64_t lenp = <int64_t> times_arr.shape[0]
 *     cdef int64_t* times_n = <int64_t*> times_arr.data             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
*/
  __pyx_v_times_n = ((int64_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_times_arr)));

  /* "H2MM_C.pyx":3818
 *     cdef int64_t lenp = <int64_t> times_arr.shape[0]
 *     cdef int64_t* times_n = <int64_t*> times_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_lenp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_8, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3818, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3818, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_path.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_path = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_path.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3818, __pyx_L1_error)
    } else {__pyx_pybuffernd_path.diminfo[0].strides = __pyx_pybuffernd_path.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_path.diminfo[0].shape = __pyx_pybuffernd_path.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_path = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3819
 *     cdef int64_t* times_n = <int64_t*> times_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data             # <<<<<<<<<<<<<<
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
*/
  __pyx_v_path_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_path)));

  /* "H2MM_C.pyx":3820
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0             # <<<<<<<<<<<<<<
 *     if seed is not None:
 *         seedp = <unsigned int> seed
*/
  __pyx_v_seedp = 0;

  /* "H2MM_C.pyx":3821
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
*/
  __pyx_t_7 = (__pyx_v_seed != Py_None);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3822
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
 *         seedp = <unsigned int> seed             # <<<<<<<<<<<<<<
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:
*/
    __pyx_t_9 = __Pyx_PyLong_As_unsigned_int(__pyx_v_seed); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3822, __pyx_L1_error)
    __pyx_v_seedp = ((unsigned int)__pyx_t_9);

    /* "H2MM_C.pyx":3821
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
*/
  }

  /* "H2MM_C.pyx":3823
 *     if seed is not None:
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)             # <<<<<<<<<<<<<<
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
*/
  __pyx_v_exp = sparsestatepath(__pyx_v_hmod->model, __pyx_v_lenp, __pyx_v_times_n, __pyx_v_path_n, __pyx_v_seedp);

  /* "H2MM_C.pyx":3824
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
*/
  __pyx_t_7 = (__pyx_v_exp == 1);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3825
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:
 *         raise ValueError("Out of order photon")             # <<<<<<<<<<<<<<
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Out_of_order_photon};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3825, __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, 3825, __pyx_L1_error)

    /* "H2MM_C.pyx":3824
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
*/
  }

  /* "H2MM_C.pyx":3826
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path
*/
  __pyx_t_7 = (__pyx_v_exp != 0);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3827
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")             # <<<<<<<<<<<<<<
 *     return path
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unknown_error_raise_issue_on_git};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3827, __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, 3827, __pyx_L1_error)

    /* "H2MM_C.pyx":3826
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path
*/
  }

  /* "H2MM_C.pyx":3828
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return path             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_path);
  __pyx_r = ((PyObject *)__pyx_v_path);
  goto __pyx_L0;

  /* "H2MM_C.pyx":3780
 * 
 * 
 * def sim_sparsestatepath(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path from a model and a sparse set of arrival times
*/

  /* 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);
  { 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_path.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_times_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.sim_sparsestatepath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_path.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_times_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_times_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3831
 * 
 * 
 * def sim_phtraj_from_state(h2mm_model hmod, states, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a photon trajectory from a h2mm model and state trajectory
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_25sim_phtraj_from_state(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_24sim_phtraj_from_state, "\n    Generate a photon trajectory from a h2mm model and state trajectory\n\n    Parameters\n    ----------\n    hmod : h2mm_model\n        An :class:`h2mm_model` to build the stream trajectory from\n    states : numpy ndarray 1D int\n        \n    seed : positive int, optional\n        The initial random seed, use if you want to be able to replicate results.\n        If None, then uses the current time as the seed.\n        The default is None.\n\n    Raises\n    ------\n    TypeError\n        The state array was not 1D\n    RuntimeError\n        Unknown error, please raise issue on github\n\n    Returns\n    -------\n    dets : numpy ndarray 1D int\n        The random photon stream indexes based on model and statepath\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_25sim_phtraj_from_state = {"sim_phtraj_from_state", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_25sim_phtraj_from_state, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_24sim_phtraj_from_state};
static PyObject *__pyx_pw_6H2MM_C_25sim_phtraj_from_state(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod = 0;
  PyObject *__pyx_v_states = 0;
  PyObject *__pyx_v_seed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sim_phtraj_from_state (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_hmod,&__pyx_mstate_global->__pyx_n_u_states_2,&__pyx_mstate_global->__pyx_n_u_seed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3831, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "sim_phtraj_from_state", 0) < (0)) __PYX_ERR(0, 3831, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("sim_phtraj_from_state", 0, 2, 3, i); __PYX_ERR(0, 3831, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3831, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3831, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3831, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_hmod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_states = values[1];
    __pyx_v_seed = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sim_phtraj_from_state", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3831, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.sim_phtraj_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "hmod", 0))) __PYX_ERR(0, 3831, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_24sim_phtraj_from_state(__pyx_self, __pyx_v_hmod, __pyx_v_states, __pyx_v_seed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_24sim_phtraj_from_state(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_states, PyObject *__pyx_v_seed) {
  PyArrayObject *__pyx_v_states_arr = 0;
  int64_t __pyx_v_lenp;
  uint8_t *__pyx_v_states_n;
  PyArrayObject *__pyx_v_dets = 0;
  uint8_t *__pyx_v_dets_n;
  unsigned int __pyx_v_seedp;
  int __pyx_v_exp;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dets;
  __Pyx_Buffer __pyx_pybuffer_dets;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_states_arr;
  __Pyx_Buffer __pyx_pybuffer_states_arr;
  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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sim_phtraj_from_state", 0);
  __Pyx_INCREF(__pyx_v_states);
  __pyx_pybuffer_states_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_states_arr.refcount = 0;
  __pyx_pybuffernd_states_arr.data = NULL;
  __pyx_pybuffernd_states_arr.rcbuffer = &__pyx_pybuffer_states_arr;
  __pyx_pybuffer_dets.pybuffer.buf = NULL;
  __pyx_pybuffer_dets.refcount = 0;
  __pyx_pybuffernd_dets.data = NULL;
  __pyx_pybuffernd_dets.rcbuffer = &__pyx_pybuffer_dets;

  /* "H2MM_C.pyx":3859
 * 
 *     """
 *     states = np.ascontiguousarray(states, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     if states.ndim != 1:
 *         raise TypeError("Times must be 1D")
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_states};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3859, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__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;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_states, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3860
 *     """
 *     states = np.ascontiguousarray(states, dtype=np.uint8)
 *     if states.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("Times must be 1D")
 *     if states.shape[0] < 3:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_states, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3860, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3861
 *     states = np.ascontiguousarray(states, dtype=np.uint8)
 *     if states.ndim != 1:
 *         raise TypeError("Times must be 1D")             # <<<<<<<<<<<<<<
 *     if states.shape[0] < 3:
 *         raise ValueError("Must have at least 3 time points")
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Times_must_be_1D};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3861, __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, 3861, __pyx_L1_error)

    /* "H2MM_C.pyx":3860
 *     """
 *     states = np.ascontiguousarray(states, dtype=np.uint8)
 *     if states.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("Times must be 1D")
 *     if states.shape[0] < 3:
*/
  }

  /* "H2MM_C.pyx":3862
 *     if states.ndim != 1:
 *         raise TypeError("Times must be 1D")
 *     if states.shape[0] < 3:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 3 time points")
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_states, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_mstate_global->__pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3863
 *         raise TypeError("Times must be 1D")
 *     if states.shape[0] < 3:
 *         raise ValueError("Must have at least 3 time points")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states
 *     cdef int64_t lenp = states_arr.shape[0]
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Must_have_at_least_3_time_points};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3863, __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, 3863, __pyx_L1_error)

    /* "H2MM_C.pyx":3862
 *     if states.ndim != 1:
 *         raise TypeError("Times must be 1D")
 *     if states.shape[0] < 3:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 3 time points")
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states
*/
  }

  /* "H2MM_C.pyx":3864
 *     if states.shape[0] < 3:
 *         raise ValueError("Must have at least 3 time points")
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states             # <<<<<<<<<<<<<<
 *     cdef int64_t lenp = states_arr.shape[0]
 *     cdef uint8_t* states_n = <uint8_t*> states_arr.data
*/
  __pyx_t_1 = __pyx_v_states;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3864, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_states_arr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_states_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_states_arr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3864, __pyx_L1_error)
    } else {__pyx_pybuffernd_states_arr.diminfo[0].strides = __pyx_pybuffernd_states_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_states_arr.diminfo[0].shape = __pyx_pybuffernd_states_arr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_states_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3865
 *         raise ValueError("Must have at least 3 time points")
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states
 *     cdef int64_t lenp = states_arr.shape[0]             # <<<<<<<<<<<<<<
 *     cdef uint8_t* states_n = <uint8_t*> states_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
*/
  __pyx_v_lenp = (__pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_states_arr))[0]);

  /* "H2MM_C.pyx":3866
 *     cdef cnp.ndarray[uint8_t, ndim=1] states_arr = states
 *     cdef int64_t lenp = states_arr.shape[0]
 *     cdef uint8_t* states_n = <uint8_t*> states_arr.data             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data
*/
  __pyx_v_states_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_states_arr)));

  /* "H2MM_C.pyx":3867
 *     cdef int64_t lenp = states_arr.shape[0]
 *     cdef uint8_t* states_n = <uint8_t*> states_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data
 *     cdef unsigned int seedp = 0
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_lenp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_4);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_3};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_8, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3867, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3867, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dets.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dets = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dets.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3867, __pyx_L1_error)
    } else {__pyx_pybuffernd_dets.diminfo[0].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dets.diminfo[0].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_dets = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3868
 *     cdef uint8_t* states_n = <uint8_t*> states_arr.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data             # <<<<<<<<<<<<<<
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
*/
  __pyx_v_dets_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dets)));

  /* "H2MM_C.pyx":3869
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data
 *     cdef unsigned int seedp = 0             # <<<<<<<<<<<<<<
 *     if seed is not None:
 *         seedp = <unsigned int> seed
*/
  __pyx_v_seedp = 0;

  /* "H2MM_C.pyx":3870
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
*/
  __pyx_t_7 = (__pyx_v_seed != Py_None);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3871
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
 *         seedp = <unsigned int> seed             # <<<<<<<<<<<<<<
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
 *     if exp != 0:
*/
    __pyx_t_9 = __Pyx_PyLong_As_unsigned_int(__pyx_v_seed); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3871, __pyx_L1_error)
    __pyx_v_seedp = ((unsigned int)__pyx_t_9);

    /* "H2MM_C.pyx":3870
 *     cdef uint8_t* dets_n =  <uint8_t*> dets.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
*/
  }

  /* "H2MM_C.pyx":3872
 *     if seed is not None:
 *         seedp = <unsigned int> seed
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)             # <<<<<<<<<<<<<<
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
*/
  __pyx_v_exp = phpathgen(__pyx_v_hmod->model, __pyx_v_lenp, __pyx_v_states_n, __pyx_v_dets_n, __pyx_v_seedp);

  /* "H2MM_C.pyx":3873
 *         seedp = <unsigned int> seed
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return dets
*/
  __pyx_t_7 = (__pyx_v_exp != 0);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3874
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")             # <<<<<<<<<<<<<<
 *     return dets
 * 
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unknown_error_raise_issue_on_git};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3874, __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, 3874, __pyx_L1_error)

    /* "H2MM_C.pyx":3873
 *         seedp = <unsigned int> seed
 *     cdef int exp = phpathgen(hmod.model, lenp, states_n, dets_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return dets
*/
  }

  /* "H2MM_C.pyx":3875
 *     if exp != 0:
 *         raise RuntimeError("Unknown error, raise issue on github")
 *     return dets             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_dets);
  __pyx_r = ((PyObject *)__pyx_v_dets);
  goto __pyx_L0;

  /* "H2MM_C.pyx":3831
 * 
 * 
 * def sim_phtraj_from_state(h2mm_model hmod, states, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a photon trajectory from a h2mm model and state 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  { 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_dets.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_states_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.sim_phtraj_from_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_states_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_states_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_dets);
  __Pyx_XDECREF(__pyx_v_states);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H2MM_C.pyx":3878
 * 
 * 
 * def sim_phtraj_from_times(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path and photon trajectory for a given set of times
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_27sim_phtraj_from_times(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_6H2MM_C_26sim_phtraj_from_times, "\n    Generate a state path and photon trajectory for a given set of times\n\n    Parameters\n    ----------\n    hmod : h2mm_model\n        An :class:`h2mm_model` to build the path and stream trajectories from\n    times : numpy.ndarray 1D int\n        An unsigned integer of monotonically increasing times for the burst\n    seed : positive int, optional\n        The initial random seed, use if you want to be able to replicate results.\n        If None, then uses the current time as the seed.\n        The default is None.\n\n    Raises\n    ------\n    TypeError\n        tiems array must be 1D\n    ValueError\n        times were not monotonically increasing\n    RuntimeError\n        Unknown error, raise issue on github\n    \n    Returns\n    -------\n    path : numpy.ndarray 1D int\n        State trajectory generated for the input times\n    dets : numpy.ndarray 1D int\n        stream trajectory generate for the input times, derived from path\n\n    ");
static PyMethodDef __pyx_mdef_6H2MM_C_27sim_phtraj_from_times = {"sim_phtraj_from_times", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_27sim_phtraj_from_times, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_26sim_phtraj_from_times};
static PyObject *__pyx_pw_6H2MM_C_27sim_phtraj_from_times(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod = 0;
  PyObject *__pyx_v_times = 0;
  PyObject *__pyx_v_seed = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sim_phtraj_from_times (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_hmod,&__pyx_mstate_global->__pyx_n_u_times,&__pyx_mstate_global->__pyx_n_u_seed,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 3878, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3878, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3878, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3878, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "sim_phtraj_from_times", 0) < (0)) __PYX_ERR(0, 3878, __pyx_L3_error)
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("sim_phtraj_from_times", 0, 2, 3, i); __PYX_ERR(0, 3878, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3878, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3878, __pyx_L3_error)
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 3878, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_hmod = ((struct __pyx_obj_6H2MM_C_h2mm_model *)values[0]);
    __pyx_v_times = values[1];
    __pyx_v_seed = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sim_phtraj_from_times", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3878, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.sim_phtraj_from_times", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hmod), __pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, 1, "hmod", 0))) __PYX_ERR(0, 3878, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_26sim_phtraj_from_times(__pyx_self, __pyx_v_hmod, __pyx_v_times, __pyx_v_seed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_26sim_phtraj_from_times(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6H2MM_C_h2mm_model *__pyx_v_hmod, PyObject *__pyx_v_times, PyObject *__pyx_v_seed) {
  PyArrayObject *__pyx_v_ctimes = 0;
  int64_t __pyx_v_lenp;
  int64_t *__pyx_v_times_n;
  PyArrayObject *__pyx_v_path = 0;
  uint8_t *__pyx_v_path_n;
  unsigned int __pyx_v_seedp;
  int __pyx_v_exp;
  PyArrayObject *__pyx_v_dets = 0;
  uint8_t *__pyx_v_dets_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ctimes;
  __Pyx_Buffer __pyx_pybuffer_ctimes;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dets;
  __Pyx_Buffer __pyx_pybuffer_dets;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_path;
  __Pyx_Buffer __pyx_pybuffer_path;
  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;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  unsigned int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sim_phtraj_from_times", 0);
  __Pyx_INCREF(__pyx_v_times);
  __pyx_pybuffer_ctimes.pybuffer.buf = NULL;
  __pyx_pybuffer_ctimes.refcount = 0;
  __pyx_pybuffernd_ctimes.data = NULL;
  __pyx_pybuffernd_ctimes.rcbuffer = &__pyx_pybuffer_ctimes;
  __pyx_pybuffer_path.pybuffer.buf = NULL;
  __pyx_pybuffer_path.refcount = 0;
  __pyx_pybuffernd_path.data = NULL;
  __pyx_pybuffernd_path.rcbuffer = &__pyx_pybuffer_path;
  __pyx_pybuffer_dets.pybuffer.buf = NULL;
  __pyx_pybuffer_dets.refcount = 0;
  __pyx_pybuffernd_dets.data = NULL;
  __pyx_pybuffernd_dets.rcbuffer = &__pyx_pybuffer_dets;

  /* "H2MM_C.pyx":3910
 * 
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
*/
  __pyx_t_2 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    assert(__pyx_t_2);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_times};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3910, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__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;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3911
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 2:
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3912
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")             # <<<<<<<<<<<<<<
 *     if times.shape[0] < 2:
 *         raise ValueError("Must have at least 2 times")
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_times_array_must_be_1D};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3912, __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, 3912, __pyx_L1_error)

    /* "H2MM_C.pyx":3911
 *     """
 *     times = np.ascontiguousarray(times, dtype=np.int64)
 *     if times.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 2:
*/
  }

  /* "H2MM_C.pyx":3913
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 2 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_mstate_global->__pyx_int_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3914
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 2:
 *         raise ValueError("Must have at least 2 times")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times
 *     cdef int64_t lenp = times.shape[0]
*/
    __pyx_t_4 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Must_have_at_least_2_times};
      __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3914, __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, 3914, __pyx_L1_error)

    /* "H2MM_C.pyx":3913
 *     if times.ndim != 1:
 *         raise TypeError("times array must be 1D")
 *     if times.shape[0] < 2:             # <<<<<<<<<<<<<<
 *         raise ValueError("Must have at least 2 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times
*/
  }

  /* "H2MM_C.pyx":3915
 *     if times.shape[0] < 2:
 *         raise ValueError("Must have at least 2 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times             # <<<<<<<<<<<<<<
 *     cdef int64_t lenp = times.shape[0]
 *     cdef int64_t* times_n = <int64_t*> ctimes.data
*/
  __pyx_t_1 = __pyx_v_times;
  __Pyx_INCREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3915, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctimes.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_ctimes = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctimes.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3915, __pyx_L1_error)
    } else {__pyx_pybuffernd_ctimes.diminfo[0].strides = __pyx_pybuffernd_ctimes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctimes.diminfo[0].shape = __pyx_pybuffernd_ctimes.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_ctimes = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H2MM_C.pyx":3916
 *         raise ValueError("Must have at least 2 times")
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times
 *     cdef int64_t lenp = times.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int64_t* times_n = <int64_t*> ctimes.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_times, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyLong_As_int64_t(__pyx_t_4); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_lenp = __pyx_t_8;

  /* "H2MM_C.pyx":3917
 *     cdef cnp.ndarray[int64_t, ndim=1] ctimes = times
 *     cdef int64_t lenp = times.shape[0]
 *     cdef int64_t* times_n = <int64_t*> ctimes.data             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
*/
  __pyx_v_times_n = ((int64_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctimes)));

  /* "H2MM_C.pyx":3918
 *     cdef int64_t lenp = times.shape[0]
 *     cdef int64_t* times_n = <int64_t*> ctimes.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
*/
  __pyx_t_1 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_lenp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    assert(__pyx_t_1);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_3};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_9, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3918, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __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;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3918, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_path.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_path = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_path.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3918, __pyx_L1_error)
    } else {__pyx_pybuffernd_path.diminfo[0].strides = __pyx_pybuffernd_path.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_path.diminfo[0].shape = __pyx_pybuffernd_path.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_path = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3919
 *     cdef int64_t* times_n = <int64_t*> ctimes.data
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data             # <<<<<<<<<<<<<<
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
*/
  __pyx_v_path_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_path)));

  /* "H2MM_C.pyx":3920
 *     cdef cnp.ndarray[uint8_t, ndim=1] path = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0             # <<<<<<<<<<<<<<
 *     if seed is not None:
 *         seedp = <unsigned int> seed
*/
  __pyx_v_seedp = 0;

  /* "H2MM_C.pyx":3921
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
*/
  __pyx_t_7 = (__pyx_v_seed != Py_None);
  if (__pyx_t_7) {

    /* "H2MM_C.pyx":3922
 *     cdef unsigned int seedp = 0
 *     if seed is not None:
 *         seedp = <unsigned int> seed             # <<<<<<<<<<<<<<
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:
*/
    __pyx_t_10 = __Pyx_PyLong_As_unsigned_int(__pyx_v_seed); if (unlikely((__pyx_t_10 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3922, __pyx_L1_error)
    __pyx_v_seedp = ((unsigned int)__pyx_t_10);

    /* "H2MM_C.pyx":3921
 *     cdef uint8_t* path_n = <uint8_t*> path.data
 *     cdef unsigned int seedp = 0
 *     if seed is not None:             # <<<<<<<<<<<<<<
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
*/
  }

  /* "H2MM_C.pyx":3923
 *     if seed is not None:
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)             # <<<<<<<<<<<<<<
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
*/
  __pyx_v_exp = sparsestatepath(__pyx_v_hmod->model, __pyx_v_lenp, __pyx_v_times_n, __pyx_v_path_n, __pyx_v_seedp);

  /* "H2MM_C.pyx":3924
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
*/
  __pyx_t_7 = (__pyx_v_exp == 1);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3925
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:
 *         raise ValueError("Out of order photon")             # <<<<<<<<<<<<<<
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Out_of_order_photon};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3925, __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, 3925, __pyx_L1_error)

    /* "H2MM_C.pyx":3924
 *         seedp = <unsigned int> seed
 *     cdef int exp = sparsestatepath(hmod.model, lenp, times_n, path_n, seedp)
 *     if exp == 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
*/
  }

  /* "H2MM_C.pyx":3926
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
*/
  __pyx_t_7 = (__pyx_v_exp != 0);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3927
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data
*/
    __pyx_t_5 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unknown_error_in_sparsestatepath};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3927, __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, 3927, __pyx_L1_error)

    /* "H2MM_C.pyx":3926
 *     if exp == 1:
 *         raise ValueError("Out of order photon")
 *     elif exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
*/
  }

  /* "H2MM_C.pyx":3928
 *     elif exp != 0:
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)             # <<<<<<<<<<<<<<
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyLong_From_int64_t(__pyx_v_lenp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = 1;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    assert(__pyx_t_5);
    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx__function);
    __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
    __pyx_t_6 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_2};
    __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_1, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 3928, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
    __Pyx_XDECREF(__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;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3928, __pyx_L1_error)
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dets.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_nn_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dets = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dets.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3928, __pyx_L1_error)
    } else {__pyx_pybuffernd_dets.diminfo[0].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dets.diminfo[0].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_v_dets = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H2MM_C.pyx":3929
 *         raise RuntimeError("Unknown error in sparsestatepath, raise issue on github")
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data             # <<<<<<<<<<<<<<
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)
 *     if exp != 0:
*/
  __pyx_v_dets_n = ((uint8_t *)__pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dets)));

  /* "H2MM_C.pyx":3930
 *     cdef cnp.ndarray[uint8_t, ndim=1] dets = np.empty(lenp, dtype=np.uint8)
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)             # <<<<<<<<<<<<<<
 *     if exp != 0:
 *         raise RuntimeError("Unknown error in phtragen, raise issue on github")
*/
  __pyx_v_exp = phpathgen(__pyx_v_hmod->model, __pyx_v_lenp, __pyx_v_path_n, __pyx_v_dets_n, __pyx_v_seedp);

  /* "H2MM_C.pyx":3931
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error in phtragen, raise issue on github")
 *     return path , dets
*/
  __pyx_t_7 = (__pyx_v_exp != 0);
  if (unlikely(__pyx_t_7)) {

    /* "H2MM_C.pyx":3932
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)
 *     if exp != 0:
 *         raise RuntimeError("Unknown error in phtragen, raise issue on github")             # <<<<<<<<<<<<<<
 *     return path , dets
*/
    __pyx_t_9 = NULL;
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_Unknown_error_in_phtragen_raise};
      __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3932, __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, 3932, __pyx_L1_error)

    /* "H2MM_C.pyx":3931
 *     cdef uint8_t* dets_n = <uint8_t*> dets.data
 *     exp = phpathgen(hmod.model, lenp, path_n, dets_n, seedp)
 *     if exp != 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Unknown error in phtragen, raise issue on github")
 *     return path , dets
*/
  }

  /* "H2MM_C.pyx":3933
 *     if exp != 0:
 *         raise RuntimeError("Unknown error in phtragen, raise issue on github")
 *     return path , dets             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_path);
  __Pyx_GIVEREF((PyObject *)__pyx_v_path);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_path)) != (0)) __PYX_ERR(0, 3933, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_dets);
  __Pyx_GIVEREF((PyObject *)__pyx_v_dets);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_dets)) != (0)) __PYX_ERR(0, 3933, __pyx_L1_error);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "H2MM_C.pyx":3878
 * 
 * 
 * def sim_phtraj_from_times(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path and photon trajectory for a given set of times
*/

  /* 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_9);
  { 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_ctimes.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_path.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("H2MM_C.sim_phtraj_from_times", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctimes.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_path.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ctimes);
  __Pyx_XDECREF((PyObject *)__pyx_v_path);
  __Pyx_XDECREF((PyObject *)__pyx_v_dets);
  __Pyx_XDECREF(__pyx_v_times);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ConvCodes(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
*/

/* Python wrapper */
static PyObject *__pyx_pw_6H2MM_C_30__pyx_unpickle_ConvCodes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_6H2MM_C_30__pyx_unpickle_ConvCodes = {"__pyx_unpickle_ConvCodes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_30__pyx_unpickle_ConvCodes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6H2MM_C_30__pyx_unpickle_ConvCodes(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[3] = {0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_ConvCodes (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_SIZE
  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #else
  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  #endif
  #endif
  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0};
    const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
    if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  3:
        values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  2:
        values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  1:
        values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      const Py_ssize_t kwd_pos_args = __pyx_nargs;
      if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_ConvCodes", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConvCodes", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error)
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error)
    __pyx_v___pyx_state = ((PyObject*)values[2]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ConvCodes", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __Pyx_AddTraceback("H2MM_C.__pyx_unpickle_ConvCodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error)
  __pyx_r = __pyx_pf_6H2MM_C_29__pyx_unpickle_ConvCodes(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  goto __pyx_L7_cleaned_up;
  __pyx_L0:;
  for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
    Py_XDECREF(values[__pyx_temp]);
  }
  __pyx_L7_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6H2MM_C_29__pyx_unpickle_ConvCodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  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;
  size_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ConvCodes", 0);

  /* "(tree fragment)":6
 * def __pyx_unpickle_ConvCodes(__pyx_type, long __pyx_checksum, tuple __pyx_state):
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')             # <<<<<<<<<<<<<<
 *     __pyx_result = ConvCodes.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
  __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, __pyx_k__7); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error)

  /* "(tree fragment)":7
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
 *     __pyx_result = ConvCodes.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6H2MM_C_ConvCodes);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_v___pyx_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
 *     __pyx_result = ConvCodes.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None));
  if (__pyx_t_5) {

    /* "(tree fragment)":9
 *     __pyx_result = ConvCodes.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_ConvCodes__set_state(ConvCodes __pyx_result, __pyx_state: tuple):
*/
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'");
      __PYX_ERR(1, 9, __pyx_L1_error)
    }
    __pyx_t_2 = __pyx_f_6H2MM_C___pyx_unpickle_ConvCodes__set_state(((struct __pyx_obj_6H2MM_C_ConvCodes *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "(tree fragment)":8
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
 *     __pyx_result = ConvCodes.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_ConvCodes__set_state(ConvCodes __pyx_result, __pyx_state: tuple):
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0)
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ConvCodes(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("H2MM_C.__pyx_unpickle_ConvCodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ConvCodes__set_state(ConvCodes __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0)
*/

static PyObject *__pyx_f_6H2MM_C___pyx_unpickle_ConvCodes__set_state(struct __pyx_obj_6H2MM_C_ConvCodes *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_ConvCodes__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_ConvCodes__set_state(ConvCodes __pyx_result, __pyx_state: tuple):
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0)             # <<<<<<<<<<<<<<
*/
  __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)

  /* "(tree fragment)":11
 *         __pyx_unpickle_ConvCodes__set_state(<ConvCodes> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_ConvCodes__set_state(ConvCodes __pyx_result, __pyx_state: tuple):             # <<<<<<<<<<<<<<
 *     __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("H2MM_C.__pyx_unpickle_ConvCodes__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */

static PyObject *__pyx_tp_new_6H2MM_C_opt_lim_const(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6H2MM_C_opt_lim_const *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6H2MM_C_opt_lim_const *)o);
  p->_formatter = Py_None; Py_INCREF(Py_None);
  p->_outstream = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6H2MM_C_13opt_lim_const_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6H2MM_C_opt_lim_const(PyObject *o) {
  struct __pyx_obj_6H2MM_C_opt_lim_const *p = (struct __pyx_obj_6H2MM_C_opt_lim_const *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C_opt_lim_const) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_formatter);
  Py_CLEAR(p->_outstream);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6H2MM_C_opt_lim_const(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C_opt_lim_const *p = (struct __pyx_obj_6H2MM_C_opt_lim_const *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->_formatter) {
    e = (*v)(p->_formatter, a); if (e) return e;
  }
  if (p->_outstream) {
    e = (*v)(p->_outstream, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6H2MM_C_opt_lim_const(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6H2MM_C_opt_lim_const *p = (struct __pyx_obj_6H2MM_C_opt_lim_const *)o;
  tmp = ((PyObject*)p->_formatter);
  p->_formatter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_outstream);
  p->_outstream = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_6H2MM_C_opt_lim_const(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6H2MM_C_opt_lim_const(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_5__setitem__(o, i, v);
  }
  else {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_max_iter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_max_iter(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_8max_iter_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_max_time(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_8max_time_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_max_time(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_8max_time_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_converged_min(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_converged_min(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_13converged_min_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_num_cores(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_num_cores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_9num_cores_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_formatter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_9formatter_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_formatter(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_9formatter_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_13opt_lim_const_outstream(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_13opt_lim_const_9outstream_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_13opt_lim_const_outstream(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_13opt_lim_const_9outstream_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_6H2MM_C_opt_lim_const[] = {
  {"_get_max_iter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_9_get_max_iter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_8_get_max_iter},
  {"_get_max_time", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_11_get_max_time, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_10_get_max_time},
  {"_get_converged_min", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_13_get_converged_min, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_12_get_converged_min},
  {"_get_num_cores", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_15_get_num_cores, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_14_get_num_cores},
  {"_get_formatter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_17_get_formatter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_16_get_formatter},
  {"_get_outstream", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_19_get_outstream, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_13opt_lim_const_18_get_outstream},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_21__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_13opt_lim_const_23__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6H2MM_C_opt_lim_const[] = {
  {"max_iter", __pyx_getprop_6H2MM_C_13opt_lim_const_max_iter, __pyx_setprop_6H2MM_C_13opt_lim_const_max_iter, PyDoc_STR("Maximum number of iterations before ending optimization"), 0},
  {"max_time", __pyx_getprop_6H2MM_C_13opt_lim_const_max_time, __pyx_setprop_6H2MM_C_13opt_lim_const_max_time, PyDoc_STR("Maximum time of optimization.\n        \n        .. note::\n            \n            This uses the inaccurate C-clock, actual duration of optimization\n            will be variable and generally less thatn the input value\n            \n        "), 0},
  {"converged_min", __pyx_getprop_6H2MM_C_13opt_lim_const_converged_min, __pyx_setprop_6H2MM_C_13opt_lim_const_converged_min, PyDoc_STR("Minimum difference between loglik of succesive iterations for a model to be considered converged"), 0},
  {"num_cores", __pyx_getprop_6H2MM_C_13opt_lim_const_num_cores, __pyx_setprop_6H2MM_C_13opt_lim_const_num_cores, PyDoc_STR("Number of cores to use in optimization\n        \n        .. note::\n            \n            This more specifically sets the number of threads (pthreads in Linux/MacOS)\n            used in optimization\n        "), 0},
  {"formatter", __pyx_getprop_6H2MM_C_13opt_lim_const_formatter, __pyx_setprop_6H2MM_C_13opt_lim_const_formatter, PyDoc_STR("A :class:`Printer` subclass, used to format result of print_func for display of optimiation progress"), 0},
  {"outstream", __pyx_getprop_6H2MM_C_13opt_lim_const_outstream, __pyx_setprop_6H2MM_C_13opt_lim_const_outstream, PyDoc_STR("Callable, when called, generates an output stream for where to print displayed progress"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C_opt_lim_const_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C_opt_lim_const},
  {Py_tp_repr, (void *)__pyx_pw_6H2MM_C_13opt_lim_const_7__repr__},
  {Py_sq_item, (void *)__pyx_sq_item_6H2MM_C_opt_lim_const},
  {Py_mp_subscript, (void *)__pyx_pw_6H2MM_C_13opt_lim_const_3__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_6H2MM_C_opt_lim_const},
  {Py_tp_doc, (void *)PyDoc_STR("\n    Special class for setting default optimization min/max values.\n    Provides access to and type protected setting of these values, \n    either as attributes or keys.\n    Attributes have same names as key-word arguments of functions.\n    \n    The optimization_limits module variable should be of this class\n    \n    ")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C_opt_lim_const},
  {Py_tp_clear, (void *)__pyx_tp_clear_6H2MM_C_opt_lim_const},
  {Py_tp_methods, (void *)__pyx_methods_6H2MM_C_opt_lim_const},
  {Py_tp_getset, (void *)__pyx_getsets_6H2MM_C_opt_lim_const},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C_opt_lim_const},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C_opt_lim_const_spec = {
  "H2MM_C.opt_lim_const",
  sizeof(struct __pyx_obj_6H2MM_C_opt_lim_const),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C_opt_lim_const_slots,
};
#else

static PySequenceMethods __pyx_tp_as_sequence_opt_lim_const = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6H2MM_C_opt_lim_const, /*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_opt_lim_const = {
  0, /*mp_length*/
  __pyx_pw_6H2MM_C_13opt_lim_const_3__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6H2MM_C_opt_lim_const, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6H2MM_C_opt_lim_const = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""opt_lim_const", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C_opt_lim_const), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C_opt_lim_const, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6H2MM_C_13opt_lim_const_7__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_opt_lim_const, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_opt_lim_const, /*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*/
  PyDoc_STR("\n    Special class for setting default optimization min/max values.\n    Provides access to and type protected setting of these values, \n    either as attributes or keys.\n    Attributes have same names as key-word arguments of functions.\n    \n    The optimization_limits module variable should be of this class\n    \n    "), /*tp_doc*/
  __pyx_tp_traverse_6H2MM_C_opt_lim_const, /*tp_traverse*/
  __pyx_tp_clear_6H2MM_C_opt_lim_const, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6H2MM_C_opt_lim_const, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6H2MM_C_opt_lim_const, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C_opt_lim_const, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C_ConvCodes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C_ConvCodes(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C_ConvCodes) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_ll_computed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_11ll_computed_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_from_opt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_8from_opt_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_output(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_6output_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_converged(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_9converged_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_max_iter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_8max_iter_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_max_time(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_8max_time_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_error(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_5error_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_post_opt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_8post_opt_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_9ConvCodes_frozen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_9ConvCodes_6frozen_1__get__(o);
}

static PyMethodDef __pyx_methods_6H2MM_C_ConvCodes[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_9ConvCodes_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_9ConvCodes_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6H2MM_C_ConvCodes[] = {
  {"ll_computed", __pyx_getprop_6H2MM_C_9ConvCodes_ll_computed, 0, PyDoc_STR("Model has had loglik computed against some data (either during optimization or singly"), 0},
  {"from_opt", __pyx_getprop_6H2MM_C_9ConvCodes_from_opt, 0, PyDoc_STR("Model was created during optimization"), 0},
  {"output", __pyx_getprop_6H2MM_C_9ConvCodes_output, 0, PyDoc_STR("Model is best model during optimization, by some criterion marked by other flags"), 0},
  {"converged", __pyx_getprop_6H2MM_C_9ConvCodes_converged, 0, PyDoc_STR("Model has best logliklihood within converged_min threshold"), 0},
  {"max_iter", __pyx_getprop_6H2MM_C_9ConvCodes_max_iter, 0, PyDoc_STR("Optimization reached maximum number of iterations"), 0},
  {"max_time", __pyx_getprop_6H2MM_C_9ConvCodes_max_time, 0, PyDoc_STR("Optimization reach maximum time"), 0},
  {"error", __pyx_getprop_6H2MM_C_9ConvCodes_error, 0, PyDoc_STR("Error occured during optimization"), 0},
  {"post_opt", __pyx_getprop_6H2MM_C_9ConvCodes_post_opt, 0, PyDoc_STR("\n        Model is either the model with poorer loglikelihood between current \n        and old, or is new and loglik is not calculated\n        "), 0},
  {"frozen", __pyx_getprop_6H2MM_C_9ConvCodes_frozen, 0, PyDoc_STR("Model cannot be modified in place"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C_ConvCodes_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C_ConvCodes},
  {Py_tp_doc, (void *)PyDoc_STR("Bitmask for conv_code flags")},
  {Py_tp_methods, (void *)__pyx_methods_6H2MM_C_ConvCodes},
  {Py_tp_getset, (void *)__pyx_getsets_6H2MM_C_ConvCodes},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C_ConvCodes},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C_ConvCodes_spec = {
  "H2MM_C.ConvCodes",
  sizeof(struct __pyx_obj_6H2MM_C_ConvCodes),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6H2MM_C_ConvCodes_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C_ConvCodes = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""ConvCodes", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C_ConvCodes), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C_ConvCodes, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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, /*tp_flags*/
  PyDoc_STR("Bitmask for conv_code flags"), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6H2MM_C_ConvCodes, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6H2MM_C_ConvCodes, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C_ConvCodes, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif
static struct __pyx_vtabstruct_6H2MM_C_h2mm_model __pyx_vtable_6H2MM_C_h2mm_model;

static PyObject *__pyx_tp_new_6H2MM_C_h2mm_model(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6H2MM_C_h2mm_model *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6H2MM_C_h2mm_model *)o);
  p->__pyx_vtab = __pyx_vtabptr_6H2MM_C_h2mm_model;
  if (unlikely(__pyx_pw_6H2MM_C_10h2mm_model_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6H2MM_C_h2mm_model(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C_h2mm_model) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6H2MM_C_10h2mm_model_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_tp_richcompare_6H2MM_C_h2mm_model(PyObject *o1, PyObject *o2, int op) {
  switch (op) {
    case Py_EQ: {
      return __pyx_pw_6H2MM_C_10h2mm_model_19__eq__(o1, o2);
    }
    case Py_NE: {
      PyObject *ret;
      ret = __pyx_pw_6H2MM_C_10h2mm_model_19__eq__(o1, o2);
      if (likely(ret && ret != Py_NotImplemented)) {
        int b = __Pyx_PyObject_IsTrue(ret);
        Py_DECREF(ret);
        if (unlikely(b < 0)) return NULL;
        ret = (b) ? Py_False : Py_True;
        Py_INCREF(ret);
      }
      return ret;
    }
    default: {
      return __Pyx_NewRef(Py_NotImplemented);
    }
  }
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_prior(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_5prior_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_10h2mm_model_prior(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_10h2mm_model_5prior_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_trans(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_5trans_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_10h2mm_model_trans(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_10h2mm_model_5trans_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_obs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_3obs_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_10h2mm_model_obs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_10h2mm_model_3obs_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_loglik(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_6loglik_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_k(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_1k_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_bic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_3bic_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_nstate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_6nstate_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_ndet(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_4ndet_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_nphot(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_5nphot_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_is_conv(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_7is_conv_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_is_opt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_6is_opt_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_is_calc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_7is_calc_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_conv_code(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_9conv_code_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_conv_str(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_8conv_str_1__get__(o);
}

static PyObject *__pyx_getprop_6H2MM_C_10h2mm_model_niter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6H2MM_C_10h2mm_model_5niter_1__get__(o);
}

static int __pyx_setprop_6H2MM_C_10h2mm_model_niter(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6H2MM_C_10h2mm_model_5niter_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_6H2MM_C_h2mm_model[] = {
  {"tobytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_7tobytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_6tobytes},
  {"frombytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_9frombytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_8frombytes},
  {"set_converged", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_15set_converged, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_14set_converged},
  {"sort_states", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_17sort_states, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_16sort_states},
  {"normalize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_21normalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_20normalize},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_23copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_22copy},
  {"__copy__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_25__copy__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"optimize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_29optimize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_28optimize},
  {"evaluate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_31evaluate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6H2MM_C_10h2mm_model_30evaluate},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10h2mm_model_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6H2MM_C_h2mm_model[] = {
  {"prior", __pyx_getprop_6H2MM_C_10h2mm_model_prior, __pyx_setprop_6H2MM_C_10h2mm_model_prior, PyDoc_STR("Prior probability matrix, 1D, size nstate"), 0},
  {"trans", __pyx_getprop_6H2MM_C_10h2mm_model_trans, __pyx_setprop_6H2MM_C_10h2mm_model_trans, PyDoc_STR("Transition probability matrix, square, dimenstions nstate x nstate"), 0},
  {"obs", __pyx_getprop_6H2MM_C_10h2mm_model_obs, __pyx_setprop_6H2MM_C_10h2mm_model_obs, PyDoc_STR("Emission probability matrix, 2D shape nstate x ndet"), 0},
  {"loglik", __pyx_getprop_6H2MM_C_10h2mm_model_loglik, 0, PyDoc_STR("Loglikelihood of model"), 0},
  {"k", __pyx_getprop_6H2MM_C_10h2mm_model_k, 0, PyDoc_STR("Number of free parameters in model"), 0},
  {"bic", __pyx_getprop_6H2MM_C_10h2mm_model_bic, 0, PyDoc_STR("Bayes Information Criterion of model"), 0},
  {"nstate", __pyx_getprop_6H2MM_C_10h2mm_model_nstate, 0, PyDoc_STR("Number of states in model"), 0},
  {"ndet", __pyx_getprop_6H2MM_C_10h2mm_model_ndet, 0, PyDoc_STR("Nubmer of detectors/photon streams in model"), 0},
  {"nphot", __pyx_getprop_6H2MM_C_10h2mm_model_nphot, 0, PyDoc_STR("Number of photons in data set used to optimize model"), 0},
  {"is_conv", __pyx_getprop_6H2MM_C_10h2mm_model_is_conv, 0, PyDoc_STR("Whether or not the optimization reached convergence rather than exceeding the maximum iteration/time of optimization"), 0},
  {"is_opt", __pyx_getprop_6H2MM_C_10h2mm_model_is_opt, 0, PyDoc_STR("Whether or not the model has undergone optimization, as opposed to evaluation or being an initial model"), 0},
  {"is_calc", __pyx_getprop_6H2MM_C_10h2mm_model_is_calc, 0, PyDoc_STR("If model has been optimized/eveluated, vs being an initial model"), 0},
  {"conv_code", __pyx_getprop_6H2MM_C_10h2mm_model_conv_code, 0, PyDoc_STR("The convergence code of model, an int"), 0},
  {"conv_str", __pyx_getprop_6H2MM_C_10h2mm_model_conv_str, 0, PyDoc_STR("String description of how model optimization/calculation ended"), 0},
  {"niter", __pyx_getprop_6H2MM_C_10h2mm_model_niter, __pyx_setprop_6H2MM_C_10h2mm_model_niter, PyDoc_STR("Number of iterations optimization took"), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C_h2mm_model_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C_h2mm_model},
  {Py_tp_repr, (void *)__pyx_pw_6H2MM_C_10h2mm_model_11__repr__},
  {Py_tp_hash, (void *)__pyx_pw_6H2MM_C_10h2mm_model_27__hash__},
  {Py_tp_str, (void *)__pyx_pw_6H2MM_C_10h2mm_model_13__str__},
  {Py_tp_doc, (void *)PyDoc_STR("\n    The base class for storing objects representing the H2MM model, stores\n    the relevant matrices, loglikelihood and information about status of\n    optimization.\n    \n    Parameters\n    ----------\n    prior : numpy.ndarray\n        The initial probability matrix, 1D, size nstate\n    trans : numpy.ndarray\n        The transition probability matrix, 2D, shape [nstate, nstate]\n    obs : numpy.ndarray\n        The emission probability matrix, 2D, shape [nstate, ndet]\n        \n    Optional Parameters\n    -------------------\n    \n    .. note::\n        \n        These are generally only specified when trying to re-create a model from, for\n        instance a previous optimization of a closed notebook.\n    \n    loglik : float (optional)\n        The loglikelihood, always set with nphot otherwise BIC will not be calculated\n        correctly. Usually should be set by evaluation against data. Default is -inf\n    niter : int\n        The number of iterations, used for recreating previously optimized model.\n        Usually should be set by evaluation against data. Default is 0\n    nphot : int (optional)\n        The number of photons in data set used for optimization, should only be set\n        when recreating model, Usually should be set by evaluation against data.\n        Default is 0\n    is_conv : bool (optional)\n        Whether or not the model has met a convergence criterion, should only be \n        set when recreating model, otherwise allow evaluation functions to handle\n        this operation. Default is False\n    ")},
  {Py_tp_richcompare, (void *)__pyx_tp_richcompare_6H2MM_C_h2mm_model},
  {Py_tp_methods, (void *)__pyx_methods_6H2MM_C_h2mm_model},
  {Py_tp_getset, (void *)__pyx_getsets_6H2MM_C_h2mm_model},
  {Py_tp_init, (void *)__pyx_pw_6H2MM_C_10h2mm_model_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C_h2mm_model},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C_h2mm_model_spec = {
  "H2MM_C.h2mm_model",
  sizeof(struct __pyx_obj_6H2MM_C_h2mm_model),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6H2MM_C_h2mm_model_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C_h2mm_model = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""h2mm_model", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C_h2mm_model), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C_h2mm_model, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __pyx_pw_6H2MM_C_10h2mm_model_11__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_6H2MM_C_10h2mm_model_27__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_6H2MM_C_10h2mm_model_13__str__, /*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, /*tp_flags*/
  PyDoc_STR("\n    The base class for storing objects representing the H2MM model, stores\n    the relevant matrices, loglikelihood and information about status of\n    optimization.\n    \n    Parameters\n    ----------\n    prior : numpy.ndarray\n        The initial probability matrix, 1D, size nstate\n    trans : numpy.ndarray\n        The transition probability matrix, 2D, shape [nstate, nstate]\n    obs : numpy.ndarray\n        The emission probability matrix, 2D, shape [nstate, ndet]\n        \n    Optional Parameters\n    -------------------\n    \n    .. note::\n        \n        These are generally only specified when trying to re-create a model from, for\n        instance a previous optimization of a closed notebook.\n    \n    loglik : float (optional)\n        The loglikelihood, always set with nphot otherwise BIC will not be calculated\n        correctly. Usually should be set by evaluation against data. Default is -inf\n    niter : int\n        The number of iterations, used for recreating previously optimized model.\n        Usually should be set by evaluation against data. Default is 0\n    nphot : int (optional)\n        The number of photons in data set used for optimization, should only be set\n        when recreating model, Usually should be set by evaluation against data.\n        Default is 0\n    is_conv : bool (optional)\n        Whether or not the model has met a convergence criterion, should only be \n        set when recreating model, otherwise allow evaluation functions to handle\n        this operation. Default is False\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_tp_richcompare_6H2MM_C_h2mm_model, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6H2MM_C_h2mm_model, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6H2MM_C_h2mm_model, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __pyx_pw_6H2MM_C_10h2mm_model_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C_h2mm_model, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C__h2mm_lims(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 0);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_6H2MM_C_10_h2mm_lims_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6H2MM_C__h2mm_lims(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C__h2mm_lims) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_6H2MM_C_10_h2mm_lims_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyMethodDef __pyx_methods_6H2MM_C__h2mm_lims[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10_h2mm_lims_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6H2MM_C_10_h2mm_lims_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C__h2mm_lims_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C__h2mm_lims},
  {Py_tp_methods, (void *)__pyx_methods_6H2MM_C__h2mm_lims},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C__h2mm_lims},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C__h2mm_lims_spec = {
  "H2MM_C._h2mm_lims",
  sizeof(struct __pyx_obj_6H2MM_C__h2mm_lims),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_6H2MM_C__h2mm_lims_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C__h2mm_lims = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""_h2mm_lims", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C__h2mm_lims), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C__h2mm_lims, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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, /*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_6H2MM_C__h2mm_lims, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C__h2mm_lims, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_defaults(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 1);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_defaults(PyObject *o) {
  struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_defaults) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->arg0);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_6H2MM_C___pyx_defaults(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->arg0) {
    e = (*v)(p->arg0, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6H2MM_C___pyx_defaults(PyObject *o) {
  PyObject* tmp;
  struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  tmp = ((PyObject*)p->arg0);
  p->arg0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_defaults_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_defaults},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_defaults},
  {Py_tp_clear, (void *)__pyx_tp_clear_6H2MM_C___pyx_defaults},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_defaults},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_defaults_spec = {
  "H2MM_C.__pyx_defaults",
  sizeof(struct __pyx_defaults),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_defaults_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_defaults = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_defaults", /*tp_name*/
  sizeof(struct __pyx_defaults), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_defaults, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_defaults, /*tp_traverse*/
  __pyx_tp_clear_6H2MM_C___pyx_defaults, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_defaults, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct____init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct____init__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct____init__[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct____init__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct____init__(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct____init__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_ncols);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct____init__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct____init__[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct____init__++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct____init__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_ncols) {
    e = (*v)(p->__pyx_v_ncols, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6H2MM_C___pyx_scope_struct____init__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__ *)o;
  tmp = ((PyObject*)p->__pyx_v_ncols);
  p->__pyx_v_ncols = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct____init___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct____init__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct____init__},
  {Py_tp_clear, (void *)__pyx_tp_clear_6H2MM_C___pyx_scope_struct____init__},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct____init__},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct____init___spec = {
  "H2MM_C.__pyx_scope_struct____init__",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct____init___slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct____init__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct____init__", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct____init__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct____init__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct____init__, /*tp_traverse*/
  __pyx_tp_clear_6H2MM_C___pyx_scope_struct____init__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct____init__, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_1_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_1_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_x);
  Py_CLEAR(p->__pyx_v_y);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  if (p->__pyx_v_y) {
    e = (*v)(p->__pyx_v_y, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_1_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_1_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_1_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_1_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_1_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_2_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_2_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_2_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_x);
  Py_CLEAR(p->__pyx_v_y);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_2_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  if (p->__pyx_v_y) {
    e = (*v)(p->__pyx_v_y, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_2_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_2_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_2_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_2_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_2_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_3_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_3_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_xx);
  Py_CLEAR(p->__pyx_v_yy);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_xx) {
    e = (*v)(p->__pyx_v_xx, a); if (e) return e;
  }
  if (p->__pyx_v_yy) {
    e = (*v)(p->__pyx_v_yy, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_3_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_3_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_3_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_3_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_3_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_4___hash__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_4___hash__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_4___hash__[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_4___hash__];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_4___hash__(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_4___hash__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_4___hash__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_4___hash__[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_4___hash__++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_4___hash__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, 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_6H2MM_C___pyx_scope_struct_4___hash__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6H2MM_C_h2mm_model *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_4___hash___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_4___hash__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_4___hash__},
  {Py_tp_clear, (void *)__pyx_tp_clear_6H2MM_C___pyx_scope_struct_4___hash__},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_4___hash__},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_4___hash___spec = {
  "H2MM_C.__pyx_scope_struct_4___hash__",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_4___hash___slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_4___hash__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_4___hash__", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_4___hash__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_4___hash__, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_4___hash__, /*tp_traverse*/
  __pyx_tp_clear_6H2MM_C___pyx_scope_struct_4___hash__, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_4___hash__, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_5_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_5_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_5_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_5_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_5_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_5_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_5_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_5_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_5_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_5_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_5_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_5_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_6_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_6_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_6_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_6_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_6_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_6_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_6_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_6_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_6_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_6_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_6_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_6_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_6_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_7_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_7_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_7_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_7_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_7_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_7_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_7_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_7_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_7_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_7_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_7_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_8_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_8_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_8_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_8_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_8_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_model);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_8_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_8_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_model) {
    e = (*v)(p->__pyx_v_model, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_8_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_8_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_8_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_8_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_8_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_8_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_8_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_8_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_8_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_9_path_loglik(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_9_path_loglik > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_9_path_loglik[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_9_path_loglik];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_9_path_loglik(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_9_path_loglik) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_9_path_loglik < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_9_path_loglik[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_9_path_loglik++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_9_path_loglik},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_9_path_loglik},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik_spec = {
  "H2MM_C.__pyx_scope_struct_9_path_loglik",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER,
  __pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_9_path_loglik", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_9_path_loglik), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_9_path_loglik, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_9_path_loglik, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_6H2MM_C___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_10_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr))))
  {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_10_genexpr[--__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_10_genexpr];
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(Py_TYPE(o));
    #endif
    memset(o, 0, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr));
    #if CYTHON_COMPILING_IN_LIMITED_API
    (void) PyObject_Init(o, t);
    #else
    (void) PyObject_INIT(o, t);
    #endif
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = __Pyx_AllocateExtensionType(t, 1);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_10_genexpr(PyObject *o) {
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_10_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_10_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr, sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr))))
  {
    __pyx_mstate_global->__pyx_freelist_6H2MM_C___pyx_scope_struct_10_genexpr[__pyx_mstate_global->__pyx_freecount_6H2MM_C___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)o);
  } else
  #endif
  {
    PyTypeObject *tp = Py_TYPE(o);
    #if CYTHON_USE_TYPE_SLOTS
    (*tp->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
    #if CYTHON_USE_TYPE_SPECS
    Py_DECREF(tp);
    #endif
  }
}

static int __pyx_tp_traverse_6H2MM_C___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_10_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_6H2MM_C___pyx_scope_struct_10_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_6H2MM_C___pyx_scope_struct_10_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr_spec = {
  "H2MM_C.__pyx_scope_struct_10_genexpr",
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  __pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""__pyx_scope_struct_10_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6H2MM_C___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6H2MM_C___pyx_scope_struct_10_genexpr, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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_6H2MM_C___pyx_scope_struct_10_genexpr, /*tp_traverse*/
  0, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6H2MM_C___pyx_scope_struct_10_genexpr, /*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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  o = __Pyx_AllocateExtensionType(t, 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(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_array___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  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 {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = 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)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_array = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_array_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array},
  {Py_sq_length, (void *)__pyx_array___len__},
  {Py_sq_item, (void *)__pyx_sq_item_array},
  {Py_mp_length, (void *)__pyx_array___len__},
  {Py_mp_subscript, (void *)__pyx_array___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array},
  {Py_tp_getattro, (void *)__pyx_tp_getattro_array},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_array_getbuffer},
  #endif
  {Py_tp_methods, (void *)__pyx_methods_array},
  {Py_tp_getset, (void *)__pyx_getsets_array},
  {Py_tp_new, (void *)__pyx_tp_new_array},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_array_spec = {
  "H2MM_C.array",
  sizeof(struct __pyx_array_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_array_slots,
};
#else

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 = {
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  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|Py_TPFLAGS_SEQUENCE, /*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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  o = __Pyx_AllocateExtensionType(t, 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(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  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)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum},
  {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum},
  {Py_tp_clear, (void *)__pyx_tp_clear_Enum},
  {Py_tp_methods, (void *)__pyx_methods_Enum},
  {Py_tp_init, (void *)__pyx_MemviewEnum___init__},
  {Py_tp_new, (void *)__pyx_tp_new_Enum},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = {
  "H2MM_C.Enum",
  sizeof(struct __pyx_MemviewEnum_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_MemviewEnum_slots,
};
#else

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  __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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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;
  o = __Pyx_AllocateExtensionType(t, 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->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(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryview___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  PyTypeObject *tp = Py_TYPE(o);
  #if CYTHON_USE_TYPE_SLOTS
  (*tp->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  Py_DECREF(tp);
  #endif
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  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->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);
  Py_CLEAR(p->view.obj);
  return 0;
}

static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0;
  #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  #else
  r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x);
  #endif
  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 {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_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)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
  {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
  {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
  {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
  {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
  {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
  {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
  {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
  {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
#if !CYTHON_COMPILING_IN_LIMITED_API

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};
#endif
static PyType_Slot __pyx_type___pyx_memoryview_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview},
  {Py_tp_repr, (void *)__pyx_memoryview___repr__},
  {Py_sq_length, (void *)__pyx_memoryview___len__},
  {Py_sq_item, (void *)__pyx_sq_item_memoryview},
  {Py_mp_length, (void *)__pyx_memoryview___len__},
  {Py_mp_subscript, (void *)__pyx_memoryview___getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview},
  {Py_tp_str, (void *)__pyx_memoryview___str__},
  #if defined(Py_bf_getbuffer)
  {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer},
  #endif
  {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview},
  {Py_tp_clear, (void *)__pyx_tp_clear_memoryview},
  {Py_tp_methods, (void *)__pyx_methods_memoryview},
  {Py_tp_getset, (void *)__pyx_getsets_memoryview},
  {Py_tp_new, (void *)__pyx_tp_new_memoryview},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryview_spec = {
  "H2MM_C.memoryview",
  sizeof(struct __pyx_memoryview_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
  __pyx_type___pyx_memoryview_slots,
};
#else

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 = {
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  __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*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#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(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryviewslice___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    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_XCLEAR_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice},
  {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice},
  {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice},
  {Py_tp_methods, (void *)__pyx_methods__memoryviewslice},
  {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice},
  {0, 0},
};
static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = {
  "H2MM_C._memoryviewslice",
  sizeof(struct __pyx_memoryviewslice_obj),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE,
  __pyx_type___pyx_memoryviewslice_slots,
};
#else

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "H2MM_C.""_memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_vectorcall_offset*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __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 || 0
  __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|Py_TPFLAGS_SEQUENCE, /*tp_flags*/
  PyDoc_STR("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*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  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 CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if PY_VERSION_HEX >= 0x030d00A4
  0, /*tp_versions_used*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  0, /*tp_pypy_flags*/
  #endif
};
#endif

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};
/* #### Code section: initfunc_declarations ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
/* #### Code section: init_module ### */

static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None);
  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(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C_opt_lim_const_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const)) __PYX_ERR(0, 418, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C_opt_lim_const_spec, __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const) < (0)) __PYX_ERR(0, 418, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const = &__pyx_type_6H2MM_C_opt_lim_const;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const) < (0)) __PYX_ERR(0, 418, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_opt_lim_const, (PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const) < (0)) __PYX_ERR(0, 418, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_opt_lim_const) < (0)) __PYX_ERR(0, 418, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C_ConvCodes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes)) __PYX_ERR(0, 687, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C_ConvCodes_spec, __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes) < (0)) __PYX_ERR(0, 687, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes = &__pyx_type_6H2MM_C_ConvCodes;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes) < (0)) __PYX_ERR(0, 687, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_ConvCodes, (PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes) < (0)) __PYX_ERR(0, 687, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_ConvCodes) < (0)) __PYX_ERR(0, 687, __pyx_L1_error)
  __pyx_vtabptr_6H2MM_C_h2mm_model = &__pyx_vtable_6H2MM_C_h2mm_model;
  __pyx_vtable_6H2MM_C_h2mm_model.from_ptr = (struct __pyx_obj_6H2MM_C_h2mm_model *(*)(h2mm_mod *))__pyx_f_6H2MM_C_10h2mm_model_from_ptr;
  __pyx_vtable_6H2MM_C_h2mm_model.move_ptr = (struct __pyx_obj_6H2MM_C_h2mm_model *(*)(h2mm_mod *))__pyx_f_6H2MM_C_10h2mm_model_move_ptr;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C_h2mm_model_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model)) __PYX_ERR(0, 852, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C_h2mm_model_spec, __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model = &__pyx_type_6H2MM_C_h2mm_model;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_vtabptr_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_h2mm_model, (PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C_h2mm_model) < (0)) __PYX_ERR(0, 852, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C__h2mm_lims_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims)) __PYX_ERR(0, 1679, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C__h2mm_lims_spec, __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims = &__pyx_type_6H2MM_C__h2mm_lims;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_h2mm_lims, (PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_6H2MM_C__h2mm_lims) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_defaults_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults)) __PYX_ERR(0, 2597, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_defaults_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults) < (0)) __PYX_ERR(0, 2597, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults = &__pyx_type_6H2MM_C___pyx_defaults;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults) < (0)) __PYX_ERR(0, 2597, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_defaults->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct____init___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__)) __PYX_ERR(0, 280, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct____init___spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__) < (0)) __PYX_ERR(0, 280, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__ = &__pyx_type_6H2MM_C___pyx_scope_struct____init__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__) < (0)) __PYX_ERR(0, 280, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct____init__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 285, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 285, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_1_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 285, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 287, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 287, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_2_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 287, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 287, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 287, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_3_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 287, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_4___hash___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__)) __PYX_ERR(0, 1287, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_4___hash___spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__) < (0)) __PYX_ERR(0, 1287, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__ = &__pyx_type_6H2MM_C___pyx_scope_struct_4___hash__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__) < (0)) __PYX_ERR(0, 1287, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_4___hash__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr)) __PYX_ERR(0, 1290, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 1290, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_5_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr) < (0)) __PYX_ERR(0, 1290, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_5_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 1291, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 1291, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_6_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 1291, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_6_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr)) __PYX_ERR(0, 1292, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 1292, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_7_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 1292, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_7_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr)) __PYX_ERR(0, 3093, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 3093, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_8_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr) < (0)) __PYX_ERR(0, 3093, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_8_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik)) __PYX_ERR(0, 3635, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik) < (0)) __PYX_ERR(0, 3635, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik = &__pyx_type_6H2MM_C___pyx_scope_struct_9_path_loglik;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik) < (0)) __PYX_ERR(0, 3635, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_9_path_loglik->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr)) __PYX_ERR(0, 3702, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr_spec, __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr) < (0)) __PYX_ERR(0, 3702, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr = &__pyx_type_6H2MM_C___pyx_scope_struct_10_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr) < (0)) __PYX_ERR(0, 3702, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_6H2MM_C___pyx_scope_struct_10_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array;
  if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type);
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error)
  __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;
  __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error)
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview;
  if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) {
    __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer;
  }
  #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer)
  /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */
  #elif defined(_MSC_VER)
  #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.")
  #else
  #warning "The buffer protocol is not supported in the Limited C-API < 3.11."
  #endif
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error)
  __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_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error)
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type);
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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(5, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_3(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_2_3(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyLongObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyLongObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_2_3(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyComplexObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyComplexObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_5array_array = __Pyx_ImportType_3_2_3(__pyx_t_1, "array", "array",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(arrayobject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(arrayobject),
  #else
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(arrayobject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_7cpython_5array_array) __PYX_ERR(3, 69, __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(4, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "dtype",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArray_Descr),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArray_Descr),
  #else
  sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArray_Descr),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(4, 228, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "flatiter",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayIterObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayIterObject),
  #else
  sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayIterObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(4, 273, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "broadcast",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayMultiIterObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayMultiIterObject),
  #else
  sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayMultiIterObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(4, 277, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "ndarray",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayObject),
  #else
  sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyArrayObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(4, 316, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "generic",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(4, 825, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "number",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(4, 827, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "integer",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(4, 829, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "signedinteger",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(4, 831, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "unsignedinteger",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(4, 833, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "inexact",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(4, 835, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "floating",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(4, 837, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "complexfloating",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(4, 839, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "flexible",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(4, 841, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "character",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #else
  sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(4, 843, __pyx_L1_error)
  __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_3(__pyx_t_1, "numpy", "ufunc",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyUFuncObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyUFuncObject),
  #else
  sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_3(PyUFuncObject),
  #endif
  __Pyx_ImportType_CheckSize_Ignore_3_2_3); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(4, 907, __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(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_H2MM_C(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_H2MM_C},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  #endif
  #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  #endif
  {0, NULL}
};
#endif

#ifdef __cplusplus
namespace {
  struct PyModuleDef __pyx_moduledef =
  #else
  static struct PyModuleDef __pyx_moduledef =
  #endif
  {
      PyModuleDef_HEAD_INIT,
      "H2MM_C",
      __pyx_k_Module_for_analyzing_data_with, /* m_doc */
    #if CYTHON_USE_MODULE_STATE
      sizeof(__pyx_mstatetype), /* m_size */
    #else
      (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
    #endif
      __pyx_methods /* m_methods */,
    #if CYTHON_PEP489_MULTI_PHASE_INIT
      __pyx_moduledef_slots, /* m_slots */
    #else
      NULL, /* m_reload */
    #endif
    #if CYTHON_USE_MODULE_STATE
      __pyx_m_traverse, /* m_traverse */
      __pyx_m_clear, /* m_clear */
      NULL /* m_free */
    #else
      NULL, /* m_traverse */
      NULL, /* m_clear */
      NULL /* m_free */
    #endif
  };
  #ifdef __cplusplus
} /* anonymous namespace */
#endif

/* PyModInitFuncType */
#ifndef CYTHON_NO_PYINIT_EXPORT
  #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#else
  #ifdef __cplusplus
  #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  #else
  #define __Pyx_PyMODINIT_FUNC PyObject *
  #endif
#endif

__Pyx_PyMODINIT_FUNC PyInit_H2MM_C(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_H2MM_C(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
    {
        PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
        if (!module) {
            PyErr_Clear(); // just try the 3.8-3.12 version
            module = PyImport_ImportModule("_xxsubinterpreters");
            if (!module) goto bad;
        }
        PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
        Py_DECREF(module);
        if (!current) goto bad;
        if (PyTuple_Check(current)) {
            PyObject *new_current = PySequence_GetItem(current, 0);
            Py_DECREF(current);
            current = new_current;
            if (!new_current) goto bad;
        }
        long long as_c_int = PyLong_AsLongLong(current);
        Py_DECREF(current);
        return as_c_int;
    }
  bad:
    PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
    return -1;
}
#endif
#if !CYTHON_USE_MODULE_STATE
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    static PY_INT64_T main_interpreter_id = -1;
#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
    PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_GRAAL
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
      || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#else
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
#endif
    if (unlikely(current_id == -1)) {
        return -1;
    }
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return 0;
    } else if (unlikely(main_interpreter_id != current_id)) {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
#endif
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, PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    CYTHON_UNUSED_VAR(def);
    #if !CYTHON_USE_MODULE_STATE
    if (__Pyx_check_single_interpreter())
        return NULL;
    #endif
    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_H2MM_C(PyObject *__pyx_pyinit_module)
#endif
{
  int stringtab_initialized = 0;
  #if CYTHON_USE_MODULE_STATE
  int pystate_addmodule_run = 0;
  #endif
  __pyx_mstatetype *__pyx_mstate = NULL;
  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;
  size_t __pyx_t_6;
  static PyThread_type_lock __pyx_t_7[8];
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'H2MM_C' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #else
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_t_1 = __pyx_pyinit_module;
  Py_INCREF(__pyx_t_1);
  #else
  __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #if CYTHON_USE_MODULE_STATE
  {
    int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
    __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "H2MM_C" pseudovariable */
    if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    pystate_addmodule_run = 1;
  }
  #else
  __pyx_m = __pyx_t_1;
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  #endif
  __pyx_mstate = __pyx_mstate_global;
  CYTHON_UNUSED_VAR(__pyx_t_1);
  __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_mstate->__pyx_d);
  __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /* ImportRefnannyAPI */
  #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("PyInit_H2MM_C", 0);
  __Pyx_init_runtime_version();
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Library function declarations ---*/
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  stringtab_initialized = 1;
  if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__pyx_module_is_main_H2MM_C) {
    if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "H2MM_C")) {
      if (unlikely((PyDict_SetItemString(modules, "H2MM_C", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  /*--- Execution code ---*/

  /* "View.MemoryView":100
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
  {
    __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:*/ {

      /* "View.MemoryView":101
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence             # <<<<<<<<<<<<<<
 * except:
 * 
*/
      __pyx_t_5 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_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_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;

      /* "View.MemoryView":100
 * 
 * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence"
 * try:             # <<<<<<<<<<<<<<
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:
*/
    }
    __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_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":102
 * try:
 *     __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence
 * except:             # <<<<<<<<<<<<<<
 * 
 *     __pyx_collections_abc_Sequence = None
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);

      /* "View.MemoryView":104
 * except:
 * 
 *     __pyx_collections_abc_Sequence = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_collections_abc_Sequence);
      __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None);
      __Pyx_GIVEREF(Py_None);
      goto __pyx_L3_exception_handled;
    }
    __pyx_L3_exception_handled:;
    __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);
    __pyx_L7_try_end:;
  }

  /* "View.MemoryView":239
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":240
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":241
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":239
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L15_try_end;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":242
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L11_exception_handled;
    }
    __pyx_L11_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L15_try_end:;
  }

  /* "View.MemoryView":307
 *         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_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 307, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":308
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 308, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":309
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 309, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":312
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 312, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":313
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_5 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 313, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_4);
  }
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "View.MemoryView":321
 * 
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
*/
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":322
 * 
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
*/
  __pyx_t_7[0] = PyThread_allocate_lock();
  __pyx_t_7[1] = PyThread_allocate_lock();
  __pyx_t_7[2] = PyThread_allocate_lock();
  __pyx_t_7[3] = PyThread_allocate_lock();
  __pyx_t_7[4] = PyThread_allocate_lock();
  __pyx_t_7[5] = PyThread_allocate_lock();
  __pyx_t_7[6] = PyThread_allocate_lock();
  __pyx_t_7[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":983
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
  {
    __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:*/ {

      /* "View.MemoryView":984
 * 
 *     try:
 *         count = __pyx_collections_abc_Sequence.count             # <<<<<<<<<<<<<<
 *         index = __pyx_collections_abc_Sequence.index
 *     except:
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":985
 *     try:
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index             # <<<<<<<<<<<<<<
 *     except:
 *         pass
*/
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "View.MemoryView":983
 * 
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
*/
    }
    __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_L23_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":986
 *         count = __pyx_collections_abc_Sequence.count
 *         index = __pyx_collections_abc_Sequence.index
 *     except:             # <<<<<<<<<<<<<<
 *         pass
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L19_exception_handled;
    }
    __pyx_L19_exception_handled:;
    __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);
    __pyx_L23_try_end:;
  }

  /* "View.MemoryView":989
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "View.MemoryView":990
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error)
      if (__pyx_t_8) {

        /* "View.MemoryView":994
 * 
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)             # <<<<<<<<<<<<<<
 *         __pyx_collections_abc_Sequence.register(array)
 * except:
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":995
 * 
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)             # <<<<<<<<<<<<<<
 * except:
 *     pass  # ignore failure, it's a minor issue
*/
        __pyx_t_5 = __pyx_collections_abc_Sequence;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 995, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "View.MemoryView":990
 * 
 * try:
 *     if __pyx_collections_abc_Sequence:             # <<<<<<<<<<<<<<
 * 
 * 
*/
      }

      /* "View.MemoryView":989
 *         pass
 * 
 * try:             # <<<<<<<<<<<<<<
 *     if __pyx_collections_abc_Sequence:
 * 
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L31_try_end;
    __pyx_L26_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "View.MemoryView":996
 *         __pyx_collections_abc_Sequence.register(_memoryviewslice)
 *         __pyx_collections_abc_Sequence.register(array)
 * except:             # <<<<<<<<<<<<<<
 *     pass  # ignore failure, it's a minor issue
 * 
*/
    /*except:*/ {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L27_exception_handled;
    }
    __pyx_L27_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L31_try_end:;
  }

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name')
*/
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":17
 * cimport numpy as cnp
 * 
 * import os             # <<<<<<<<<<<<<<
 * import numpy as np
 * import array
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_os, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_os, __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":18
 * 
 * import os
 * import numpy as np             # <<<<<<<<<<<<<<
 * import array
 * 
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_4) < (0)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":19
 * import os
 * import numpy as np
 * import array             # <<<<<<<<<<<<<<
 * 
 * import warnings
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_array, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_array, __pyx_t_4) < (0)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":21
 * import array
 * 
 * import warnings             # <<<<<<<<<<<<<<
 * from collections.abc import Sequence
 * import sys
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_4) < (0)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":22
 * 
 * import warnings
 * from collections.abc import Sequence             # <<<<<<<<<<<<<<
 * import sys
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":23
 * import warnings
 * from collections.abc import Sequence
 * import sys             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":26
 * 
 * 
 * cnp.import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h" nogil:
*/
  __pyx_t_10 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 26, __pyx_L1_error)

  /* "H2MM_C.pyx":120
 * 
 * #: Version string
 * from sys import version_info as python_version             # <<<<<<<<<<<<<<
 * if python_version.major > 3 or python_version.minor > 7:
 *     from importlib.metadata import version, PackageNotFoundError
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version_info};
    __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_1;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version_info};
    __pyx_t_9 = 0; {
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      switch (__pyx_t_9) {
        case 0:
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_python_version, __pyx_t_5) < (0)) __PYX_ERR(0, 120, __pyx_L1_error)
        break;
        default:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":121
 * #: Version string
 * from sys import version_info as python_version
 * if python_version.major > 3 or python_version.minor > 7:             # <<<<<<<<<<<<<<
 *     from importlib.metadata import version, PackageNotFoundError
 * else:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_python_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_major); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_11) {
  } else {
    __pyx_t_8 = __pyx_t_11;
    goto __pyx_L36_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_python_version); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_minor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_mstate_global->__pyx_int_7, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __pyx_t_11;
  __pyx_L36_bool_binop_done:;
  if (__pyx_t_8) {

    /* "H2MM_C.pyx":122
 * from sys import version_info as python_version
 * if python_version.major > 3 or python_version.minor > 7:
 *     from importlib.metadata import version, PackageNotFoundError             # <<<<<<<<<<<<<<
 * else:
 *     from importlib_metadata import version, PackageNotFoundError
*/
    {
      PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version,__pyx_mstate_global->__pyx_n_u_PackageNotFoundError};
      __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_importlib_metadata, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_t_1;
    __Pyx_GOTREF(__pyx_t_4);
    {
      PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version,__pyx_mstate_global->__pyx_n_u_PackageNotFoundError};
      for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
        __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "H2MM_C.pyx":121
 * #: Version string
 * from sys import version_info as python_version
 * if python_version.major > 3 or python_version.minor > 7:             # <<<<<<<<<<<<<<
 *     from importlib.metadata import version, PackageNotFoundError
 * else:
*/
    goto __pyx_L35;
  }

  /* "H2MM_C.pyx":124
 *     from importlib.metadata import version, PackageNotFoundError
 * else:
 *     from importlib_metadata import version, PackageNotFoundError             # <<<<<<<<<<<<<<
 * try:
 *     __version__ = version("H2MM_C")
*/
  /*else*/ {
    {
      PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version,__pyx_mstate_global->__pyx_n_u_PackageNotFoundError};
      __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_importlib_metadata_2, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_t_1;
    __Pyx_GOTREF(__pyx_t_4);
    {
      PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_version,__pyx_mstate_global->__pyx_n_u_PackageNotFoundError};
      for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
        __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L35:;

  /* "H2MM_C.pyx":125
 * else:
 *     from importlib_metadata import version, PackageNotFoundError
 * try:             # <<<<<<<<<<<<<<
 *     __version__ = version("H2MM_C")
 * except PackageNotFoundError:
*/
  {
    __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:*/ {

      /* "H2MM_C.pyx":126
 *     from importlib_metadata import version, PackageNotFoundError
 * try:
 *     __version__ = version("H2MM_C")             # <<<<<<<<<<<<<<
 * except PackageNotFoundError:
 *     print("cannot find package version")
*/
      __pyx_t_5 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_version); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 126, __pyx_L38_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_H2MM_C};
        __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L38_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_version_2, __pyx_t_4) < (0)) __PYX_ERR(0, 126, __pyx_L38_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":125
 * else:
 *     from importlib_metadata import version, PackageNotFoundError
 * try:             # <<<<<<<<<<<<<<
 *     __version__ = version("H2MM_C")
 * except PackageNotFoundError:
*/
    }
    __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_L43_try_end;
    __pyx_L38_error:;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H2MM_C.pyx":127
 * try:
 *     __version__ = version("H2MM_C")
 * except PackageNotFoundError:             # <<<<<<<<<<<<<<
 *     print("cannot find package version")
 * del version, PackageNotFoundError, python_version
*/
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_12, &__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_PackageNotFoundError); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 127, __pyx_L40_except_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_13);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_12, __pyx_t_5);
    __pyx_t_4 = 0; __pyx_t_12 = 0; __pyx_t_5 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_12, &__pyx_t_4) < 0) __PYX_ERR(0, 127, __pyx_L40_except_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_4);

      /* "H2MM_C.pyx":128
 *     __version__ = version("H2MM_C")
 * except PackageNotFoundError:
 *     print("cannot find package version")             # <<<<<<<<<<<<<<
 * del version, PackageNotFoundError, python_version
 * 
*/
      __pyx_t_14 = NULL;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_cannot_find_package_version};
        __pyx_t_13 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 128, __pyx_L40_except_error)
        __Pyx_GOTREF(__pyx_t_13);
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L39_exception_handled;
    }
    goto __pyx_L40_except_error;

    /* "H2MM_C.pyx":125
 * else:
 *     from importlib_metadata import version, PackageNotFoundError
 * try:             # <<<<<<<<<<<<<<
 *     __version__ = version("H2MM_C")
 * except PackageNotFoundError:
*/
    __pyx_L40_except_error:;
    __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_L39_exception_handled:;
    __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);
    __pyx_L43_try_end:;
  }

  /* "H2MM_C.pyx":129
 * except PackageNotFoundError:
 *     print("cannot find package version")
 * del version, PackageNotFoundError, python_version             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_version) < (0)) __PYX_ERR(0, 129, __pyx_L1_error)
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PackageNotFoundError) < (0)) __PYX_ERR(0, 129, __pyx_L1_error)
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_mstate_global->__pyx_n_u_python_version) < (0)) __PYX_ERR(0, 129, __pyx_L1_error)

  /* "H2MM_C.pyx":135
 * ########## Defining printer classes of Optimization Progress Output  ##########
 * ###############################################################################
 * from abc import ABC, abstractmethod             # <<<<<<<<<<<<<<
 * 
 * 
*/
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ABC,__pyx_mstate_global->__pyx_n_u_abstractmethod};
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_abc, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_t_3;
  __Pyx_GOTREF(__pyx_t_4);
  {
    PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ABC,__pyx_mstate_global->__pyx_n_u_abstractmethod};
    for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
      __pyx_t_12 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_12) < (0)) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":138
 * 
 * 
 * class Printer(ABC):             # <<<<<<<<<<<<<<
 *     """
 *     Abstract base class for formatting progress display of optimizations.
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ABC); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_4, __pyx_mstate_global->__pyx_n_u_Printer, __pyx_mstate_global->__pyx_n_u_Printer, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_kp_u_Abstract_base_class_for_formatt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_4 != __pyx_t_12) {
    if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_12) < 0))) __PYX_ERR(0, 138, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":142
 *     Abstract base class for formatting progress display of optimizations.
 *     """
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def update(self, text):
 *         """
*/
  __pyx_t_14 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_abstractmethod); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7Printer_1update, 0, __pyx_mstate_global->__pyx_n_u_Printer_update, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_16);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_16};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  }
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_12) < (0)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":150
 *         raise NotImplementedError("Must implement update")
 * 
 *     @abstractmethod             # <<<<<<<<<<<<<<
 *     def close(self):
 *         """
*/
  __pyx_t_15 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_abstractmethod); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7Printer_3close, 0, __pyx_mstate_global->__pyx_n_u_Printer_close, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_14};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_16, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  }
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_12) < (0)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":158
 *         raise NotImplementedError("Must implement close")
 * 
 *     def __call__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.update(*args, **kwargs)
 * 
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7Printer_5__call__, 0, __pyx_mstate_global->__pyx_n_u_Printer___call, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_call, __pyx_t_12) < (0)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":161
 *         return self.update(*args, **kwargs)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7Printer_7__enter__, 0, __pyx_mstate_global->__pyx_n_u_Printer___enter, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_12) < (0)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":164
 *         return self
 * 
 *     def __exit__(self, exc_type, exc_val, exc_tb):             # <<<<<<<<<<<<<<
 *         if exc_type is None:
 *             self.close()
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7Printer_9__exit__, 0, __pyx_mstate_global->__pyx_n_u_Printer___exit, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_12) < (0)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":138
 * 
 * 
 * class Printer(ABC):             # <<<<<<<<<<<<<<
 *     """
 *     Abstract base class for formatting progress display of optimizations.
*/
  __pyx_t_12 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Printer, __pyx_t_4, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Printer, __pyx_t_12) < (0)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":169
 * 
 * 
 * class StdPrinter(Printer):             # <<<<<<<<<<<<<<
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Printer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_4, __pyx_mstate_global->__pyx_n_u_StdPrinter, __pyx_mstate_global->__pyx_n_u_StdPrinter, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, (PyObject *) NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (__pyx_t_4 != __pyx_t_5) {
    if (unlikely((PyDict_SetItemString(__pyx_t_12, "__orig_bases__", __pyx_t_5) < 0))) __PYX_ERR(0, 169, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":170
 * 
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')             # <<<<<<<<<<<<<<
 *     def __init__(self, buffer, keep=False, single_line=True):
 *         self.buffer = buffer
*/
  if (__Pyx_SetNameInClass(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[15]) < (0)) __PYX_ERR(0, 170, __pyx_L1_error)

  /* "H2MM_C.pyx":171
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):             # <<<<<<<<<<<<<<
 *         self.buffer = buffer
 *         self.width = 0
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10StdPrinter_1__init__, 0, __pyx_mstate_global->__pyx_n_u_StdPrinter___init, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[16]);
  if (__Pyx_SetNameInClass(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_5) < (0)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":177
 *         self.single_line = bool(single_line)
 * 
 *     def update(self, text):             # <<<<<<<<<<<<<<
 *         text = str(text)
 *         if self.single_line:
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10StdPrinter_3update, 0, __pyx_mstate_global->__pyx_n_u_StdPrinter_update, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_5) < (0)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":191
 *         self.buffer.flush()
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         self.buffer.write("\n")
 * 
*/
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10StdPrinter_5close, 0, __pyx_mstate_global->__pyx_n_u_StdPrinter_close, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_5) < (0)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H2MM_C.pyx":169
 * 
 * 
 * class StdPrinter(Printer):             # <<<<<<<<<<<<<<
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):
*/
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_StdPrinter, __pyx_t_4, __pyx_t_12, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_StdPrinter, __pyx_t_5) < (0)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __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;

  /* "H2MM_C.pyx":194
 *         self.buffer.write("\n")
 * 
 * has_ipython = False             # <<<<<<<<<<<<<<
 * has_matplotlib = False
 * try:
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_ipython, Py_False) < (0)) __PYX_ERR(0, 194, __pyx_L1_error)

  /* "H2MM_C.pyx":195
 * 
 * has_ipython = False
 * has_matplotlib = False             # <<<<<<<<<<<<<<
 * try:
 *     from itertools import product, chain
*/
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_matplotlib, Py_False) < (0)) __PYX_ERR(0, 195, __pyx_L1_error)

  /* "H2MM_C.pyx":196
 * has_ipython = False
 * has_matplotlib = False
 * try:             # <<<<<<<<<<<<<<
 *     from itertools import product, chain
 *     from IPython.display import DisplayHandle, Pretty, clear_output
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_1);
    /*try:*/ {

      /* "H2MM_C.pyx":197
 * has_matplotlib = False
 * try:
 *     from itertools import product, chain             # <<<<<<<<<<<<<<
 *     from IPython.display import DisplayHandle, Pretty, clear_output
 *     has_ipython = True
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_product,__pyx_mstate_global->__pyx_n_u_chain};
        __pyx_t_17 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_itertools, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 197, __pyx_L46_error)
      }
      __pyx_t_4 = __pyx_t_17;
      __Pyx_GOTREF(__pyx_t_4);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_product,__pyx_mstate_global->__pyx_n_u_chain};
        for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) {
          __pyx_t_13 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 197, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_13) < (0)) __PYX_ERR(0, 197, __pyx_L46_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":198
 * try:
 *     from itertools import product, chain
 *     from IPython.display import DisplayHandle, Pretty, clear_output             # <<<<<<<<<<<<<<
 *     has_ipython = True
 *     class IPyPrinter(Printer):
*/
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DisplayHandle,__pyx_mstate_global->__pyx_n_u_Pretty,__pyx_mstate_global->__pyx_n_u_clear_output};
        __pyx_t_17 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_IPython_display, __pyx_imported_names, 3, NULL, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 198, __pyx_L46_error)
      }
      __pyx_t_4 = __pyx_t_17;
      __Pyx_GOTREF(__pyx_t_4);
      {
        PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_DisplayHandle,__pyx_mstate_global->__pyx_n_u_Pretty,__pyx_mstate_global->__pyx_n_u_clear_output};
        for (__pyx_t_9=0; __pyx_t_9 < 3; __pyx_t_9++) {
          __pyx_t_13 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 198, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_13) < (0)) __PYX_ERR(0, 198, __pyx_L46_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":199
 *     from itertools import product, chain
 *     from IPython.display import DisplayHandle, Pretty, clear_output
 *     has_ipython = True             # <<<<<<<<<<<<<<
 *     class IPyPrinter(Printer):
 *         """
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_ipython, Py_True) < (0)) __PYX_ERR(0, 199, __pyx_L46_error)

      /* "H2MM_C.pyx":200
 *     from IPython.display import DisplayHandle, Pretty, clear_output
 *     has_ipython = True
 *     class IPyPrinter(Printer):             # <<<<<<<<<<<<<<
 *         """
 *         Class for prining to :code:`IPython.display.DisplayHandle` object.
*/
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Printer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_12, __pyx_t_4, __pyx_mstate_global->__pyx_n_u_IPyPrinter, __pyx_mstate_global->__pyx_n_u_IPyPrinter, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_kp_u_Class_for_prining_to_code_IPyth); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4 != __pyx_t_13) {
        if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_t_13) < 0))) __PYX_ERR(0, 200, __pyx_L46_error)
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "H2MM_C.pyx":211
 *             Whether to keep old output or replace with new. The default is False
 *         """
 *         def __init__(self, buffer, keep=False):             # <<<<<<<<<<<<<<
 *             self.buffer = buffer
 *             self.keep = bool(keep)
*/
      __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10IPyPrinter_1__init__, 0, __pyx_mstate_global->__pyx_n_u_IPyPrinter___init, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 211, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
      PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
      #endif
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_13, __pyx_mstate_global->__pyx_tuple[17]);
      if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_13) < (0)) __PYX_ERR(0, 211, __pyx_L46_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "H2MM_C.pyx":217
 *             self.buffer.display(self.text)
 * 
 *         def update(self, text):             # <<<<<<<<<<<<<<
 *             """
 *             Update display with text in text
*/
      __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10IPyPrinter_3update, 0, __pyx_mstate_global->__pyx_n_u_IPyPrinter_update, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
      PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
      #endif
      if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_13) < (0)) __PYX_ERR(0, 217, __pyx_L46_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "H2MM_C.pyx":238
 *             self.buffer.update(self.text)
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             pass
 *     try:
*/
      __pyx_t_13 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10IPyPrinter_5close, 0, __pyx_mstate_global->__pyx_n_u_IPyPrinter_close, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 238, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
      PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
      #endif
      if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_13) < (0)) __PYX_ERR(0, 238, __pyx_L46_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "H2MM_C.pyx":200
 *     from IPython.display import DisplayHandle, Pretty, clear_output
 *     has_ipython = True
 *     class IPyPrinter(Printer):             # <<<<<<<<<<<<<<
 *         """
 *         Class for prining to :code:`IPython.display.DisplayHandle` object.
*/
      __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_IPyPrinter, __pyx_t_4, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
      PyUnstable_Object_EnableDeferredRefcount(__pyx_t_13);
      #endif
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IPyPrinter, __pyx_t_13) < (0)) __PYX_ERR(0, 200, __pyx_L46_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "H2MM_C.pyx":240
 *         def close(self):
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         import matplotlib.pyplot as plt
 *         has_matplotlib = True
*/
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_17);
        __Pyx_XGOTREF(__pyx_t_18);
        __Pyx_XGOTREF(__pyx_t_19);
        /*try:*/ {

          /* "H2MM_C.pyx":241
 *             pass
 *     try:
 *         import matplotlib.pyplot as plt             # <<<<<<<<<<<<<<
 *         has_matplotlib = True
 *         import matplotlib
*/
          __pyx_t_20 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_matplotlib_pyplot, 0, 0, NULL, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 241, __pyx_L52_error)
          __pyx_t_21 = __Pyx_ImportFrom(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_pyplot);
          Py_DECREF(__pyx_t_20);
          if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 241, __pyx_L52_error)
          __pyx_t_20 = __pyx_t_21;
          __pyx_t_4 = __pyx_t_20;
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plt, __pyx_t_4) < (0)) __PYX_ERR(0, 241, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":242
 *     try:
 *         import matplotlib.pyplot as plt
 *         has_matplotlib = True             # <<<<<<<<<<<<<<
 *         import matplotlib
 * 
*/
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_matplotlib, Py_True) < (0)) __PYX_ERR(0, 242, __pyx_L52_error)

          /* "H2MM_C.pyx":243
 *         import matplotlib.pyplot as plt
 *         has_matplotlib = True
 *         import matplotlib             # <<<<<<<<<<<<<<
 * 
 *         class IPyPlot(Printer):
*/
          __pyx_t_20 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_matplotlib, 0, 0, NULL, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 243, __pyx_L52_error)
          __pyx_t_4 = __pyx_t_20;
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_matplotlib, __pyx_t_4) < (0)) __PYX_ERR(0, 243, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":245
 *         import matplotlib
 * 
 *         class IPyPlot(Printer):             # <<<<<<<<<<<<<<
 *             """
 *             **Beta Feature**
*/
          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Printer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_13 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_4, __pyx_mstate_global->__pyx_n_u_IPyPlot, __pyx_mstate_global->__pyx_n_u_IPyPlot, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_kp_u_Beta_Feature_note_This_class_is); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_4 != __pyx_t_12) {
            if (unlikely((PyDict_SetItemString(__pyx_t_13, "__orig_bases__", __pyx_t_12) < 0))) __PYX_ERR(0, 245, __pyx_L52_error)
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":279
 *                 kwargs handed to plt.subplots when creating initial figure and plots.
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')             # <<<<<<<<<<<<<<
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
*/
          if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[18]) < (0)) __PYX_ERR(0, 279, __pyx_L52_error)

          /* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/
          __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7IPyPlot_1__init__, 0, __pyx_mstate_global->__pyx_n_u_IPyPlot___init, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 280, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
          #endif
          __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_mstate_global->__pyx_tuple[19]);
          if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_12) < (0)) __PYX_ERR(0, 280, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":299
 *                 self.plot_kwargs = plot_kwargs if plot_kwargs is not None else [[[dict()] for j in range(ncols)] for i in range(nrows)]
 * 
 *             def update(self, data):             # <<<<<<<<<<<<<<
 *                 """
 *                 Update plot with new data points
*/
          __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7IPyPlot_3update, 0, __pyx_mstate_global->__pyx_n_u_IPyPlot_update, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 299, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
          #endif
          if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_12) < (0)) __PYX_ERR(0, 299, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":340
 *                     self.stream.update(fig)
 * 
 *             def _get_xylim(self, i, j):             # <<<<<<<<<<<<<<
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':
*/
          __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7IPyPlot_5_get_xylim, 0, __pyx_mstate_global->__pyx_n_u_IPyPlot__get_xylim, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 340, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
          #endif
          if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_get_xylim, __pyx_t_12) < (0)) __PYX_ERR(0, 340, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":359
 *                 return (xmin, xmax), (ymin, ymax)
 * 
 *             def close(self):             # <<<<<<<<<<<<<<
 *                 """
 *                 Clear the display handle.
*/
          __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7IPyPlot_7close, 0, __pyx_mstate_global->__pyx_n_u_IPyPlot_close, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 359, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
          #endif
          if (__Pyx_SetNameInClass(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_12) < (0)) __PYX_ERR(0, 359, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "H2MM_C.pyx":245
 *         import matplotlib
 * 
 *         class IPyPlot(Printer):             # <<<<<<<<<<<<<<
 *             """
 *             **Beta Feature**
*/
          __pyx_t_12 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_IPyPlot, __pyx_t_4, __pyx_t_13, NULL, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_12);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
          #endif
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IPyPlot, __pyx_t_12) < (0)) __PYX_ERR(0, 245, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":370
 *                 clear_output()
 * 
 *         def plot_bic(niter, new, current, old, iter_time, total_time):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots BIC in single plot
*/
          __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_1plot_bic, 0, __pyx_mstate_global->__pyx_n_u_plot_bic, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
          #endif
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plot_bic, __pyx_t_4) < (0)) __PYX_ERR(0, 370, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":381
 *             return [[np.array([niter, current.bic])]]
 * 
 *         def plot_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots obs values in single plot.
*/
          __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_3plot_obs, 0, __pyx_mstate_global->__pyx_n_u_plot_obs, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
          #endif
          __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[20]);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plot_obs, __pyx_t_4) < (0)) __PYX_ERR(0, 381, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":395
 *             return [[np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]
 * 
 *         def plot_bic_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots plot_bic in first plot
*/
          __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_5plot_bic_obs, 0, __pyx_mstate_global->__pyx_n_u_plot_bic_obs, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 395, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
          PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4);
          #endif
          __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[20]);
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_plot_bic_obs, __pyx_t_4) < (0)) __PYX_ERR(0, 395, __pyx_L52_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "H2MM_C.pyx":240
 *         def close(self):
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         import matplotlib.pyplot as plt
 *         has_matplotlib = True
*/
        }
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        goto __pyx_L57_try_end;
        __pyx_L52_error:;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "H2MM_C.pyx":410
 *             return [[np.array([niter, current.bic]), np.array([[current.obs[i,dx], current.obs[i,dy]] for i in range(current.nstate)]).reshape(-1)]]
 * 
 *     except:             # <<<<<<<<<<<<<<
 *         has_matplotlib = False
 * except:
*/
        /*except:*/ {
          __Pyx_AddTraceback("H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_13) < 0) __PYX_ERR(0, 410, __pyx_L54_except_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_13);

          /* "H2MM_C.pyx":411
 * 
 *     except:
 *         has_matplotlib = False             # <<<<<<<<<<<<<<
 * except:
 *     has_ipython = False
*/
          if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_matplotlib, Py_False) < (0)) __PYX_ERR(0, 411, __pyx_L54_except_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L53_exception_handled;
        }

        /* "H2MM_C.pyx":240
 *         def close(self):
 *             pass
 *     try:             # <<<<<<<<<<<<<<
 *         import matplotlib.pyplot as plt
 *         has_matplotlib = True
*/
        __pyx_L54_except_error:;
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
        goto __pyx_L46_error;
        __pyx_L53_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
        __pyx_L57_try_end:;
      }

      /* "H2MM_C.pyx":196
 * has_ipython = False
 * has_matplotlib = False
 * try:             # <<<<<<<<<<<<<<
 *     from itertools import product, chain
 *     from IPython.display import DisplayHandle, Pretty, clear_output
*/
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L51_try_end;
    __pyx_L46_error:;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H2MM_C.pyx":412
 *     except:
 *         has_matplotlib = False
 * except:             # <<<<<<<<<<<<<<
 *     has_ipython = False
 * 
*/
    /*except:*/ {
      __Pyx_AddTraceback("H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 412, __pyx_L48_except_error)
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);

      /* "H2MM_C.pyx":413
 *         has_matplotlib = False
 * except:
 *     has_ipython = False             # <<<<<<<<<<<<<<
 * 
 * ###############################################################################
*/
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_has_ipython, Py_False) < (0)) __PYX_ERR(0, 413, __pyx_L48_except_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L47_exception_handled;
    }

    /* "H2MM_C.pyx":196
 * has_ipython = False
 * has_matplotlib = False
 * try:             # <<<<<<<<<<<<<<
 *     from itertools import product, chain
 *     from IPython.display import DisplayHandle, Pretty, clear_output
*/
    __pyx_L48_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    goto __pyx_L1_error;
    __pyx_L47_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
    __pyx_L51_try_end:;
  }

  /* "H2MM_C.pyx":435
 *         object _formatter
 *         object _outstream
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,             # <<<<<<<<<<<<<<
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_mstate_global->__pyx_k__15 = __pyx_t_5;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H2MM_C.pyx":436
 *         object _outstream
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,             # <<<<<<<<<<<<<<
 *                   outstream=lambda: sys.stdout):
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_cpu_count); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_12 = __Pyx_PyLong_FloorDivideObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_mstate_global->__pyx_k__16 = __pyx_t_12;
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_StdPrinter); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_mstate_global->__pyx_k__17 = __pyx_t_12;
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":437
 *     def __cinit__(self, max_iter=2046, max_time=np.inf, converged_min=1e-14,
 *                   num_cores=os.cpu_count()//2, formatter=StdPrinter,
 *                   outstream=lambda: sys.stdout):             # <<<<<<<<<<<<<<
 *         assert max_iter > 0 and np.issubdtype(type(max_iter), np.integer), ValueError("max_iter must be integer greater than 0")
 *         assert max_time > 0 and np.issubdtype(type(max_time), np.floating), ValueError("max_time must be float and greater than 0")
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_28lambda3, 0, __pyx_mstate_global->__pyx_n_u_cinit___locals_lambda, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  __pyx_mstate_global->__pyx_k__18 = __pyx_t_12;
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":527
 *                 f'formatter: {self._formatter.__qualname__}, outstream={self._outstream}')
 * 
 *     def _get_max_iter(self, max_iter):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_9_get_max_iter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_max_iter, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_max_iter, __pyx_t_12) < (0)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":553
 *         return m_iter
 * 
 *     def _get_max_time(self, max_time):             # <<<<<<<<<<<<<<
 *         """
 *         Process the max_iter keyword argument value.
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_11_get_max_time, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_max_time, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_max_time, __pyx_t_12) < (0)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":579
 *         return m_time
 * 
 *     def _get_converged_min(self, converged_min):             # <<<<<<<<<<<<<<
 *         """
 *         Process the converged_min keyword argument value.
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_13_get_converged_min, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_converged_min, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_converged_min, __pyx_t_12) < (0)) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":607
 *         return c_min
 * 
 *     def _get_num_cores(self, num_cores):             # <<<<<<<<<<<<<<
 *         """
 *         Process the num_cores keyword argument value.
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_15_get_num_cores, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_num_cores, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_num_cores, __pyx_t_12) < (0)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":640
 *         return n_core
 * 
 *     def _get_formatter(self, formatter):             # <<<<<<<<<<<<<<
 *         """
 *         Get the formatter based on the value form kwargs.
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_17_get_formatter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_formatter, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_formatter, __pyx_t_12) < (0)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":659
 *         return formatter
 * 
 *     def _get_outstream(self, outstream):             # <<<<<<<<<<<<<<
 *         """
 *         Ge the output stream based on keyword argument to print_stream
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_19_get_outstream, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const__get_outstream, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_mstate_global->__pyx_n_u_get_outstream, __pyx_t_12) < (0)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_21__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_12) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "(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__"
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13opt_lim_const_23__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_opt_lim_const___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_12) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":678
 *         return outstream
 * 
 * def get_stdout():             # <<<<<<<<<<<<<<
 *     """Simple callable returns sys.stdout"""
 *     return sys.stdout
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_7get_stdout, 0, __pyx_mstate_global->__pyx_n_u_get_stdout, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_stdout, __pyx_t_12) < (0)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":683
 * 
 * #: Like rcParams, a place to set defaults for optimization limits
 * optimization_limits = opt_lim_const(max_iter=2046, max_time=np.inf,             # <<<<<<<<<<<<<<
 *                                     converged_min=1e-14, num_cores=os.cpu_count()//2,
 *                                     formatter=StdPrinter, outstream=get_stdout)
*/
  __pyx_t_5 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":684
 * #: Like rcParams, a place to set defaults for optimization limits
 * optimization_limits = opt_lim_const(max_iter=2046, max_time=np.inf,
 *                                     converged_min=1e-14, num_cores=os.cpu_count()//2,             # <<<<<<<<<<<<<<
 *                                     formatter=StdPrinter, outstream=get_stdout)
 * 
*/
  __pyx_t_16 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_os); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_cpu_count); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_16, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_15, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_15 = __Pyx_PyLong_FloorDivideObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H2MM_C.pyx":685
 * optimization_limits = opt_lim_const(max_iter=2046, max_time=np.inf,
 *                                     converged_min=1e-14, num_cores=os.cpu_count()//2,
 *                                     formatter=StdPrinter, outstream=get_stdout)             # <<<<<<<<<<<<<<
 * 
 * cdef class ConvCodes:
*/
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_StdPrinter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_mstate_global->__pyx_n_u_get_stdout); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 6 : 0)] = {__pyx_t_5, NULL};
    __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_iter, __pyx_mstate_global->__pyx_int_2046, __pyx_t_14, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_time, __pyx_t_13, __pyx_t_14, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_converged_min, __pyx_mstate_global->__pyx_float_1eneg_14, __pyx_t_14, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_num_cores, __pyx_t_15, __pyx_t_14, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_formatter, __pyx_t_4, __pyx_t_14, __pyx_callargs+1, 4) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_outstream, __pyx_t_16, __pyx_t_14, __pyx_callargs+1, 5) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
    __pyx_t_12 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_6H2MM_C_opt_lim_const, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_12);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_optimization_limits, ((PyObject *)__pyx_t_12)) < (0)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_DECREF((PyObject *)__pyx_t_12); __pyx_t_12 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_9ConvCodes_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ConvCodes___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_ConvCodes, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_12) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_ConvCodes__set_state(self, __pyx_state)
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_9ConvCodes_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ConvCodes___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_ConvCodes, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_12) < (0)) __PYX_ERR(1, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":729
 *         return CONVCODE_FIXEDMODEL
 * 
 * convcode = ConvCodes()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_14 = NULL;
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL};
    __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_6H2MM_C_ConvCodes, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 729, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_12);
  }
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_convcode, ((PyObject *)__pyx_t_12)) < (0)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_DECREF((PyObject *)__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":896
 *         self.model = NULL
 * 
 *     def __init__(self, prior, trans, obs, loglik=-np.inf, niter=0, nphot = 0, is_conv=False):             # <<<<<<<<<<<<<<
 *         # if statements check to confirm first the correct dimensinality of input matrices, then that their shapes match
 *         cdef int64_t i, j
*/
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyNumber_Negative(__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_mstate_global->__pyx_k__19 = __pyx_t_12;
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":976
 *         return new
 * 
 *     def tobytes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Serialize :class:`h2mm_model` into bytes, which can be read back into
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_7tobytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_tobytes, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_tobytes, __pyx_t_12) < (0)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1001
 *         return arr.tobytes()
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def frombytes(cls, buffer):
 *         """
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_9frombytes, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_frombytes, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_frombytes, __pyx_t_12) < (0)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_GetNameInClass(__pyx_t_12, (PyObject*)__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_frombytes); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = __Pyx_Method_ClassMethod(__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_frombytes, __pyx_t_14) < (0)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1232
 *         self.model.niter = niter
 * 
 *     def set_converged(self, converged=True):             # <<<<<<<<<<<<<<
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_15set_converged, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_set_converged, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_set_converged, __pyx_t_14) < (0)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1244
 *             self.model.conv &= ~(CONVCODE_OUTPUT|CONVCODE_ANYFINAL)
 * 
 *     def sort_states(self):             # <<<<<<<<<<<<<<
 *         """Return model with states sorted by values in prior, and set as 'hashable'"""
 *         srt = np.argsort(self.prior)
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_17sort_states, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_sort_states, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_sort_states, __pyx_t_14) < (0)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1275
 *         return True
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """For internal use, ensures all model arrays are row stochastic"""
 *         if not self.model.conv & CONVCODE_FIXEDMODEL:
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_21normalize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_normalize, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_normalize, __pyx_t_14) < (0)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1280
 *             h2mm_normalize(self.model)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """ Make a duplicate model in new memory"""
 *         return model_copy_from_ptr(self.model)
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_23copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_copy, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_14) < (0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1284
 *         return model_copy_from_ptr(self.model)
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         return self.copy()
 * 
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_25__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model___copy, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_copy_2, __pyx_t_14) < (0)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1300
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
 *         """
*/
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_mstate_global->__pyx_k__21 = __pyx_t_12;
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1299
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,             # <<<<<<<<<<<<<<
 *                   max_time=np.inf, converged_min=None, num_cores=None,
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
*/
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);

  /* "H2MM_C.pyx":1300
 *                   print_stream=None, print_formatter=None,
 *                   print_fmt_args=None, print_fmt_kwargs=None,
 *                   max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *                   reset_niter=True, gamma=False, opt_array=False, inplace=False):
 *         """
*/
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1295
 *         return hash(p+t+o)
 * 
 *     def optimize(self, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *                   bounds_func=None, bounds=None, bounds_kwargs=None,
 *                   print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
  __pyx_t_12 = PyTuple_Pack(19, Py_None, Py_None, Py_None, Py_None, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_int_1, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None, __pyx_t_14, Py_None, Py_None, Py_True, Py_False, Py_False, Py_False); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_29optimize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_optimize, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_t_12);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_optimize, __pyx_t_14) < (0)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=True):
 *         """
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_31evaluate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model_evaluate, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[22]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6H2MM_C_h2mm_model, __pyx_mstate_global->__pyx_n_u_evaluate, __pyx_t_14) < (0)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_14) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "(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__"
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10h2mm_model_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_model___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_14) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10_h2mm_lims_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_lims___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_14) < (0)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "(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__"
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_10_h2mm_lims_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_h2mm_lims___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_14) < (0)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1748
 * 
 * 
 * class h2mm_limits:             # <<<<<<<<<<<<<<
 *     """
 *     Special class for setting limits on the h2mm_model, as min and max values
*/
  __pyx_t_14 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_n_u_h2mm_limits, __pyx_mstate_global->__pyx_n_u_h2mm_limits, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_kp_u_Special_class_for_setting_limit); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);

  /* "H2MM_C.pyx":1807
 * 
 *     """
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):             # <<<<<<<<<<<<<<
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_11h2mm_limits_1__init__, 0, __pyx_mstate_global->__pyx_n_u_h2mm_limits___init, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_mstate_global->__pyx_tuple[23]);
  if (__Pyx_SetNameInClass(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_12) < (0)) __PYX_ERR(0, 1807, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1873
 *         self.model = model
 * 
 *     def make_model(self, model, warning=True):             # <<<<<<<<<<<<<<
 *         """
 *         Method for checking the limits arrays generated from the input model
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_11h2mm_limits_3make_model, 0, __pyx_mstate_global->__pyx_n_u_h2mm_limits_make_model, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_12, __pyx_mstate_global->__pyx_tuple[21]);
  if (__Pyx_SetNameInClass(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_make_model, __pyx_t_12) < (0)) __PYX_ERR(0, 1873, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1992
 *         return min_prior, max_prior, min_trans, max_trans, min_obs, max_obs
 * 
 *     def _make_model(self, h2mm_model model):             # <<<<<<<<<<<<<<
 *         """
 *         Hidden method identical to make_model, except returns the hidden class
*/
  __pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_11h2mm_limits_5_make_model, 0, __pyx_mstate_global->__pyx_n_u_h2mm_limits__make_model, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (__Pyx_SetNameInClass(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_make_model_2, __pyx_t_12) < (0)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

  /* "H2MM_C.pyx":1748
 * 
 * 
 * class h2mm_limits:             # <<<<<<<<<<<<<<
 *     """
 *     Special class for setting limits on the h2mm_model, as min and max values
*/
  __pyx_t_12 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_mstate_global->__pyx_n_u_h2mm_limits, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_14, NULL, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_12);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_h2mm_limits, __pyx_t_12) < (0)) __PYX_ERR(0, 1748, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":2016
 * 
 * 
 * def factory_h2mm_model(nstate, ndet, bounds=None, trans_scale=1e-5,             # <<<<<<<<<<<<<<
 *                   prior_dist='equal', trans_dist='equal',obs_dist='equal'):
 *     """
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_9factory_h2mm_model, 0, __pyx_mstate_global->__pyx_n_u_factory_h2mm_model, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[24]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_factory_h2mm_model, __pyx_t_14) < (0)) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":2597
 * 
 * 
 * def EM_H2MM_C(h2mm_model model, indexes, times, max_iter=None,             # <<<<<<<<<<<<<<
 *               bounds_func=None, bounds=None, bounds_kwargs=None,
 *               print_func='iter', print_freq=1, print_args=None, print_kwargs=None,
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_11EM_H2MM_C, 0, __pyx_mstate_global->__pyx_n_u_EM_H2MM_C, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_14, __pyx_mstate_global->__pyx_ptype_6H2MM_C___pyx_defaults)) __PYX_ERR(0, 2597, __pyx_L1_error)

  /* "H2MM_C.pyx":2602
 *               print_stream=None, print_formatter=None,
 *               print_fmt_args=None, print_fmt_kwargs=None,
 *               max_time=np.inf, converged_min=None, num_cores=None,             # <<<<<<<<<<<<<<
 *               reset_niter=True, gamma=False, opt_array=False):
 *     """
*/
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_inf); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_t_14)->arg0 = __pyx_t_16;
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_16 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_14, __pyx_pf_6H2MM_C_31__defaults__);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EM_H2MM_C, __pyx_t_14) < (0)) __PYX_ERR(0, 2597, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3192
 * 
 * 
 * def H2MM_arr(models, indexes, times, num_cores=None, gamma=False):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the logliklihood of every model in a list/array given a set of
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_13H2MM_arr, 0, __pyx_mstate_global->__pyx_n_u_H2MM_arr, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[25]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_H2MM_arr, __pyx_t_14) < (0)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3334
 * 
 * 
 * def viterbi_path(h2mm_model h_mod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the most likely state path through a set of data given a H2MM model
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_15viterbi_path, 0, __pyx_mstate_global->__pyx_n_u_viterbi_path, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_viterbi_path, __pyx_t_14) < (0)) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3414
 * 
 * 
 * def viterbi_sort(h2mm_model hmod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     An all inclusive viterbi processing algorithm. Returns the ICL, the most likely
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_17viterbi_sort, 0, __pyx_mstate_global->__pyx_n_u_viterbi_sort, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_viterbi_sort, __pyx_t_14) < (0)) __PYX_ERR(0, 3414, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_19path_loglik, 0, __pyx_mstate_global->__pyx_n_u_path_loglik, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[27]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_path_loglik, __pyx_t_14) < (0)) __PYX_ERR(0, 3635, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3741
 * 
 * # simulation functions
 * def sim_statepath(h2mm_model hmod, int lenp, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     A function to generate a dense statepath (HMM as opposed to H2MM) of length lenp
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_21sim_statepath, 0, __pyx_mstate_global->__pyx_n_u_sim_statepath, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sim_statepath, __pyx_t_14) < (0)) __PYX_ERR(0, 3741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3780
 * 
 * 
 * def sim_sparsestatepath(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path from a model and a sparse set of arrival times
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_23sim_sparsestatepath, 0, __pyx_mstate_global->__pyx_n_u_sim_sparsestatepath, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sim_sparsestatepath, __pyx_t_14) < (0)) __PYX_ERR(0, 3780, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3831
 * 
 * 
 * def sim_phtraj_from_state(h2mm_model hmod, states, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a photon trajectory from a h2mm model and state trajectory
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_25sim_phtraj_from_state, 0, __pyx_mstate_global->__pyx_n_u_sim_phtraj_from_state, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sim_phtraj_from_state, __pyx_t_14) < (0)) __PYX_ERR(0, 3831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":3878
 * 
 * 
 * def sim_phtraj_from_times(h2mm_model hmod, times, seed=None):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a state path and photon trajectory for a given set of times
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_27sim_phtraj_from_times, 0, __pyx_mstate_global->__pyx_n_u_sim_phtraj_from_times, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_mstate_global->__pyx_tuple[26]);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sim_phtraj_from_times, __pyx_t_14) < (0)) __PYX_ERR(0, 3878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "(tree fragment)":4
 *     int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1
 *     int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1
 * def __pyx_unpickle_ConvCodes(__pyx_type, long __pyx_checksum, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_result
 *     __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'')
*/
  __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_6H2MM_C_30__pyx_unpickle_ConvCodes, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ConvCodes, NULL, __pyx_mstate_global->__pyx_n_u_H2MM_C, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  PyUnstable_Object_EnableDeferredRefcount(__pyx_t_14);
  #endif
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_ConvCodes, __pyx_t_14) < (0)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "H2MM_C.pyx":1
 * # -*- coding: utf-8 -*-             # <<<<<<<<<<<<<<
 * #cython: language_level=3
 * # Created 20 Feb 2021
*/
  __pyx_t_14 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_14) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init H2MM_C", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    #if !CYTHON_USE_MODULE_STATE
    Py_CLEAR(__pyx_m);
    #else
    Py_DECREF(__pyx_m);
    if (pystate_addmodule_run) {
      PyObject *tp, *value, *tb;
      PyErr_Fetch(&tp, &value, &tb);
      PyState_RemoveModule(&__pyx_moduledef);
      PyErr_Restore(tp, value, tb);
    }
    #endif
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init H2MM_C");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #else
  return __pyx_m;
  #endif
}
/* #### Code section: pystring_table ### */
/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 128, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 285, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_object); if (!__pyx_builtin_object) __PYX_ERR(0, 3606, __pyx_L1_error)
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 3702, __pyx_L1_error)
  __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 157, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error)

  /* Cached unbound methods */
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.type = (PyObject*)(&PyUnicode_Type);
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__strip.method_name = &__pyx_mstate->__pyx_n_u_strip;
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cached_constants ### */

static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  __Pyx_RefNannyDeclarations
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = ('self.name is not None',)             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "View.MemoryView":583
 *     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_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

  /* "View.MemoryView":680
 *     tup = <tuple>index if isinstance(index, tuple) else (index,)
 * 
 *     result = [slice(None)] * ndim             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
*/
  __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

  /* "H2MM_C.pyx":180
 *         text = str(text)
 *         if self.single_line:
 *             text = text.replace('\n', ' ')             # <<<<<<<<<<<<<<
 *         if self.keep:
 *             text = text + '\n'
*/
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u__12, __pyx_mstate_global->__pyx_kp_u__13); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

  /* "H2MM_C.pyx":281
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),             # <<<<<<<<<<<<<<
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
 *                 if len(xlim) != nrows or len(ylim) != nrows:
*/
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_min, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_tuple[3]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_tuple[4]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

  /* "H2MM_C.pyx":282
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):             # <<<<<<<<<<<<<<
 *                 if len(xlim) != nrows or len(ylim) != nrows:
 *                     raise ValueError("xlim and ylim must be nrow x ncol array")
*/
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_plot); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_tuple[6]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "H2MM_C.pyx":343
 *                 xmin, xmax = self.xlim[i][j]
 *                 if xmin == 'min':
 *                     xmin = np.min(self.data[i,j][:,::2])             # <<<<<<<<<<<<<<
 *                 if xmax == 'max':
 *                     xmax = np.max(self.data[i,j][:,::2])
*/
  __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, Py_None, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]);
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_slice[1]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "H2MM_C.pyx":348
 *                 ymin, ymax = self.ylim[i][j]
 *                 if ymin == 'min':
 *                     ymin = np.min(self.data[i,j][:,1::2])             # <<<<<<<<<<<<<<
 *                 if ymax == 'max':
 *                     ymax = np.max(self.data[i,j][:,1::2])
*/
  __pyx_mstate_global->__pyx_slice[2] = PySlice_New(__pyx_mstate_global->__pyx_int_1, Py_None, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_slice[2])) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[2]);
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_slice[2]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = ('False',)             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_ConvCodes, (type(self), 0xe3b0c44, None), state
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(1, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "H2MM_C.pyx":2132
 *             obs = obs / obs.sum(axis=1).reshape(nstate,1)
 *         if const_obs:
 *             sort = np.argsort(obs[:,0])             # <<<<<<<<<<<<<<
 *             obs = obs[sort,:]
 *     model = h2mm_model(prior,trans,obs)
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 2132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);

  /* "H2MM_C.pyx":2406
 *             single = True
 *             burst_array = (burst_array, )
 *             shape = (1, )             # <<<<<<<<<<<<<<
 *         else:
 *             shape = burst_array.shape
*/
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);

  /* "H2MM_C.pyx":2895
 *     limits.min_conv = <double> optimization_limits._get_converged_min(converged_min)
 *     ################# process print_func and print_func args  #################
 *     cdef tuple print_strings = (None,'all','diff','diff_time','comp','comp_time','iter')             # <<<<<<<<<<<<<<
 *     if print_func not in print_strings and not callable(print_func):
 *         raise ValueError("print_func must be None, 'all', 'diff', or 'comp' or callable")
*/
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(7, Py_None, __pyx_mstate_global->__pyx_n_u_all, __pyx_mstate_global->__pyx_n_u_diff, __pyx_mstate_global->__pyx_n_u_diff_time, __pyx_mstate_global->__pyx_n_u_comp, __pyx_mstate_global->__pyx_n_u_comp_time, __pyx_mstate_global->__pyx_n_u_iter); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 2895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);

  /* "H2MM_C.pyx":3539
 *         demar = np.append(1,np.diff(state))
 *         begs = np.argwhere(demar!=0)[:,0] #identifies which photons have a dwell, this array marks the beginning indexes
 *         ends = np.append(begs[1:],time.shape[0]) # make an equivalent ending index array             # <<<<<<<<<<<<<<
 *         for b, e in zip(begs,ends):
 *             for i in range(hmod.ndet):
*/
  __pyx_mstate_global->__pyx_slice[3] = PySlice_New(__pyx_mstate_global->__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[3])) __PYX_ERR(0, 3539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[3]);

  /* "H2MM_C.pyx":3557
 *                 ph_burst[state[b]] = np.concatenate((ph_burst[state[b]],ph_counts_temp))
 *     for i in range(hmod.nstate):
 *         dwell_burst[i] = np.array(dwell_burst[i]).astype('long') if len(dwell_burst[i]) > 0 else np.zeros((0,2)).astype('long')             # <<<<<<<<<<<<<<
 *         for j in range(hmod.nstate):
 *             dwell_mid[i][j] = np.array(dwell_mid[i][j]).astype('long') if len(dwell_mid[i][j]) > 0 else np.zeros((0,2)).astype('long')
*/
  __pyx_mstate_global->__pyx_tuple[14] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_2); if (unlikely(!__pyx_mstate_global->__pyx_tuple[14])) __PYX_ERR(0, 3557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[14]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[14]);

  /* "H2MM_C.pyx":170
 * 
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')             # <<<<<<<<<<<<<<
 *     def __init__(self, buffer, keep=False, single_line=True):
 *         self.buffer = buffer
*/
  __pyx_mstate_global->__pyx_tuple[15] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_n_u_buffer, __pyx_mstate_global->__pyx_n_u_width, __pyx_mstate_global->__pyx_n_u_keep, __pyx_mstate_global->__pyx_n_u_single_line); if (unlikely(!__pyx_mstate_global->__pyx_tuple[15])) __PYX_ERR(0, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[15]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[15]);

  /* "H2MM_C.pyx":171
 * class StdPrinter(Printer):
 *     __slots__ = ('buffer', 'width', 'keep', 'single_line')
 *     def __init__(self, buffer, keep=False, single_line=True):             # <<<<<<<<<<<<<<
 *         self.buffer = buffer
 *         self.width = 0
*/
  __pyx_mstate_global->__pyx_tuple[16] = PyTuple_Pack(2, ((PyObject*)Py_False), ((PyObject*)Py_True)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[16])) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[16]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[16]);

  /* "H2MM_C.pyx":211
 *             Whether to keep old output or replace with new. The default is False
 *         """
 *         def __init__(self, buffer, keep=False):             # <<<<<<<<<<<<<<
 *             self.buffer = buffer
 *             self.keep = bool(keep)
*/
  __pyx_mstate_global->__pyx_tuple[17] = PyTuple_Pack(1, ((PyObject*)Py_False)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[17])) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[17]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[17]);

  /* "H2MM_C.pyx":279
 *                 kwargs handed to plt.subplots when creating initial figure and plots.
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')             # <<<<<<<<<<<<<<
 *             def __init__(self, stream, nrows=1, ncols=1,
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
*/
  __pyx_mstate_global->__pyx_tuple[18] = PyTuple_Pack(9, __pyx_mstate_global->__pyx_n_u_stream, __pyx_mstate_global->__pyx_n_u_nrows, __pyx_mstate_global->__pyx_n_u_ncols, __pyx_mstate_global->__pyx_n_u_data, __pyx_mstate_global->__pyx_n_u_xlim, __pyx_mstate_global->__pyx_n_u_ylim, __pyx_mstate_global->__pyx_n_u_kwargs, __pyx_mstate_global->__pyx_n_u_plot_type, __pyx_mstate_global->__pyx_n_u_plot_kwargs); if (unlikely(!__pyx_mstate_global->__pyx_tuple[18])) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[18]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[18]);

  /* "H2MM_C.pyx":280
 *             """
 *             __slots__ = ('stream', 'nrows', 'ncols', 'data', 'xlim', 'ylim', 'kwargs', 'plot_type', 'plot_kwargs')
 *             def __init__(self, stream, nrows=1, ncols=1,             # <<<<<<<<<<<<<<
 *                          xlim=((('min', 'max'),),), ylim=((('min', 'max'),),),
 *                          plot_kwargs=None, plot_type=(('plot',),), **kwargs):
*/
  __pyx_mstate_global->__pyx_tuple[19] = PyTuple_Pack(6, ((PyObject*)__pyx_mstate_global->__pyx_int_1), ((PyObject*)__pyx_mstate_global->__pyx_int_1), ((PyObject*)__pyx_mstate_global->__pyx_tuple[5]), ((PyObject*)__pyx_mstate_global->__pyx_tuple[5]), Py_None, ((PyObject*)__pyx_mstate_global->__pyx_tuple[7])); if (unlikely(!__pyx_mstate_global->__pyx_tuple[19])) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[19]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[19]);

  /* "H2MM_C.pyx":381
 *             return [[np.array([niter, current.bic])]]
 * 
 *         def plot_obs(niter, new, current, old, iter_time, total_time, dx=0, dy=1):             # <<<<<<<<<<<<<<
 *             """
 *             Printing function for :class:`IPyPlot`, plots obs values in single plot.
*/
  __pyx_mstate_global->__pyx_tuple[20] = PyTuple_Pack(2, ((PyObject*)__pyx_mstate_global->__pyx_int_0), ((PyObject*)__pyx_mstate_global->__pyx_int_1)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[20])) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[20]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[20]);

  /* "H2MM_C.pyx":1232
 *         self.model.niter = niter
 * 
 *     def set_converged(self, converged=True):             # <<<<<<<<<<<<<<
 *         """Modify model to mark as converged or not"""
 *         converged = bool(converged)
*/
  __pyx_mstate_global->__pyx_tuple[21] = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[21])) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[21]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[21]);

  /* "H2MM_C.pyx":1614
 *         return out
 * 
 *     def evaluate(self, indexes, times, gamma=False, num_cores=None,             # <<<<<<<<<<<<<<
 *                  inplace=True):
 *         """
*/
  __pyx_mstate_global->__pyx_tuple[22] = PyTuple_Pack(3, Py_False, Py_None, Py_True); if (unlikely(!__pyx_mstate_global->__pyx_tuple[22])) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[22]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[22]);

  /* "H2MM_C.pyx":1807
 * 
 *     """
 *     def __init__(self,model=None,min_prior=None,max_prior=None,min_trans=None,max_trans=None,min_obs=None,max_obs=None,nstate=0,ndet=0):             # <<<<<<<<<<<<<<
 *         none_kwargs = True
 *         if not isinstance(nstate,int) or not isinstance(ndet,int) or nstate < 0 or ndet < 0:
*/
  __pyx_mstate_global->__pyx_tuple[23] = PyTuple_Pack(9, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None, ((PyObject*)__pyx_mstate_global->__pyx_int_0), ((PyObject*)__pyx_mstate_global->__pyx_int_0)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[23])) __PYX_ERR(0, 1807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[23]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[23]);

  /* "H2MM_C.pyx":2016
 * 
 * 
 * def factory_h2mm_model(nstate, ndet, bounds=None, trans_scale=1e-5,             # <<<<<<<<<<<<<<
 *                   prior_dist='equal', trans_dist='equal',obs_dist='equal'):
 *     """
*/
  __pyx_mstate_global->__pyx_tuple[24] = PyTuple_Pack(5, Py_None, ((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_5), ((PyObject*)__pyx_mstate_global->__pyx_n_u_equal), ((PyObject*)__pyx_mstate_global->__pyx_n_u_equal), ((PyObject*)__pyx_mstate_global->__pyx_n_u_equal)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[24])) __PYX_ERR(0, 2016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[24]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[24]);

  /* "H2MM_C.pyx":3192
 * 
 * 
 * def H2MM_arr(models, indexes, times, num_cores=None, gamma=False):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the logliklihood of every model in a list/array given a set of
*/
  __pyx_mstate_global->__pyx_tuple[25] = PyTuple_Pack(2, Py_None, ((PyObject*)Py_False)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[25])) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[25]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[25]);

  /* "H2MM_C.pyx":3334
 * 
 * 
 * def viterbi_path(h2mm_model h_mod, indexes, times, num_cores=None):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate the most likely state path through a set of data given a H2MM model
*/
  __pyx_mstate_global->__pyx_tuple[26] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[26])) __PYX_ERR(0, 3334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[26]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[26]);

  /* "H2MM_C.pyx":3635
 * 
 * 
 * def path_loglik(h2mm_model model, indexes, times, state_path, num_cores=None,             # <<<<<<<<<<<<<<
 *                 BIC=True, total_loglik=False, loglikarray=False, loglikpath=False):
 *     """
*/
  __pyx_mstate_global->__pyx_tuple[27] = PyTuple_Pack(5, Py_None, ((PyObject*)Py_True), ((PyObject*)Py_False), ((PyObject*)Py_False), ((PyObject*)Py_False)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[27])) __PYX_ERR(0, 3635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[27]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[27]);
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_tuple;
    for (Py_ssize_t i=0; i<28; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_slice;
    for (Py_ssize_t i=0; i<4; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}
/* #### Code section: init_constants ### */

static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  {
    const struct { const unsigned int length: 12; } index[] = {{2},{3},{2},{2},{79},{68},{30},{30},{1575},{35},{55},{54},{37},{34},{45},{48},{60},{57},{31},{24},{39},{52},{339},{56},{64},{39},{25},{29},{143},{26},{42},{34},{42},{30},{17},{29},{33},{52},{73},{75},{75},{56},{62},{45},{22},{10},{10},{16},{25},{54},{62},{6},{15},{42},{34},{51},{18},{26},{32},{26},{20},{21},{53},{62},{70},{4},{179},{64},{43},{33},{49},{34},{37},{19},{59},{43},{2801},{30},{26},{16},{46},{59},{8},{58},{68},{45},{28},{23},{25},{25},{23},{25},{25},{35},{32},{56},{48},{55},{36},{1},{1},{1},{1},{1},{1},{2},{2},{1},{1},{1},{1},{0},{8},{49},{5},{21},{6},{77},{41},{37},{38},{6},{22},{37},{39},{27},{35},{45},{24},{15},{13},{23},{25},{7},{10},{17},{46},{33},{42},{36},{18},{18},{37},{24},{34},{7},{6},{29},{24},{25},{13},{2},{6},{35},{42},{7},{12},{14},{4},{18},{55},{42},{19},{37},{48},{48},{30},{29},{35},{41},{35},{44},{4},{30},{49},{9},{30},{16},{11},{27},{91},{65},{10},{9},{23},{60},{56},{45},{12},{31},{26},{39},{40},{12},{41},{28},{19},{13},{17},{38},{39},{42},{42},{41},{38},{44},{48},{48},{54},{41},{57},{8},{19},{9},{21},{22},{50},{9},{22},{8},{20},{27},{32},{40},{40},{39},{34},{8},{5},{37},{47},{36},{85},{13},{12},{15},{20},{18},{61},{7},{39},{47},{38},{26},{10},{21},{15},{81},{8},{12},{10},{20},{32},{22},{14},{22},{8},{7},{39},{48},{38},{3},{30},{37},{40},{4},{5},{11},{39},{43},{3},{5},{3},{9},{27},{29},{13},{9},{8},{5},{6},{8},{7},{16},{33},{18},{13},{14},{10},{19},{16},{17},{15},{20},{6},{7},{16},{17},{16},{13},{14},{20},{8},{10},{19},{16},{17},{1},{15},{3},{14},{3},{15},{3},{6},{8},{4},{7},{8},{3},{5},{7},{17},{6},{18},{10},{2},{4},{1},{4},{4},{3},{7},{4},{5},{9},{10},{6},{11},{13},{3},{6},{11},{10},{15},{10},{11},{1},{5},{8},{7},{5},{8},{27},{9},{17},{12},{18},{5},{3},{15},{4},{9},{11},{9},{4},{9},{8},{9},{13},{4},{8},{5},{6},{9},{11},{6},{7},{4},{6},{5},{4},{6},{8},{5},{4},{9},{7},{7},{6},{5},{15},{9},{11},{9},{9},{2},{2},{1},{3},{5},{6},{4},{9},{9},{5},{3},{5},{8},{6},{8},{7},{8},{3},{3},{18},{3},{5},{8},{5},{6},{9},{7},{13},{9},{8},{5},{6},{9},{9},{7},{18},{14},{13},{13},{14},{14},{10},{10},{12},{11},{20},{23},{22},{10},{28},{30},{10},{19},{28},{30},{15},{19},{20},{20},{19},{24},{22},{18},{5},{11},{14},{25},{4},{1},{3},{2},{4},{10},{18},{18},{5},{7},{5},{3},{8},{7},{5},{7},{7},{13},{5},{10},{5},{8},{4},{9},{9},{1},{4},{1},{4},{6},{1},{8},{4},{6},{8},{2},{2},{3},{6},{11},{7},{10},{4},{6},{6},{8},{5},{37},{10},{11},{10},{17},{3},{8},{7},{9},{8},{9},{3},{7},{13},{3},{7},{9},{9},{6},{5},{4},{5},{6},{10},{11},{10},{15},{5},{6},{4},{8},{7},{5},{5},{4},{4},{7},{3},{7},{4},{5},{7},{4},{11},{9},{4},{2},{5},{5},{6},{3},{9},{5},{3},{6},{7},{3},{9},{8},{8},{9},{3},{4},{9},{10},{13},{31},{33},{32},{28},{27},{27},{28},{28},{19},{8},{2},{3},{7},{12},{7},{9},{8},{9},{4},{5},{4},{11},{28},{6},{5},{6},{8},{9},{14},{6},{6},{4},{8},{12},{11},{8},{9},{3},{3},{11},{5},{10},{9},{14},{16},{10},{15},{10},{10},{12},{12},{13},{5},{11},{10},{10},{11},{10},{7},{14},{6},{14},{14},{12},{11},{10},{24},{19},{14},{12},{6},{10},{17},{13},{8},{7},{3},{11},{7},{3},{6},{10},{5},{7},{4},{5},{4},{4},{13},{12},{8},{8},{10},{12},{19},{5},{21},{21},{19},{13},{6},{11},{4},{9},{4},{11},{3},{2},{5},{5},{10},{6},{10},{8},{6},{4},{4},{6},{5},{6},{8},{3},{10},{3},{8},{4},{4},{5},{4},{5},{9},{7},{7},{12},{10},{5},{10},{11},{5},{7},{6},{6},{12},{5},{6},{7},{11},{12},{12},{12},{4},{7},{8},{5},{5},{1},{4},{4},{4},{2},{1},{4},{4},{4},{2},{5},{3},{2},{1},{0},{1},{1},{201},{2099},{335},{2},{25},{2},{47},{43},{265},{1475},{183},{446},{9},{72},{515},{1225},{14},{629},{81},{80},{14},{151},{26},{18},{86},{9},{548},{89},{13},{524},{27},{25},{116},{219},{7},{117},{11},{15},{21},{70},{6},{109},{1421},{9},{112},{3},{2},{2},{2},{2},{481},{137},{97},{1032},{2},{55},{11},{197},{1}};
    #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (11465 bytes) */
const char* const cstring = "BZh91AY&SY\322\007\305Q\000\016x\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\300@@@@@@@@@@@@\000@\000`3?{\357\213\316>K\335\316\213\237\030\004\232\320\t\"\032o\273\217\207\244\256{\307\275v\365\303\325^\357wy\217-\265*\024>\333_@5.\236\336\355\266\004{Y\364\372k\235\200\321boN\354q\262%T\205\266\226\312\243\356j]=\336z\264){\206c\231\320w\265Z\333\335>\344\217\250\002\200\000\000\000\000\036\000\034`\007\241\360I$\020\215=\032\021\264jS\375M4\3014L\332\243SM&\320\306\232bc@\246\304SF\323M\007\252\031\036\221\243\322\0004\320\000\222 \010\320\024\312e=\020\365\t\223j\2365@\365\001\247\250yO$=!\220\321\220h\320\003!\241\352z\201\241\352\006\200\365\004\246\201\021\024\220\3050\324<H\310\323'\250d\323G\246\221\264\322\017M&#\3311\260\230\221)\230A1\244\311\246\214\2316\206H$\322\21152\230\t\251\264\231G\221\212\032m \332\231\0324\320\3651\000i\241\352\r\000\014\215\r\000\000\000\003@E\024M%4\374\243\321O\362\2443\312jz\215\033&S\312?T\364#\023\324\014\200\006\2002\000\r\030\023M\224mO'\252~\212\036\232\200$D@&\201\000#\004\310OF\223\021\211\243J~\244\332\236\243\3214i\223jh\03224=@\006\200h\000\031\017\376I\002\267\337\244X\360\237g\256I\033\2443\257\334sH\357\023Zm\355\237G<x#\271\336\353\307\036\251\261\003\232\005\031 ,\210\204>\273\002\311iF\305U\347s=\336\217^\236\226\276.\333\217\024b\307j:\270\355\177;\237\321\"\006\340\245\000\367\0017Fo\3301\3560W\271\201\303\003\261\2015{\217C<\306m\364\267&\001\351;TBU\021\014\241*\202\007Z\021%##\225j3i\336\205\032\025\217\202\307\003\213\256\207&\360xO\004\337\207\325>\271\366.M}i4_\020\217^c3\354x\236\314\307\331\037\252Qn-vz\372\261\255\237\372j\370\365v\273Wj\316\303\277\3310\376\324\354\355b\344\033{{\235\317 4\204\320O\030\r\200\354\213\264\262]\277y\353\246\227\337\376\265\363\3415\313\370\375\2146\241(\220\006\301:\331]\234\2019\221\030Q\024\353@#\220'-\032\352\331\222y\3116I\262O>M\234\204\345\335M\231\3470O?\363\356N\344!\334\207rw\003\271\377\277\364\001H\260Y\"\250)\026\n\260\367""\342J\300X\013\"\300<\266V)\025Q\010\262,P\026\th4\265\303\n\251\214I!\266\033A\026\002\301b\307\340\036\360#\360\305UP*\212\242\252\252\262\375_\324A\361+\334RE\320]+\212\345\302r\270\222N\225\002\tR\200P\247\271\227\250\313\242\361\007!\310\310\013$\024RH\260\221Ad\222#\021\220\026\004X(ERr\340\254(\201\350N98\311\306l\033-\226\306\333`\344\r\000\031\014\231d\213\212\345\213Z\324\370\272\236\207\365\307\340\333\003}d\027\344\254A\377\002\036K\206\366\202Q#c\003O\266\206\362\r\275\315\014S\250t\271\236j_nd/\274\357\345z\207U\030\007\363\247\037!4\252RY\261\2452\224\232_Ar\024\032\300\026@Y\025\021`k\326\r\207\254\373=\236\037\007\260*\020Y\026A\004QH \202\204X@U\201;8$\340F\006Y\206\031&d\036\235\027\244\014\220\251E*\002ahlk\256e\205\021\336\324\337d\212\260Sl`\260\243\001a\005\200\206\246\376\013\350\233\301\262f\007U\022\014UQ\026\017(p\032\232ft$\0166\004X\252\021Q\223\030\223Xt0\322aC&\314&\365;=RU\030+WN\311\263\000\232\022\315 \340\003\t\033\006\301\217\024b\013hM\201\314B\303\244\220D9XR\321$\330\353\022\354U\220\005\030F\"\242\240t\246`\212C\273BJ*&\020\311T\356\032\365d\031\017\350\030f\201\241\261\2416\200l\274F\t\031#$\262\315Y\212\271}\010\226\331\214\004\t\211\356I#\230 \325\2222\014\221\22222\014L\367\0306\222\033\315m4\206\247\244\265\003\325\004jr\230\302\200\3031\260\266\005\266\310\333ap\033\212\306\274\346,Du\206L\303\341\030K\000`\306\003\0062\373\034\013^\272\255MX\334\341\310\244[}\305\276\341\2727\334\334'\266\301u\240,\365\035\367#\2531\010\0334\242Gd_dl\033\033\033P\253m\320\335#s\263\225>j\351\203d\270\340\200E?)\223\034\362\216E\317<\234\234\360\034\034e\204\302\3216\373\274\001\377\232[-V\272\232}n\232\032t4R\033A\226\270~\235\022}uZ\255E\330m;t\376~\220\314\2223\016\233\017\000\320\323CM\027^\230\355c\257L\222\333\000\306\203\301`\316\265L\311\033v\023:\t\235\273\005\320s\355l\254Z\237\264kD3k\254\235\272g\267F\354\311g\316_i\255D\025\352\035\304!\035M%\312\300@\230 \\\375]\275\353\t]\370\0315~\037\3072\242\006z\216\302d\033\245\330""\373\257\260\266\202\303\336x\374\030\3434?j4\335\333%se\332\277\327\360\260HfQ\002\3368\024\223\253\363=\014\2110\353\353\250\216{\203\016\256\344\303\232K<\241\233C\377$\275\263KR\271\327+\322\250-i\276\233\320+\000&\2234\252\370\311{3\006(\355<\264^&cV\254\215\266\320\222Y\306J\303\253g\177\354\313@\221\031\375\226\340\234\300%W\311\247\260\361\354\227\312\351bDF]~\305\013R]\224s\343\320{q\314\277[\306\237\206\245\021\271\364\357\317\212\372\333\002\013\330\223bm\214\224\322\202\301\225{r\227t\366a\347_{\210\315\213\245\232\275\024\215\024\225\3104\310)(E\206h,QN3\313\365\257\211Z\236\026\363\357\263O8i\026\301\335\250\344\345\321\247(\334\026 \376\025.R\021S+>S\315\265}\224>\335\002\254w\267\317\255\000\202\225\322\325\367\276q\316\321\245R\252a\226\202\267`\240UH\353\237IJL\230%\332\352a\314\246\354g\274\310\231\341\022\314\226\005\006U\274\036\260vw[;\302oF\215\036\315#\231P\2626\0302V*\325b'`\363\274\224\354\340\314\270xA\340\353&\363\256\234\311\351Jf\355=&b\230j6`\312\005\0052\351\206L\003\263\260\346\r\236f]\336(\306\216\316&+:B\376I\361]\036n\310aD\253k\013\364x\323R\3214W\332\346\272\231;\235\0223%\235q\307\006\3513;\266]\212\217\330\266y0J\032\271\306\302\355c\026\"\261\252\206\004\214\206[;\252\205\216\255\314Ecc\265\375\251\337'Z=\032|\312I\364\304N\006vV\371t\3033\025\221\246o\001\233\305\342\037\035\222\323\265\\y@\036y/\333c\2717\244H\333\272\367x\2015n\266\214M\207\301\316\343\235\256\335V\315\214:\262\277\003)\316\010\333\246\373\022\264\230W\267hr\022\307\323\n\237V\310\322\367\313N8\326a\227v\362\352&R\035\312\215\266\321I\346tSQ\220\021t\300\202\310\353\024X\360\2474\302\272\021\273%n\334\346\2331f\324+\337JOD\220\302R\264\3366u\206\205\032\313\242\216\367YC\031\260\357\246d\362\207\023\226X\032\266\177S\3112\377\001\"\331[.\024\"\262+\031\305cS-\346\347\346\325\031\253\335\2379\2319\303\342\206P\255\260\242<\023\334\222Pa@\274I\224\221]\362\207\237{\224id\371JQr3\356\036\3475\302\243\010\313\301\327r\253L M\362\206\227\267\024V\241\242\024""\233\312\2315w\255dV\361#S\312\243\313D\215\2076\351\230F\272\006\277\225\0368\212v\307 \246\rF\235<\223\352e=\307|\340JT\256\030j-%\332R>\201c\232Z\375FW\262VL\263\026^1\211\n;\231\220\025\365k'f\337j\312R\234\n\331|+\267\267oUu.W\324\035\246\255\353|\377\322y\303\326\377)\221'\220=-|\036\217\224\237$B\004h\253[\3207\224jr\346\2459h\363@\362\323\230\371\200]\246b\250(.\243\264\312\031'%\214<L\334\303\305L@\235\304T<K\2216\202\203F4rTp\222h\223\367\226\244\322$\006\271\037g\373\275\375M\005\204\030\026\272\213^t\003@=\377}\265\3060a`\302\302\300\260a,#\233\"\302\261`,\213\005\217L9\311\013$\227\302w}\014%\200\3063\226\272C\305\251\203\0023\365\332\210Q\021\004T\325\"L\343\037\177`\323\302\275\314g\336\364\003\334\316\305\263\216xM C\230MTV\213:\230\177m\264\255\242\335\273t\374S9$H(\220D\031\21333\274*\035\241H\324\213\006\325?\177\014I\004@D\263\224j2\345\356h\265\314\347\214\320FjF\034g*\331*\004\212\255Z>\252u\251\217\353T\354\346\321\340\267/\213>\332f}\333\233n\233\010\235p\204\244\360\273\251\352Wz\345\370\372m1\306\373\346[\245\322vZIx\361;,\366_Y\367H0J~\254\023S8Nr\316#jg\306\320\266N\366\2744\341\252\361\230SJ8[,t3\341[\206\300Iui\251\260`0o,\306\027\340\332\301\361c\222\262\225Idf\201\3423\353\357S\246\212\305]\247\245\254-\006h\234\035\014\241\255\252\020(\371(\274?k{\345\t\0149\232k\263\300\272\376^\034\327\016y\342\026\353f\261\232\324\314C\213\206\224+\210\252\257\325\242\203@Y\337\303\307S\307O\255&.\317\005\027\351\254\227\356W\314\250+\264\266\356\223\\\262^\006\023\036VIo\3670Pg\350\214H7\023#P\322<\013\300\375@x\304\224\202\361\211_\276\006\264\216\301|a}\255\025\27213\244\333\275\206(sD5h\241\360\352\263Y\021\201\014\351,K\210\245)\"\204,;\340C\303\260\212w\253\266y\031R{D\037\335\260n\227dc\355]\016.\177\031\020\356\320\336\255\304\013\251\276l\260\33062\222\265\260:+\313\223\226\321\006\211I\032\006\236=m\250\366\321i\203\257\322\373\377\366\330H\331\006\300l\226\336\347a\205\205\330\032\035\236\\\326bY\240\315\031\201\331\362dd\237\313\363.""\027\025\305ut\177\236\271\031\004\352\n\2408P>J\"a\3273\352\265jfR+\322\246\251\242\202T\002\201@.\370?u\022*^Ml\215\355\365\345}\376I\364^5\005\003h1\333\370\254\253\2548\313\002.\362a7\272`h)\367\264\213\201p\033\350\341\241!\301\365\267\373\231l\323\361z*2\035\332b\231Nj\213\367\3742h2b\005\001\376-\276\206\r_tuY\n\027g\331\225S\354\036&AF\325\362\377t\273\356\026\335\0064\305\315\363i9\030tl\341^\311YT\225(\006\2645\206\237Y\323x\267\256\274\013\346\\\223L$\347d\343\211$\242\350\206\007\366\226\336\372\026\3551\n\235\337\031qL\273\271\004Q$\006\224\372\t\345\355\032Nh]V\357l\271\336\356d1i6\233O\354\360\037\201\373\237S\247\0034\214\320\266 +%\031[-aQ#\010\343\n\225N\361\353s\217V\031+\373;#j\275\314\374\227;\001\023\241\247u\237+\312\"P\224%\tW\313p\227\r\322ff\030\030\332c\341\210\302lYzX$\260\365\202\302V\013\n\300XF\240\026,j\027H\371\255M\226<q\306\"1F\"1U\267\216\262Q\2545\232M\206.6\216\205\210\305\032#Q\221\310\253\013\356\226\261YFV\330\216$\032\006\210\323CAi\237z\306y\036\327owg\177Qu\341p\270G\007\007\034\033\356\035\201\217YEV/sj\263\207\334g\374\316\264\361\252\223%\335\352\265\17718\203\334\353t\244\250\224\224%;\373\375N\363\274\262\261`\231\341\341\322d\200\201TW\301\231\276\256\273\267\265\202\313}\366\3174f\243\254\304\223\007\332\321\352\373\266\352\274\315kcY\\$\013\026\n\362\251\312\365\315Jw\352$\214\317L\310\252\251\344n=>\236[\363\223\363\316h\340\343@\302;k\232A\234\266\364`/L\260\233\"fb\364\223\347Z\265\305F5\367\233\326\342\275\375ej\025\210f3J\226\010\352\003\235\036 +o\267\312\244\276\352\336\307|#\013)$7}\\\023a\020\ta\t@\344F\270\222\002J\242\030\250r\246\"\003I*\242\226e\002\022%\200\3020\222\376OGL\n\350\302.\222\270a\030\320\257\307\252\374\307u\tx\274jd\242|t\340\357\273\333\3457\022\261\255\n\332\332\302\276\361\326\312\366\211\232\345a\251\226\025qTd\212\305\306I\230S\373o|X\335;\265o\353\300\354\010\361\312\205(\211PJ\022\242TJi\206\212\227\300\2230[V\325\244\225N\356\373_h\305\030\2437\334\3306^\207\306\266C;\033\033""\006\311\035N\262m\r\003\343\32455:\354m5~\236\010\201\242\027\263\214`F0\030\302\307?\030\330\034\347\235\022X1\214c\007\375\3602\303\277\014\3746I\031\031d\2622\3106<\354\262\353\364|\320\333\373\003T\203S]t3[\301\247J\374X-\367\243F\374\315kE\001\277\277\305\255\013\357\214\360\2220\332l\027\006\323A\305\370\277\030q\246ffzs\021\302\033\377{y\367w\243<0=g\204\370\340\363\037X\315\007^\267\306|k\337\375\350\330\330\377|\304g\341k3rdy\353\333\026Y\016\217/\344\203\372,\316p\363,\214\003\357/?\2748\226\323\240hE\336yB\317\272V\241~\037{{%\006\241\230\357\310\375\014\243\014i[\347+\357\301y\256\263\004{\"\353:,\226\314&\207\242\221K$\262cT^\033=\022\244B\260\251\030\036y\016\"t\273\207\350\264\211\245\331\326\025\221yK\261h\301\364\262AypP\314\316\240V\237\327y\210\2112\252n\014\253\007\320\365\345t\2552\227\376\216\321i\300\226\362\313]Y\331\232\355f*\363\213\016\330e\332\301\032\272R\336<#\201\213J.\n)Q\224>.\010es7\265\202=\321\246\350\363\230\223Y$d0\333\272\307\252\303\007-;kBG\236cc\226D`\325\246\255xP\304\374\032\013d\327\270\314\303b\t(f\351U\236e\240Z\324h\214\310\316\265\241\031\251\267w~\022SV\211cc\033\264\305\314\223\027\223@\360\236\352\373\235+\247\263\275\336\333\237\267\272\220\337\177M\317\247\025>\"1\307\250\327\273\020\232\030q\216W_9M\372\363\020\243dw8\347\217p2\220\243\356=\362=\235\020ca\313yi\366Z\251\362<j\315\277\244_\322gb\324d_q\262:\311\274V\262\"\204#j\026\013\276\302\027\270\252Q\233\252Y\"\255\201\256\356\342\367\205\365(\035\262\310\232\\7\013?\002\250\371\021#D\222\363\014\006\205\2140I\206\305M\242d4-\301\030\246\276y\246\"\026\345~\201P\010L\030\252\257\271\\\320\301\266\306\206m\260\022\330\235\267\314\001=\261J_\335]\315\352f\226\362`:Sg2\275\255\257|e\305!J\306\202\341|\316\215\010\206\243U\304\243\271H\023\014\2147Jk\0305\262\215\345\314\250\2114\242\346+M\204\322\032\334L{X\330Y*\007$\207Fm\331\317y\251P\305\232A\220d\261\221-\3504\346\021\004\310J\215\\3$\243p\242\377\206\273\241\323R\0243\210[o\0221w\336\034\310\r(\n\tj""\360@\205\246`\\\3044\366\235L\303\206Ag\"\000\214H\250\260D'\223\357\202\010\007\245\001\353\005\355K\344\017ZG\306|\210\247\313\316\275\036\310\010\373w\275\027\223\243@h\262\220U\005\355e3\212\neA\010&\256ZB\352\206\355;\272\2610\361:&n\276n,c\266\373\202\353ie\221\347<\376\037\007Q\003\006r\360\236\016\217\211Xy\270\310\213\020%\276]\n\251\"\366P\223\277g\031L\037{\006\221~ 1\rKV\314\235WS\000\350\234%ha\227/=o04$}\346\330\007\347\351\263\000\374\355~\t\313N\233l*\273)\342\224\215\323A\310\227@.@9\321\316\203\234\3509\316\223\250\370w\375\215uux\373\313p\363A\266y\347\241u\360.C\220\202\3444\217u\337\313\n\200M\227\301\334\325\201f\035\360\241cc\346\216\240&\373\340\206\3157\335\326\262\320\202\210b\312\342\313\357\020\320cQ\322B\327b\260p;W\262\351\335\322M\271y\213\231\356a&\026\3723\027\302j\"\315\376\374\233O\331\306\314\000\207\363\223|\3061ZQ\022\317\344\034y\035^\r\324\343e`T\242rr\343k\260\034\347^\371\n\220DQ\366\354\250\311Tc\342\342\224\370\326\3141k!\035\201\330\221\330\216\305\331\330v{\213\314{<]\036\333\332\346\207:\240t\262S\276f2\026\0078YbzX\241\202\262\2111e\322\233\0352T\224i\235\014CCM>\246jN\2502Q\003\271\030\026\370$\341\002\332\035\"\371\253}#\033\222j\"\344+\245H %\211y'\003\311\032\033'\034b\201)J\tyR/9\207\236~\223\333\326\373\355\"\225.\020\202\370P\330\306z\332\352T\205\210\243$X/z+VP8'\014\035\225\321}e%l\270\212\326\r\326\005\227\273\274\257|\266\377/Z\353GZ\016\260]h\353K\000m\030K\313\372l\370u\027\034\232\252\206\363A\307\333\356u\352\351\302\355Qh\276w\014\356\307i\312\037e\301\341\356\304\202Pa\347\007z\314$N\352\225\005\353\372\224)\\Z\271I\022\"8\262F\252a\313Ljg`\332\345\2551y\250mP@\205\223\014Zd\024H\250\313\326)\207I_|Y@\344\312\371\272\362\217\013J\024\203)\024TQ\226%8\266j\330Y\314\2362\206TU\252\316\264\205\205v\256\010B\030\026\262A\001!\265h\206l\014\221\212>N\271\020\260l\3235\226BQ\246$\272\260\" \210),\276s\223L\330\332cc\235W\330\356\220\260\276\264\275*1\003\3213\262Qp\017\237jJCI\304n\224i\\\037\r\023\014\206f""E*B\022e\363\207\365\326\303\225^\275\r\224\310\013<\337\n\246\360\204\034\245n`\3663\241i1\3067\264\344NL\200\226/r\233\302\300g\251\267\274K]U\213z\024\222\027\323f\031e_0\263\027u\302NF\034\220P7\236r\336En\200\0176\356\314\267\013\271\307{\2010\030\r\023_RMxG\016\013\337\030#B\272\272\216\227;s\031\372\303k\325\274k\246f\237y&\255l\217\255\226\2759\334Dix7\234.\214\016\024\242\214\215\321\354\241\021\2718\223\244\266\024A\251\232)\036\205\\O\263J\372w\343p\230FG\022H\325K*\205\027\314M\006\221\014\023\262\311\022\232\244Bp-\231\323j\002\230JoS\033\330\365\275\3404\272J\310\310\214\022\033\340Fs\002\273\030/\tL\314\332$\022\\\317\034\344\311\327\323\203:\224s\311\3131\265mu%\017\024^2w\355\342\320\324\232\232k\275\347S56wy>\222\031\334Mh\206\rLcT\320.\204\337a\021\350\212D`\243\361\265\234\246:\330\234Ie\260_\n\3124\245\026\231c\273ON\212JY\355\033\033\006\335\3403\237#\177\213C\220\320\201\320\320\335\242\3778\214\226\367\250\365 \365/R\017Q\351G\244\364\207\334\367\376f\366HL\017\275\246i\237\001\304!o\22220\223d\253\235\000\024\020*\244\307\017\025\224\216\021\2409d\002\313\224\200\322i\036$\250\221)]m\316\344\304X\216\210\371\201\214\251\010G?\373\004\325\355V\253\022\027\264\277\277\367l\350d9\321d\303N\030A\31631gR\360@\225\002,\320\274+\327\222\275\337\025\362\370_\315\275\317X\367\272\241k}~\327^\263\254\341\0228\2567\364D\304\340&\346\242\253\007\002\2014\210\342\344j\241h.\326\0347r\025\301\004H\035b\007\016\2443\002\251}8i\267 \333.\005\021T9\020\220\301\220\2239\356\004\301\201p`08.a\315x\331\331\305\304q\005\203Cg\006\362\360GK\t\003\210s+\325\242\306sE\234\326\023\333\r\303jt,&\313\0039\001\304\327\251\256.\375\326\033\322\222n\224\356\210\200\202\2622I\2317#\344\340\031\006\035\354cL\303\301\204z\310\"\010\220\231\317\260\236L\224\312e4\304\3014\3011\203\265\245]\255\3666\357)\007\264\371\315\270\034\247\257*%\320/\202\006\004B,#>1\210\341:\353\201\352e\226\2200\261\232\217\tU\3202\223\317n)f\"\315'\350\266\323\275\026\010\252]OP\356\350\t\010\257@""h@3\315\244\315\007\277M\226\n\324\306\320`\030\000M\030\020\035LE}\203\001@\226\225\3412\202\210\340Z\333m\301+u4\230\233\006\005X\026\265 \246`E\255\032\351R\\\265\262\352\310g}\212\362?6\214\303\034\367\255]\203\n:L\311\300\356\024\216\302\r*2\322`(\256]\266\212\225e4\236-\021\214e\021c\210/OH\321\315\276\264\241I\364;$\223\211\275\203'\031\311\300o\304\024\202\014\221\021UD`\352\001\334LC8\217\217\217r\273\265\337\021\257\200\314\\#Hm&\373\214\006\333C \203\340d\347\030`^\255\341\025}\247\005*\264\241\243~\301B\325\325\n\237\226\321kl\312\335\334-\316\314\323\033v\273Pn\226\311V\342\274\351d\212#\202\361\220\234'\007\006\304\214M\342\034\322y\213M@\336\024\035\344cm\247\212\2218\247D\363\2312@w\024\274\321\347\335i\200\200\354\002z\245\321\017n@\362Q\211\024\304F(\300\332\215\370\364\2276e\2458\304k\211\342\270\314\300\311\220\303]t)i=\203\302\347\240!\256<\035P<( N\0348g{\377.\003\264\301\"\260I%\313D\222p\365\"\336r\223\310\362:p\235x\366\217\025&!\206\226\217\204!`\244\304\245*!\034\314L\\\021dP\216\016\306$\301\223,\305m\2107\0166\271g\364\016NO\234`yU\250W\254\024\342\216\255\243,\215\311]mK\035\200x\213\322)\031\022\245\351\2328\24552 \0231\365!\247\340\310z\256D\374\240\270\301\254P\336\345\n\213;\220\035\246#k\235\007\247ZS\366 \240\323\006\364\260\262\255\3355\3079f(\331\273\020\217\236!0\r`\326\350\376\353&\330\004\353-\210\036s\366\004)P\340\"]\017\301\023\341-\227\263\3548\265s@P.\241$\016t\350p\207\031y\022Xj\302\220\346V\363\3005L\006)\322t\224\010\256\315\036\373.\327\341\003\303\301\313\275\\\372zajc\314\031\213\024-4\033\n2\205<\362\202@\233\250\"X\205@\247\274\345\034|P\351\362\270\030p\356\330\2601\2415\3065]\303(U\027\355\212\027\3247\331\037m\226\367\236\354\322\350\227\223\"\322\223J\030`=k\333\302=M\220.\206:\221d\3112\030\032I\260\300\340\033\270\214\352\300\374\020pZ\364k-c&\205$Y\003\007\000\342u\273\230\336\033\3060\326\020y\301R0!3|\220#\364\320\2031`\364J\006lm\031\266\224X\356\242\2261AY\004\024c\020\341hK\034\354\323\246\316\206""\262\270\265 \334$d=)D\304u\016\206\224\226\223K\265\005\243j\305\005xV\335\334\255*\322\317@\002\347\302\206<\307\223\310\274\237\007.\255\376\207\213>\037|vN~$S\236\007n\313\274g\231\231e\2461(\276\300\330\312M\221\311\020\262\335\r\230\014\t\221%S4\244A\022\360P3\214\207K[\r$H\363\331R\"2D\323C\307\270\204\312\035\3766q>\355JM\312FH[\317\034a\372\367U:\026\022\315\000\210b\205\336\212K\210[n)\365\355\024\256\253&\215Z\"\312 m\\\342\231 M\265\262\364\243M*\270\207\027-\272\302\360\3546Ft\022\211\002\200$+4n\342\252m\210 \231\235\020\005\305^xR\251\255\241\313x\263\305Ua\212\th\016\206\373\010\360l0sc\030\207d\203\020FDDD\026/\016\316\021s\006\212T\316K\213^\275p\356\013OI\277f\255Ch\0345\t\261\370b\252\202\214w\020\263r\230\201\323\333\247'\026\232\352\023D\030\260\213\004\202\310tS\210\305\220\022\226\232\006\314`\034\210p\355\235\247\315\360\221vo\\\246\304\030\014\025ui\320\006\301\2024\347\250\037\247\342\356e\244\350\340O{\234\307H\203\210f\247\246E\366)*U;X\244\325otB\335E^\377\252\016\231>\274\231J =S\300\335\325I\2320B\267\032\"{|\373\314m4\276F\200m\002^\260ak\274\274\022\013\204\0245u\"\360\332\232\263Fo\327Z\212o\006\340ad\346&\362<IR6\325'\034-:])\244!'@\354\310fB\362\214\212RtvB\034kK\202\346\367\256\013\3236f\2061@\005\300\301\264\004\2370\316\350=\224\217?\027\004\356\0335\034\265\247\t\305\323a\341\351I7\303\302\222\204\360\006\035\022\326\324\021\224\225\350\006\211(\333(\332e\"&\023\364L\2459\302\252\220l^:\252d`\n\316\345\301T\256l\210\251;w\336`\302\244\027^%\241\205W\000\231\265\327\023\253\021\030\002\250,\024M\327c\010\311z\266N\377t\323)\306\022D\322\030G>.\370\373\275\350\016\301K\217at\033!\033\353\221\316\235\3626\275QGk\202\355[\267o0\301\245\200\234&Uy\274\335\317\303\243\300l\303\222x\351E\337\3345:t\316\356\354[}\265*D\361\354\336\233\270l/\251@\340\027\017xm\244\332\037\332\320\003\365EG\301\335\232\022\345\274\223\353\3430\271H\320r\371k(\2735\303\243\001\252R\330r\315\235\352\233uy\257P\031jv\034\314l\317\203\"Qnf\326\267\361\336""\261m\256\316UR]09\006\312\327a\217\235\362\327\262Y\301{\026Q\202u\223[I6SP\3163\223\026\216\003s\203\035\260\320\276F1\211\024\277+\302\3558\356X\306\212\216\252\004\256\007\301mq\233\322\266\356[\332\356\306\003\014\354L;v\004\004\236\277/\302\210m\240\366\002\\\224@M\021\361\001\341\003\336_J\265\261\323\2603\330n\273/v\260\312\334p\202\r\230\177\260\304\241;\252[t\225\231ZKC\241v\253\004L\005\304\346\234\325\356v\357]\355\301\264\323\032\232h\360I\016%H\262v\032\304E \301 \300\210)\020\004\210\212\017LJ[!P\335\327\211\006\335\006@R\nr\326\263BC\220L\250?:\343\212$\322<\243D&\314kI\030B&-\335\215\273X\200\230\266\331\221\222\264\t\"\304\252 \247u{\200\236\\\002(^\362\\m8\213\355x\321\345\010w\322\031\344q\\\030K\251\311Y-\310\261a>\337\206\212\315\2367\254\310\273fN\020\014\003\031\201\204\244\233\211\031\004I.<e\241.\334\262\025'!B\004]\374 \034 \251\022\351\014\325%\200\364Q\360\216\376\234s\246-l \222\3502\240yIT@D\230\351\014\325\201\332\316\252\250\303,\250\2739\356\201\267\250Y\202h\221@\247h\354\001\327'X\223\300\013\241\246]5\025\355\035k+ \332zO\230;2Z&\321\023\236\r\347\215obx x\200F\217\224\274\224\024g-\274\304\020\225a,-\232\020B\325]\265)Z\270m\273\226\004F\263\026:\302\221\240\023\322\035\262F>=Bl\025\2614\314\220\357n6Q9\213\302\321$c\003U'\331\234`\235\210V\316(\266r\332\\\177\023\325\233\347\032P\316\027\244`\317\006z\254\313N\366\036\320\245];Z\022:z\342\301\212\315\027\357\223\355\230\205#\272\244\236E\006\220\376\364\235\261kF\021kj\265\026\375\246\363A\311e\224\006\252j\263T\215/\254Z\322+J\306\036\341g>jZ[\233\3129\r1\342\2135h\215\036\032\316vw\346\217\021L\271\240B2\230\214v\276K\271/5\026\353. \203\340\023\005\276\357\212\267A\221\344i\354\007N(p\314H!(\316F\223 hHn_\266^\325\243y\275\316\356\325\312\030fG]\374Cf\025}L\367\226\"\376#\267&\030\262\254h\356\325\361\312\261z\335\312\313\253\327!\263\316qe\3322\342\232\002\316\315W\014\206\240?FH\345\014\310\243\003\247J\274E\035P\"\303 \204\224\004g@+lQp[u\014\033\203KG\222\352\262\225M""\200e|\222\364\326\r\nJ\204m\222 \364GJF\222\372a\271\022W\366\362\007\272_\212\313&\367\323\r\037\024p\225/\212\351\346sv\355\244\005\252EC\322\3164\217m\347\342\363y\204\274\300\274\313\314\227\221\036O\031\313\275\337\361|\232\016\206\017`\2676R\0212\245ou8RA\336d\333jR\244\030\222(\231L\261\326\231\035\006e69\221Me\2104a\352v_\362F\030X\025\263\013\367\342\332\rh\315\003L`mT\311\2015\t\304\330\251q\205scC\262\274`\010tZ,\212\233\007\001\032\253c/C:}\023\352\260\245\231#+$\347\310\327\311e\251\260(\020\230\210*)\202\202\204\027\2565$\227g\303\\\225,m\003g\231\r\r\310T,\240\357z\001\336\300\025y\262\275W#\340\007\205n\033\261\"\346\r\240\033\245 \264u0\231-\006h0\032\215O\026\256\361TR\203\006\256\t\340d\260\264;\254FL\034Y\300+\275xf.\276\"H\260QT8\032\324s\234p\264Y\330J\034\240\n\0049M\266\214\230\306\331\002\3570\331\007\277\337\300p7'\0042M\247\000\212$W\272\204{7\226=\227\361\tdpc\032\214\232\303\305\200q\200\232\023\216\354\234b\314;\004\311\017\276L3\022\237Y\306\022\320\022\236\2373wE\004H'\002d\307U\370M\270\206\234)yjVI\233\036\250<KA'\2575Y\010\017\206M\264T\331}R\013\247I\"\315\257d\244wgV\352\010e\221\250sF\250\311sC1P\340\357\016\242\204\226\223SL\322\275\363\017\215\006\257\032\3613\035\2574\020_Z\007`a\004\006\235\0035\274/Z\370\234\270m\313\324\030\207`\007b;\004v.\301vv\007\244=&\235\315\375p\263\354\245}(9\327?\334axYq\006\362\014 Qh\244\271@\001\347G\333j\304\207\300rY\314\261\303\036\033\323Bo\235\n%\003\353\201}&\204\330v7\246\000+\315\352\353\273\265\006\200\326\230\224\377\034\245\243\244\250\264\005\205Y\331\324\203E\205\222ma\307\006\372\016\006\254\027\006&\346j\023\314I\030\304c\267T5\356\261IpD\244\322\213c\323(\225|B\304\221\2101%\213\0221b\014Ib\355\310_h\234\355@\036\322\220\036-(\020\014\203j],\033LV4J\002\266wY\023j+'\225p^\240)b\204\245d,\253)Y\021eY\013)\026K6Q\r\223O\021.\261]\025\320\314\030\330\306\252\203\247\207\216\214\360\206\362\220+\360\367(\001K\304\310\341d\212D\244\221*\302\221\022\022% X\317\254\263}\236\377r\240""\\\006\006\230\256\3119\316\205}1\360p9p\000\211\004\037\201\211\324t \345\220H\2400\331\320\373\267v\240\275E\317:\210\024\206I\375*\003\241\224\226RP\225J\224\252\365\343\332\321}\316,\374\004\240\343\225\330;v\301U\304\210*0\360\262l\206X:\321Q\247\002\332E6\t\345\260\022\032S&J\333\261'O\247\263f\331\241\253\233\235\375\244{\274o\343\217\251\224jX\367D\300\242D$\334\013\315\3601\312a\0235L\363%\016mx\246S\023\010\231\023\ndLLk\346\331\233M!Z\211\326t\312\252\250\033\033\013cc\326\024M\366\354\366=_X\341y\372\232\245\2522F\231\257\233\336[\320\002\326\n\361n\r\313\375\035\362/b\326?\023\276\353\217\257\357\\\270y<\253\023\373\223\\y\307_\271V\\\332\037CH\323\347F\3253=)mS!\233\023V\352\032P\211\020\243\020\226\355\333\245q\231\203=\177\233\2760\377\210\316\323\017E\243 \244\363\206\310\333IR)8F\006\001\302(\240\211?o!\247D\301\247\373\034\003\020b\336\204vO\206\257\342\022F\027`xl\215\007f\321\212\024=:\026%\032!\277L\216V\345\252\001\242\024\t\023\201\326\203\353\240\231e\034\331\232\020\206a\324OS\020\271\213\033\005?\265(>\211\350C\313\232\007\274\374^\267&2L\346\212)\\\230\263,\250y\235\200|\243\266\3421\376\226L\343\302'\326\241\370\361\257\2108\302d6z\275\277\360zQ}!.D\177N\245\017>\314\352Zc\026e\033\316\310\212\345%`\265\006\030\021\"\251F*GH@\022\026\354\005\031\341\317\223\352z\177\313\324\361\277\257\253T\300!\223\310a\227nn\365\225|\326.\31486\032\010\206\211y\230\203Xv\302\035\007\314m\362\237\325\363d>h\231\275\265\023\356\216^1e\247D\244\341\355CQ\004\301\210q\207M\371\333F>\254;\273\177oG=\237\315f!\334=\027<\364\354\275\rC]l)\225\226A\372\256SU\324~A\374\377\313\350\017\364Zui\367>\274\037\367\3760(\272.A\0323\224/\332\342\321\365v\364tR+\020\331O&\177lY[`\215-A\372\311\001\307\230\237\330\336\020>\233\203zJ\022\371\344Oo\351\036\221!\207\037\351\253'\360\375Cl6\231g\327;3T\t\221\262\266\003\222\3134\220\222t\373\000\222c\357\027\025\372\017\315k\352}p?\320L\307\352\372\255\177\210\335\343zm\234\231\234\215\017\333\261\364\247\221#\032\251{\232""\262]\216\330\230q\250v\324s\r\000\206\023'p\207\2038\232h\270\247i>\243~\037\277\333K\347y\354\371]\344\021\261)\336\230\235\357\211\202a\302\006\300\300\265t\210\264vL\361Q\262+D\323R\304F\035\226\3013\314\315\217\032`\374\001_\223\353Sw}\246=1\336\273\264\335\345\025;\024\261\233\227\223\255w\232\002\373\367\030\241\366\030\307|\026\315\2336>^]\234Z;!\323\355!\341\321Oz>\301\031\020h\314\201k\262N\337y\203\266\235\036\247q\247\335\212!\240\232@\235\277\361F\344n0&gC)[\2238,6BNt\365\225\370\262f\013P\237c\303Xk\370\325\303^1D\373\337k\000\277K\376`\374h\\\"\016M\343oj%\202\002\027\024\231\211\304s\\\331f\034\266\310\243#\263\362\243\234\306\021$\004C\274A\242\305\037+`\305[-5\222\331\007x8\360nF\356g/\034N?$\230\346\2109>\265\244s6\004\261\221\345\264\233\261\345\253\016\264\240\321\244\306\212\352Q\t\304\025\212\233\300^j;\307w\335\357&\3538\224t\367q`\245\323s\216C\251\3544\323\022\264\274=6\274\363\214\t6\r^T\272\323\031O\002\025\016\361\335\356\256.\334\267\313;\303\271\357\177\346\177\330:\361s\276\037M:\027)s\250\206O\021\310\230\322\242\341\351\017\004\027&W\274\315\366\2157\360b\035\275\341\307\314\342\315\346\273\341\244\240\267\352\276/T\236\315\370\303Mb!>8\361\226\233L\367u\233\377\35241\224>\301iS\214!\353n\377o\331\334\335lu\333Y\305\377?-\r\035\257NQ\216Q\2561f\255\257L6\271N\327\264G3l\351,\373\032\311\202rt\205\217\021SJ\r\235]\316\367WW\245\307\3358\303f\351\347\017\313<\342\024e\330\344\223t\263\244\016\214\2335'\004\026\346\272;e\317'w\274\351\350\36097Y\313\034\274\2150_\256\264\244i\214&\326\236\335\341\3330\352\361\244\353C\232a\257\247Y\337f\357}\361u7#\177]\234b\252\207\036=\373\226heN#\222\306X\246\203\373\317\2551\250W\013\343\275\273\333\267\220\306\350\342>]\341\270\374\t\025\267^\316\256\246\363\367\271\337h\365\237x\344p\231gz\206\366\001\371\220y\001\253\207(\2501G0\332\361\314\330'\3241s\273z\353\353=.\033\375w\347\237X/\246\245\327\302\330l\245\224\272c5\236\2326$\311\332\301M\202\232\366:\271\267>\236\357\336\336\205\353p\341""\364zR\216K\224+{\351\254h\3356:\327(\323A\031\22242-2\372l8\362\357\234<r7\224B\210\361i%(\340\267\254\023*\372\323\351\027R\351hu\263\344\346L\347K\356p=C\326>\223\016\302\334W\350\0237TT;[\236\336\t\204\252\333\237(dD\241z\347\016\001\277\251\367\237D\236>\307\037\327\202\371q\276Zge\246Q\313B\212&\335\323\031\t\311\203\304\353\357\257\200\270\035I\267p\241\305G_\023\002\366\020aM?\376\330\342j\312*zt\270\037{\034\376\026\347\340}\243\224\237uC\366\020C\016QG\203\027\330&tk\330_\332\214\335b\270\3609sg\343\301\207?L\034\321\"@\252\273\023\343/\341\256\207\352\341\315\237\356#q\301\271?\266\366G\034_If^U\217\322I\243\236\217M\331\341\315d\377v\346\273:\372\3738\265\007g\217\320\242\261]\212a\342\351\031\326\374\017\223b\324G\354o\013N\301\362\033HIxv\366\244s\304\352\017\013xzr\354\256IX\343T\263\207\316\346\3218\351\340\305*\0252\276\036\317_\331#\210s\237\233\037f|\036\n16v4\277\252\274+eT^\t\373w||\377W\210z\263\331\322\356\337\300\213e\352\301\341\350k\032\343%\375\354iGa\321t\370\213\224\221\303\261\347\237\241\024\233.\034\216\313\016c\364\304\031>\336\376\263\255\216n\347Zy>p\376__>s\"\324\037*\034\327\244e\373\333\315\374w\256^[?(\345Q\005\323L0\260\316\216^\207w\253\177.\371\036\314\315\034\267F*-yE\326q\\x5HV<\336=\337\365\355\356c\273=\326\236+\202\371\360\3747\225\005\305G\002\212\272\323\217\311\356\367}\217\273>W}\367?W\007\310(D\360\322\375\232\016\264\035\276\343n\352;\314w\376\033\252h\235\373\246\232\260\272\276\347\247\270=dn\356\235\352;\361\274\323t6\207\307\305\031\365\322\215\275\376\346\375\336\246\376\376\345\004\240\302\352b\007m\361\333\364\375=\336\241\337\335]\3453g\330\315c+\277\220\334Hn\355\367R\022\363{\215\335\034\230\374\003\233\267>\033rx\3527\216#\177l\355\374\355\346\363\270s\036a\272S\227\231\367\374\254\250r\035}\035]_\367\3169\335]>b\032\014\207}\016\342\322\351\370>~G\315gr\374\0169\301\231\272 Ny\212/\364C\233D\352:h\374\334\347)\323\322&\037y'\334\316wc\351\341o\233\234\312\377\027(\303\274\220\256nd\307\242\007\376\037""\032\345\3468\216Ts7#\3209\334\25499\216Z^\270^\337\373\261\234x\323\351\270\216S/#\307;\360\020\036\276\035\343/\331\225\374\272\357\017\302;+3\360\256P\245\323w{\205\334G\033\356\342\006\372>\2563\257\350YW\007\003\333\374\207\317\310\320\231r\355\230\227\347e\177\205n\300\313\207\217}\360x\341\034\352.\337\371\013\307G\217\200a\316_R`\202\027;_\323\271\271\270po\357\261\350P9p5\006\372\367:\367\276O\257\305\227\207\202\002\025\002v\356\367\210s-\306\335\335\2018\201\314\276\317\013|F\342\335<\346\367\2213\014\231\367-=\355\276\361\342\360m\370w77J\007\235\370Z\035\357\261\341\246*7\253\332\305\345}\355\275'\337\332d\376d\207\243\220\256\345?V\023SU\257rx\303|\256m\021\363c\306k4\200Kt\273k\307\273\235\370\306QuT\300G_2\204?\253\025_\223\325\350\247{C\007E\350\243\257\0057\271\340\3776s\374\215\245\001\351]Tz_\357\273\323\360s\236\277\226\371\007S;\246\027vPs\014z\212\274M\312}<\257\014\3030<\303R\356\267\033|l./K\226\037)\333a\231~V\016\2008\330\347\366\323\031=f\\\276\240\266\303\014D\0321R\207`\353B\037\204N\374\341\254j\201\321\350\t\272\247\370\017\262\016\212g/\021C1\034\260\016\200\363\305\340\t\306@\321S],\037\231\014\220\177\260t\323\010\232_@\032\003\232\035\205\347\236\t\366\036\006_l<\317\240\227\320\377\017I\275\367\303\202\346)4\323\236I\325\357\360\022\030}#\346'\207\2379\374\3455\"\330\333g\033fW\225ws\031\333\215\021v\362\240\205N\353H\312\2071P\211{\263TRQ\344\220\317\254|\275\225\246\250}\215\244\354yd\025\256\255\002|M\371\225H\313\205[\333\315CO\341\254\305\371\332\377Ekz@'\217\227\361km\276\247\213\211\221\347U\311\330\232\230\376\267\"\037\346i*\345\262>\322\231K\366\335\355f\237\340\370\363\241X;K\305\331\217\215\215\233\r\\5H\311\036=jb\310\254aC\322\035\331\004\274|\n{-\351\223-\237#5\212\332\363bD#\343|K\245{v\037)\004T\266H\333C\276*kf#\024\356ZS\201\324Mb\323b\242\0214\266Eb\235\356jq\224\312\335\235>\014N2\363*\340OK\336b\356\314Z\303\303\346I\370\313\002\303\377L\037&\363\256\237\325/\032\020V\307\326\355\\hN\022\270\364L\322\214D""\031\211\272\361\010hX\265J\322Ry\224\036$(\341\035\375\222U\255\002\327\222\036\344\307{\252R\004\311oo^>s\2060>p\246c%\017\035\311\302\267\274>4UE=(|\307\223\214\021t\261\332\371\032B\232\310'u\251\tD\346`Nye\310\240\227?\211gf\216\227\214Fu\222\001X\343\3113\244~\356qO.Q\360\242pMd\305+\036>-\371\231\241f\340\212\231\316\332\225\332T\233\030\210\036\232\204\224\301\252\254\025Z\257\231(\017\222\362\3475:\351q^/\276\357\257Oy+P\001F\001\333\277\325\332\273{N\323\265_\263szOf\250t\333\350\340\266\255DB\010\254\334Y\023C\354R\277\376.\344\212p\241!\244\017\212\242";
    PyObject *data = __Pyx_DecompressString(cstring, 11465, 2);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (12231 bytes) */
const char* const cstring = "x\332\335{\311\177\023\307\3266\026\006\314\214\301\030c\206\310L\266\211qb3\373\022re3&\020\260\261!@\210\322\222Zr\203&\253[\036 \2717K/\265\354e/\265\324RK-\265\354\245\227\376\023\370\023\276\347\234S=\310\226\t\311{\277{\357\373\346\027T\3255\327\2513<\347Ty\":6\256_M]\323\367D\361_,aZ%-iE\023\232\251G\223Y\3154\243\351B\211\376\3454\3132\362\231h\261T\310\224t\224\247\014\263\230\325V\242\205t\264P\264\214\234\361^\263\214B\336\034\225\221\262Y\264\310\351y\223\312\320KO\352)\352\357\027F\317\247\242\271\262\211\271\364\250\221O\351\313z*\252\345S\321|\301\212\232Y\003\315c\371\250^*a\372B2Y.\241\032\235\014K/\361<\321I-\025-\026\214<\nF\242\311y=\371.\232\\\261\346Q\223,\244d;\336\177\027/N\352\226\026\275\247k\026\306\271x\261\245\262\345ct\224\346\327'&ZJ75\243\377f\347\rS\221\010\031\263\234x\253\203pV!Z\322\212F*\264Pl\352+l\242\244\347\n\213Z\026{\3354T\272L\353\212\346\214<\332-\352%&\217\221O\242\213\236\267\024E\333.d\312?\242b\266 \007\024>\214\340\264\220\307\tR\243\254\221\210j\313\372\247F}\252\225\264\234\216\r\230-\305\227\374\377\266\356\n\376\321\265\334D\364\216A\314\361\000{\317\352\233\366{GXGjy\365K\363:\010@\3133\243K\006x\007L\241\030LO\265\364\317\227\nK\023 \2165\302;-\344\265\354\246\361\363\345\\B/\021g\242\261I\251\214l\344\243\205\262U,\243\2575\217\t\364\264V\316Zt|c\255s$\013\331\317\237\003\215\313\271\374_\230f9k\200RV\271\230\325_\207\1771\361\257\351lA\263~\0055G\242-\237oFFGG\345g\363\222\260\333\3502\257\036\311x4\257\233\026\244\206\00751N\n\314d\244W\210I\300j,l9m9\n\246,\353\346f\246\304\261,\203S\014\336Y\306X\324\363\321\327\230\341\315k\214\377\206\267:\032}\230\216\016b\254\301(\032\017b\260AlY{\267\371\304M\r\"!\023\021y\264RI[1G\243w\2104V\226HC\323\215-\217\311p#2X\273\245\255\374\327\023m\345\277\217h4o\374\335\222V\312\230\023\220\253\344\247\030\233\252\251\246\304\252\375\235\276T(A1\2272eh\004p\271\354\tjN[\036\245aI\263\244\215\022\364\270\257\3616\313{ \001z\256h\255\204\346\030\335\240\250\303\213\3344""\216TF\347q\010tD\005\354\313\032\205\346Uzc\036\013\203\316\324X\r\032y\3032\240n\323F\206t+\235\0337k\235p\262\234NC\212\027\r})\232*\200\316d}\364\345b\001\346\017\214\203\3237'\313\330\034,\330|\301\"K\246a0H7\233\275R\212l\017\030\205\255%\233\240\225B\271\024Mi\2266\245A\013\344\263+\262\", \232\220\271\254y\215)\221,\200\2612\345B\231\0177\007\353\000j\240\027\255\000J\335\3100\225\3219u\211\307\221\026\264R\325(\t:dtV1\20122-Lf\376q\013f\250h\016\2262\373\351\306\244\316\2715U\264\264\227}-\225\014KK@\215\313\372\204\224\351R!\367\251\245\023\023A\32228*d\300\304\371B\376\022D\326\343v\342\353</\224+S\272\245:\316k\341\216>\307y\033f\034\001\003b\315G\255\225\242\036\035T\345\246nE\363\324\232G\266\310rs=v\030\336\022\260O\336\344\263\017V,\243a`\243D\366=\3004{\332\330\340\022\270\016\274\207s\233 \0202\361\313\303\247\014IF\225-\033m\261|\277D\013\014\032\002\226\334\363\t\013\334\306\372\nGMD?9\313\236\255-\257X]\261U\304\222\233-\356;]/ND\023\205Bv\013\215\361b^\007c\224h\313\3246Z\310\246\274\001\031\363`\274\244.4\314\353K\243@M-\006\361\236\2265\203\025N\025\362\351,\251\006\3200\314\t\314\216f\210yu\250\3532!?\302\214\326g\364\023\351\365\331ys\177\240\256\014>\036\0237D\223!f\003[\246\243\331B&k\274\2733\342\003\326\261;\3212\370\365\206(\345;8\251\244\205\031\005\307\232\236\202(\221D\3351r\321\257Y]\344\231\341X\2164\350\226$\032\372:\007%\311y\256+\020=M\206\016`DP\020\370\r6\250\255\024\217D\315\002&%j\207\206\344\001\203\216Z\324\004a\262Jz\357\204\361\267!\223\013o\337e\325\314t\003\000\343\215\215`\013\006Va\230fY'M\237\301A\226\023\322\322\234\327 Bl(\231\334\202\276G\271\343=\203\340<O8\342\2213Wf\201N\372\304\346=\204Z\232^K\020X\313\362\351<\030\177\3748>\365\225$\243\305\225\345\207,\341\212\276\t\034b\312\214\016\261\275=\237\032~\270YJ\305\235(\027\213\205\022\314\372C(\001oU\371\002\353\351h\326\310\277\323SL\357\222\216}\350\321\311\207S\334\355]\276\260\224\037}\250\014\tw\363f\206\275\375\212`@!a\312)\217\010l\005\311\231\263\363Q""\254LO\033y\354-\241\203\221\214B\351\223\003Au\220\274\374+\206b-\366'\206\"\356\341C\023ZY\005X\002\3232\222#$\261\252\306\303\344yr\004\263\306{\"\245\317u\313\302p\300Q\033;\253\352v\275!\247\206\234\373\010\031\\\234\032\0265\230\024P\204c\240]\000\322d0\262\327X\030\216\014\027\235\367CO\371O\370\271\350\236 \013'H\237x\244\3473\320<\236\324B\324\311V[\321\313\217\340\"\301\2503\232c\032\262\254\247\014\322\247$3\233\005\215\026\362\371\275Z\365\215\364\216\016=\326\226'n=f\323\362\234L\013\032>6L\021}lk\203\222J\350\326\222\016H#S\r\205[*5\270\261\005'\345\274\202>Dg\321\274\304\347\276\030\222-\364e\360\261\242\314\374x.\027\347a\270\204\367\345Sk\234\211i\266\251\271\3145\342\206o]/5F\016\212\202\374Y8\3150\261\033\312\312E,R\nM0\003\020\367&j\002\205x\232\230=nnf\350\251\037\n\220a>\030\277hDl<\376\327\030Zp=Y\007\336\247j-\306\367\007\205<\304\272\371\206#\236\204&\020\2647(\352S\301u\010\2221\350\023\023\376u\222\334k\214\242\377P\260tAwS\022\207 \213\252\303\335&\226\324\001\203\010P&-\201\200\371\350\323\273O/]\271q\205\271\251\244\323R8\212\300\021\005\235\215V\242l`\262<C\025\223\335\006\240K\310\225\302\276\204:B\035,\202\277t\270d(\006yy,\tqt\307\006\006\225\226'\334\204\336lxG\237@})\031\315\371\247\007%\232\373f\034\252\243T\010\307k\264l\326\260$\334\343\367\342\376\236pE\307\357\020\345\212+Qv\2748XD\214!*\344I8,!'01\021Pz\"\332\322\000\022\000<\315\256\226\221+\347B\274\020`\276-;\224\251\0071\336\223\0263\201V\n\202kI>4\261\033OB`^q\332SV\306\355\t3\006\336*\024P\231_\t\233\031\022_\352\245\272\0060ak\2120\354yF,\013M\036\304\332p\204\334\322\343RA\336\201\200\216\300;\330\312\025\335\323\006;n\300\215\242+&Z\006\334\204\354by\000XZ\321\304/A\273_\210o80H\013\362\226\227\006\351\322#$\232$\003\002\360r\032\221\243\\\"(\355\217I\230\033^c6\013;A\003\224M\201\215\3427\261\334\204\306%\301\023\255/\210]\241\227\000*?\023-\301p\233d]\366\305\226\006\254\r\225P\340Qu\245+\277\362\264\252\207\300x\347\376hK\363\006P\214\332\304Hx!<4\026\223\316""\352\313F\"\004\247\037z\215\363\001\260\363\334\300 \210E\204 \010\274'\010\033\266\000`&\232\034\214\221\217\013\n\230\020v!}\3433\220\202c\233N\212\311\r\205O,\317\2140d\016{{\224\321\270'k\017\036u\204\216\300C\311\240\262?\222\247:L0\317\010$\005:9\237%1I3B\003<\323\331_\030\331\302\237\014<\025\217T\243\355h\025>`\232r(\264\034\342j\320\344\353\321\257\207?\203^\332\362_\245\227R*\377W\3505\366y\364\002\177\t4\014\321\013*\333\\(\323\330\177\235\315d\320\377 \331\242\317e\032\250\312\224\241eh\3412M\201X\351\377;\023\376\317\210\272\005/\3767\023u\354/\023\365\3639\2250F+I\377:\203\322X\377\227\265\340_\242\325\026|\367\277\223V\237\307W*\242\270\325\315\316\017mB\244>T`\354\243{\227k\344a\000,xJf\304\273\270\014H\343y\"a*\264\241@\233\235oX\376\327j\355)\314\3659+\337\034\257\375O/\335\007\246\317,\275\010\306\2238\003V\364^/\025\202\340\315\254\277\336 B\244\245\311]\232%\0372\204\251g=\374\275\301a\306\2469\242C\210\221\"F2\334\347\264f\004W\022\240\027\364\204\337>\013'*;1\313\312X\371\003*f&\032^\310\207\005\253-\001\324\nbU\261\365\226\236\177\302\305\262B\375\324\030\237\347fml\254\014\221\324y!o\2453$\342\237\n\027\013\004jS!\013\332X\241\024u\233\342\366\003\371\020DU\314q\210Mn\371\267\2105\316\345\371v\201\034\005f\013\276g\312\321\267\370\357s\371\2261\304\233\230\3427\000\2276\216x\337\260\036\224\023#\024\017\373\246\245\237D_\260\264\214\236\337r\035\033\332\233E\255\004\277\233\304\241\250Y\363\237\323m\2136C\360C\366\217\216D\243C\337\336\036\034\326R\2518\275A -\247Kt\304\364/*\202\243\r\3742E\010\211K\r\363oK\204#:D\001\231\257\227\305\r\216\247\313\371\244?\212\350X\272>\224{\310\301\222N4F\216\202\035\362\021/dSR@'\212e\321\201(\237:<\016Uo\216\257\250\206\276JM\026r \027\351\r\211M\361\026\374F\236h\266oE7qQ\2614\312\223\237\207/lB\251E\023+4<y\346f\216(\247\256\316\310W\016Q*\210/{\225~ ?d2U\253\264Aw\206Z\362\035\270\302{\225\221\364\356\231\344^C'3D6%\035D\261\203&yn\343\351]\325\006+\236\227\3732\025\034g\206\225(k\020OH\026\262Y=)""\357i\264D\222\310Q\266\324\014\267B7\207t\330\022\327\271\275\261\330\273\262\272=\302\222\363M\240VG\202l\034'?\321\372\351\237\251\000\n\032*\303W}*n\365\365'ZK\240\363S\303}\316P\255m6^\030\320r\2139\237\032\360\262W\242\260:\026\264uN\327\370\376M1\0073\2069_(g)\334\035\365\003\265I]\202\021@\026\032\306\r\005p\371\336R.`Bvp(e\230td\272\250\"_\003$\313%\356\005\231H\226\263\022\207\362+\363\372r\350J\034\274\004\374\354\233\340`\345#{\324\333*\272\307\313$\243CD\300\014\337\311\320\242h7\030\210u\000\031,\377\362\2069?X8o5X}x\361\304p\212\357\202+\031#W,\025\026Y\271\020\250\2102`\240P\256\262n\020\013Ub\376\301L\t\271\036\227\307\t\321!#o\202\370F\222\232\252\033a\025\365I\222\234\220\246Tm\275\226F\320\264M\221\037i\365\207\370\254F!W\376\263\332\207\334\2556\355\331\242\203n\226fnU\233\321r\024\365\372D\345\247G\017\253s\276>\335\252!\237\322\326k\t\023[\305\312E\267p8<N\262\344\313\031]\353\352\364L\201\030\326\362d\002\002S\262FB`%t\017\240\002\361\"\346\260d,\020)2\310\314\026\267\276\201\270n\274\n\014\275\204\343;\231P\0047\372.!\360K.\214\225\205\343^\312\206\220\261\342\256\274\234\222n\225Kyu\035\035\016`\016\205?\250z\2306\325RJ;|\375\365\310\370\233\341O\r\255N \315>\215\272p\322H\364\320\335\277p\033Q\224\235\210\3729Ej\217\262\336\013\005U\314\317%\224\222 T\233!N\261\324\265\214\027)T\312\213\035(\272t\376\234\276tS\271\261\037\231?\322)$\363\001S\211}T\036a\240\035F\030\334\031\254}\274\334\026zxS5\373\"\031\276\273\336\\\243g\360\275y\000B\213\320\246&\207\201\315\rw\206\n\357\312\232\204W\274\334\037\032\245\366\r\325\305\233\347\354\2068\317+\242>9#u\251\345\325\244\217k}\270\3202\231\332\210\327\212\254\303'\266\023B\303[\017\307\rB\360x\353\226\334 h\371G\223\363\341\267\303\214%\205\375\370\000\025\214l}\270\260\361\236[\\ni+\033\332\252\265\324\206\333\313b\267j/\265\241\366\001\2604\365\2052[lO\235S\2776\330\267\025\320\372\261\220\226@\210\360\202jH\000\220\3159!\310\320$\241\0364\025\014\241\230\253\021v\301'\350Z\333\177\324\345\233""\323\274HP\276\235\024\264\026\026\013\246A\232\201^\037(O9\036/\351\251rR\217\307\243\2512{:te\211\323[$\215\023\217'\351>7\036\307,\244~'$\331<\240\002G\371r\"'\236\272\262\314\204E\332\224\211m\037\n\256:\333K\375\346zv57\311_\333vm\224\000\223w\224\233\216\362]\252P:\255\031Y\271\326\0042\201\375\t7+\347\0104ll\241N\37668sb\217\037\265\"\311Q.v!x'&\234E\215\224\243A\302\025\276]\"\324\2631\206\202\346qHW@\351Ap\211\226\225k`0l\252\220\033\204\326\210\313\274^\243\331R\031\374\307\267\253#0\206C\234\033\036\211\216E\207\250j\230\375\250\361\350\220\2627\344\252\310c?\377\021\314\360\206\347\205\370\222\025}\343\337\203\313\331\341\344\255V\275\365\350\321\010\275\264_4\310\007P\226\211\336\244Ym\235>\314M\036\037A;\345\357\221\2331\030\366\362X\220'\366\204\320\324\247\010,\315\266 \361\346\000 7\377C\022\217(\323,\177{\240\366\306\224\022\357\364\022\274SS\317\246G\363Z\000_i\207|k\277r\311s\2350g>\245\225R\262>\032\315\264V`41\374B\331 \306U\013\227\247\256y\313\013\233\245\345\251`\310\263\035\3419\324.\276\361\\[\222\211\021\217y\276\271%\257GS-\036\332\3462\301^\355\352[K\363\031\263P.%\365\333r\364\255<7v\207\356\244)P\305\212tbO\010\315~\352\274\244\331\347\211\004m\221\333\377\341\201\225\363\227\312~\314\306\307\242\312\301\005j\031mS\253\200V>\345=\272E\243\215\2162OiB\362\343\212\340\362\352x\321\004\325\361#q\002v\277\350]=\017F(2\300d\241\207\336\274\232?nF\357\301\271ilr*\366l\352\341C\340-z+8\205\025\231~f\324W\340\002{\343\361p\225\t\317\224\326\353W\266<\301\274\3738.o\333\356f\263F\3214L\326\027R\304\277\230\376\341\323\225\247\331\202\245\022\014)\366`\343\367\350-\"f\326\274=\232\321\341|\026K~\203\214n\305\227i\223^\t?\300\361>\344\345\r}\225\370\217i\202\\\313T\252\310\357\252\276\375\336\341\007\250O%h\362C\301\272G\314u\227\016\345)\304\330\362\272\005\023\220\246\211\307\203o\235\322\226\202eZA\313\364\255s\243re\031\377\356\030I+\376\003\234\345\031=\375L\031\364gVJ5\016r\376\256BE<l\350[F\236\245GZ\243\301{--\221\324\324\037H\345t\3547E""ZR\261p\\b\016Z~E+\026u\3224\031h\013\234|)c\322?\360-\022\216\246\023G\021Si\246J\202\300\215* \205\243\231+\371\244Q\030\205\t,\2207\250\233\232\305nX|<\245-S\320<Ao1\022z\306L\030\311D>\025/Z%$&\3133\377\304!\r\222!\365/r\036\n\002\252\254<\252\307\362e\007\214\020\342\344\316\231\222\245\305\004\2718|\275\242\240\010\222Y\311\261\373\221LR\020\307;\321\244\270\250@\243\006\266!\317b}(\023\260\352\255\254\226K\244\264\333\250\242\347&\361\270\227\001\317\222[I\237 X\\<\304d\026t\210\013\366M\352\tp\031\037\\2\333.^F\377\330%HR\330\316\202\257jQ\026\373\200e'?\230\376\305)N,\037\222r\240\251%,\225,\024W\260\014\365[\316[I\nb\230\311bY}\212xSa\222\265\263\n\013\221\256\023\"\244\364\034\014\017\364\000\375\213\203D\364\307\rqI\310\372\322?^\251\022\037\324\024\222\364S&\357\232\250\316?q\370\357\002zRK:h\214\243W\031:\004\311\202\363$\003\237&\265\234Z\321\365l\236\377\344\202^<\247t\235\016\334\2231\035\372\235\237\246\261\016\007\257\260\362\364B\232\372r2n%\370\027sS\212\nO\034\351\301\346\n\340+=z^\211\007p<md\322Y-cz7\023\351l\331\234\227\000\227\037\346Ro;)\204\304^#\351x\372`\0175\316\234\031\217s\304\204\177$KzP2\340\004\245\337X\257\265\034\025\227\370\023\361\227\347\233\372\037Dg\376\360\021+\177\371(\213>@M|\007z3NY9\346x\010\007\204\262\276Ri)\313i\357t!L\2708(\365[\233An\2635i\251\333dN\002\342\007\271Q\217_[\2126\014\333R\367\211aGi\250\320\247\307 \241\"\377\370Be\376[\337P\231\027\377\014\025\231\3413\014\227\007\206>Tj\025d\032\372\004>\210\033E^.e\203\277n\304\342\001\035\332\030\304y\3642\014(\221\224\221Z\006\253\211#\341\245\3509\n\265\256\221\334\372%q\277\204T\230\322cH\226\361\223\366\316\\\335\006\300t\\\273\242\274\036\025j\213s\252\024\270a\346\265<]\375$X\234%j\246Bg\304\242\314\246\304\236\224\261\n\205\254\371\366m\301\310\277\243\277\253\020%\235\365\324eV\307\224\314M\320\210f\021\223g\263\331<!~\006\375\362+q4\316\026U\002\035\225-\3443\"x9\221\2058\305-\351\367-\235\030X\223\351\215\316Dd\330\224Md\014\361o\220\r\310\037\344F\213+""\224\203\324yR\350EN\374\210\207\022\310 \260\221\312\342\213\376\356&\316\244WV\201\356\247$\332\342GS\374\020\210\334]\361\337\316\322Jd5\354I\311/\231)\311\261\231\212\323z\313\224\"W*\2202,\031\244x\330\033\315\263J W\"\036W\277b\342\010\017\322\017*\241\305\351\376\026U\264J\374\340\177\262\307\024\361gg?/\323\321\273@\372\247,\254/\020y\260C\276\310^<\201MS<w\250#_#\261\367\013U/\332^~i\363\344\222j\331\342\274F\231\004\310\343\371\250\224\302\211\314ip\206\310\365\361\375R?\023\247\034\25126\201-\037\233U\303\306\352M\332aC\203M\212\270M\275\257\226\333\324y\354\261E\025qH\233*\237\\m\352|u\036\366\217\225\002\366\264P\001.\225Ez\036\004R\t\343\036\312\343\004U\242g)c\341l\3751\351N\260H\217lI\236\350_<\020/\225\335$4\\\227g\344P\234'\323M\277\304YH\031F\230~\206!\026\276\300i\370\205!'!\342\277\340\004\320\363Rb\207\320_ur\326+\"\355R\314Z\305B1\016Y\321\261T\2352PM\022\014\340\016\234\203\305W\361\201\\\270\230\276\324\270\336\267\327\316;E\365\t\3479\0100H.\334Q\321\313\313\223\033\313\302+\256?\263\262d\211\231\203x\200\344\230\241\213%\351\232D!\344\026\211U\212\207\246d\r#V \256\356h\261W8\004\362\016\027,\302_\362\0270\222W\206\234\262\014\2538W\316\027\215\344;\250\005\337w\333P~7\357\215\265\310\177\357H\372\203p\223h\t\361}\203H\336f#\356\025\350\313\224\315`\227\204\270\330p`q\364\247Z\340h\203\013Ye\301]\222\000Gp\to\202\243\000/\231\376\246\256\247\350_\221b\037&\341\272\026\031\214\363p\2744\312\221\253K\351\212\244*\362\030\022\354x\033!\347e\230\220+~\031\3616\316\210ML\362\206B\206\275T\270\341M\004\027\005\037|I!J\230\200<\311\032f\241?\312E\002{\033\262\371&\276h9%K\205\036<\210\255\252\371\227$V\345\362\002\331@\324\"i7\025\205\001\307Q\026\\\343\375\2210\030\202xB\204\324\\\301\3044\270\374\222\214[\363\320\310\264\035\336\022\377\320,\222\311+\370\301\261\0265\206\344\271\007\031\243 D\"9>2~`P\316\033$<\340'h\017\361/\313\246\356S\235#2\022\226\361\331xS\006\230\243\260H<\2220\230\030^\236\010\007\251\313\323?\320W%\346\222\221\262\346""\351\357s\365eb\000\262\302d'\227\227W\210\017V\360\271\202\317\225\025z\207e\2767\212\263\037~\236\370\315\335\366u\255\343\343\255m;\366\257N\272\007\242N\207s\254\272\263\232\250u\254u\356\372\275\274z\257r\2662\275\326u`\325\250,\330~\331@\345r%\201O\224\277\265;\354\356\265\316\361\332\300Zg\237\275\307\031\256^\253u\323\307I\373{g\205\206\271T\235\251.\326\246k\351\372\275\306\231Fl\255\363\204\3757'UE\223\323\266&#\336\257\214\255u\035\252\034\264\027\326:\217T\276u\006\234+\3162:\275\254\3177\270\211\265zyU\013\246\333\275\177\365Y\205\247\317\332\003\366\330Z\347\336\3251\336\310\032v\260\277:\275v`\3009\355~\365\367F\007\345\272\327\016\234u\306\326\216\035\267{\335/.\327\306T\243\217?um\333\321[\231\263/8\007\253f\355b\035K;\352\036\035t\336\327\272\335\361\311\306\245&Vs\254b\331\327\334\201\361\332\331\332\253\272\325\030\243\365wW\216V\322\330\235Y\275X\343\317\323\366\373jwu\244\226k\214\321\372\257T\026\3557\325\263\325W5\253>F\243\366T\356\330;\355|u\252\372\276\336S\237\256k\353<\356\230\215\272~\373\254=-t\370P\031\302\3073'L\327~\267\377Ru\272\252c\325h\261\260\326\265w\365Z\345\270=\360q\347\266\035{WG*o\335\350\345\332\355Fw\003\344\334\263z\251\362\336\035\270R{\"\353\334\203z\303\375b\2746\332\350ht\007\337\356\370\335\306t\003\213\210:;\234\347\325\353\265\221z\246\361\223;=#\213\030\264O;V\365Ju\271\266P\017\226\262\336y\312=\365u\355`}\301\375\373S\367\351\264;\235rS\246kZ\256U^\233A^_\357<\260\232\263'\234g\325\216*f\243\263\271\200\275\20439\373\226\263@\231\371\212\026J\336\332\\\013\026\303\t\200\335x\031\314w{W\377VI\202\016\373N\331\323k\373\373\354\3558\354\277\224\337\335]\351\256\014\254u\035\006\215G\034\255%s\321~T\305F\217\323&w\375\376k\345\206}\315\351\253\366\327&\352?7o\273/\337\270o4W3\\\343\255\373\366\235O\217\217`\236~:!\014\274\326\271{\265O\222~p2\222\343\230\213\307\"^\300>\324\256\350\373\275\323_\275]\357\246\275\335\252\230\366\300\332>L\274\266\377\270}\004\354\340\345{\354\237\253c\362\205vWV\337\333\335\366""\220\203\266\207+\303\366\230{\262\340\026\212n\221h\357\226\027\327\272\016\256.V~r\272\035\265\301\001\373\n$\311\333\262\260\353}\347\262\363\026\002\202\317~\034\322\2643_\315\325\307de]\373W\177\244\376-\231W\225_!4j\2741\332n\037\235\317\t\022\267(\035g\277\315R\036#\351\273^\271\340\366]\254\016To\326\356\203\347\0374b\215\227M\255\371\233\373\023\250\227t\223\304\037\"\307\327iI\007 \314\235\264\271\316\256\325\035\253s\320'c\264\260\023v\314\236^'\265@\354\335E\354\336\343\366\234\307b\r\010\350\205\372\356\306)\014\312B0Qy\006\246\331\007\341\206\306\371\246\276\263\256\021m\276$Q\"\276\336\211\275Fjgj\223\265d\275\267\376\336}\370\322}\371j\215X\370\253\352B\355@=\331\350m\254\270O\237\271\317P\361\213\373\013\313\337\362\252I\213\003\273\330\206\363[\355^\235\311\311k;\260\372\016'0\260\276{\017M\216\2239\270\272\260v\350\230{\014:\247v\274~\251\261\334\\t\347~t\177\244\261\\\2158\305}\267\350..\271K\377\374\270m\333\337#\217\"H\036E\346(\231\213\350\224\350\221\034%\271H\236\222|\244\020Y\247\021\205\212\217\033}\315\336\246\351\316\274r_\t\375\344\310\227\321t\245\343.\365\270\033\371\201\222\037\"?S\362s$MI:\222\241$\023\231\217\254\373\213\334<\344k\3675\035\211\253\347\334\334\n\332\277\357\230\242nS\221g\224<\213\274\246\344u\344'J~\212\274\241\225U~sb\316K0\315\215\306\265\346\221\346\003w\026G\373\263\373s\332M\227\334\322\0074\374\265C\355r\226\222Yo\263\317#|\326\366\260\363Mmg\215)\375\276r\214\254\207\"nO%\266\016\333\261\303=\005U\307m\327\231U\306W\303\032\340H\345:\030q\034\322\264\257\247r\037\312s\022Z\323\023\361\303\225\363\225\222}\nf\345|u\251\246\325\312\312\326\034\352#.9\270Z\256L\201y\345K\006\272\n\026V\003\335\005\303#\033k3\332 l\331\371\332b\375\031,\311!\257\343N'\001}\321s\302\276\016Cu\225\262'!^c\316]\250=\236\242\353\200{\340\014\352\256\221\036\244M\336vX!\2025Y^\204\000\273l\342\357\312C\373\025tb\227\257\237\206I\300T3\262\214\230S\232\3159\003~\263\375\253/+\3120^\301!\207\r\343,\024\321g|\213=\017\276\265\215ye`""\321\317=\0169\231ug\343n\234\330{\335\027\332\313\320+1{Z\344q\232\216\311>g\263 ByW\264u\336\301$\031\356#\356\021\022<Lx`5A\003\037\301\301\267\315\273G`\241aVQ\220\022U\261y\005\262q\026\313$\323\003\337\377\254dh%\207a\276\272m&\344\005\301+L\035\275r\023+}\356\334\252\256\324\273\304\032\022d\350$\310p\372K\367\313o\353\013k\260n\007\334\333\323d\007\277\270Z\233^\033\270\001\363w\002*c\314\035\213\241\307\351\213\356\305\277\325\277m\016|\264\272\266\355\336\007\302/V\236\333\343\250\257\365\240\271\250f;\266\016j\334dv\333'\242'\032\234\332^\266\023N\247s\007\370*S{\206\301\3671\272\000\340\212T\007\2743\331\t\335\263T5j\013k\275g\234K`\346\371z\276\031[\353\035pNV_\327\3675\276o\376\352\276\236w\347\215\265\336\263\316mYY\357y\367\374U\367\352=`\245\336/\200EN\327\376\331x\013\033-C,\326^\324\277C\025).\245\023\216\333}N\367\372!hpU\320S\271k\037\2655{\311\321\253c\325;\265N\234@\317\261\312\022\212J\316\211\352dU[\353;\347\334G]l\255\357\370\372!\342\317}\275\025\255\262\342tU;Q\010\023\264\340\214\255v|<\274m\177Oe\254\022\253\314\220\345\343!3\325i\320\272\2130\330\276C\225=d\362\016U\272\354N\346\035\316\356D\273\005\312\356\252,\333\013\240Q\314\355\374\302\376\025&\260k\337\352w\340t$\017\311P\355[}\000,E\234\214\354\0232sN\207\273\r\340\363\343\337;\376\247\020\026\014J\020v\007\330d\314\211\t\200]$\205\364\357\000\260[\317\261gu\030\364\274cwA\357\314W\347k\255\303\371\370\027vU\010qg\373\266\035\373\360y\016\302\t\\S=\212>ib\000\262\251_WK\265^\340\272\3550\322\017\033\317\233ck!a\326*\013\353]d\325A\333{P\201\013tD\244=K\225\036\310\263\016\356\236\262Mh\241C8JgR\300\323@\345\252\335\261N`\200Ur\3129\357\224\253\261\352l\255\277~\245^n\334mv7\3175\265\265\177A\003\360\034\300q'\324\354\321\252V\265\010\021\037\243\023\265\017C\206\016;\343\316l\365\030\014L\252~\256\2567\2566;\232=\315W\356\013X:\250\014X:\330)\006p\377\306Nd\365\316\330\367\2343 \026\331\222^\330\245;\215\035\215\271\346@\363\ny\027\375l\321\236c\304\031@\356\353\2008;\352\263""\215\243\r\2759\326\274\003\001^\357\274\\\033\257=\257\217\327g\340|\\o^\340\262\256\325\235\253\231\312K;\t\3603X=\016g\013\254\027a\305w\006\004\324\231}\273\350\330\216\263\275\212`\001Sdc\250\010\206\027\350r\032d>\347\244Af\026\252)1\220\340}\026\310\035p\212\004C\036:\315\032\240\227Od\006 \354lm\006^\315x\375\005\020\036\332\036U|A{|\004\3045\014\276\272\013o\344\034\270\2364Ke{e\2742\013\272]\306\204\027\33018DT9\017\301\335.&\023\216\322\213Z\014\254\237\252\017`\340\351z\2521\320\270\322(5\017\203;\017\221\216)\363\301w8G\035\r\0029S\375\025\315\236\303\305!\3168\333\234n\352l\033\000\276^\256u\037\256\234\251LVR \304\224m\221\001\206\010\375{f\034\370\324\036\007\2409\247\030\231,\324;\3531\362\001\353%\241S\303j\2167g\300\r\233f^\300X\275\020\330\2238\375Exl\304\025S\315\005\367\351\234;\367\334}\376\302}\201\025\374\004\210\275~\350\204\300\030\347\254\363\202\316\264\232\252\r\220\025\205\225\211\200I50\317xc\246!\010\210\025\375\"8\356W\360\326\217X\212\216\235\335iv\004\252\340\n\214\027Ye\030\005\342\370n\347K\014\231\254\035\253w\324O4\246\032\013\315\275\336\376\001%\001w\001P\341\036\001\361\002M\002\243\002\364.\273\313+\304Xw\341{h\344\352\n\253$x\366\0044\231F\261\201\332a,r\252\266\204\005~`\272\032\274%\301\247\260\365\030\032\226\016\262\204A\2011\341\356`\350\177\270\377\020H\035\213\374/\032\024\032\372*\254\333\022Xd\244\372\016d\374\236\234\243\214\233\001\254\367\235\204X\304\335\006\364\363\361\306\266\035\007Vg\334\203\344\335\014U/@\256\030\342,\256>'-\335b\312\250l\014\262[\262C(\257\223\202\034\034\215\021v\354<e\277\256\356\241A6\231\0312r\026\354\354V\246\214`\323,\274\341\336\352\373z\037\301\246v\266gL\226\375\264\343_\354#\256o\345#\322\300\027\335s\327\201s\264\206LH\326m\337\352\r\367\310\005>\261\375\365\271\306\205\346n\2009w\346\031\215\272DP\261\325\221;\000-:]1\354\337\252\017\340\354\235\257/\303\213[h\361U\326;w\020\326\236\001z\243\206$40\221\033|\302M\213d\350\t\311Av\317\352\000\316}'d\200\016\210\\\200U\0052^""\300&$\000\235\356\302*\224\352G\352\223\020\303\233\315\311f\322\235\006\326\205\204\223\307\352\276J\270\t\320\005\026\205!\037\300\300y(\325\235\225,\214\3442\000u\027\014\306t=\335x\304J\301w\310\250\261k\200\265>\270\037~\003k\375\243\343\036\371b\367\"\367)\271\037yB\311\223\310S\346\313\261\337a\277\367\322\241\002\276\235$\370\306P\200\364\267\205\35506<\306v\227\224\321\321Z\002\010\272\023\252\360\204;;\267\316\265}\344@\035b\366\326\240u\301\016\004Hk\323\037\323\314\021\034\351Z\337\020\236\242\363:\331\206Oh\230Eq\323w\327\217\001\252\223\313\277\002M\353\276\304\306 0\3201y7_\330\310)\334\231\031\217\302=\030f\247\333K\314v\003\202\373\030\232v\030\3123\346;\016->>\372\323j\242\304\361\273T\320\341K(\354\207\200oF\3437l\023\372v\253\240\003\231\360\233\260\267^\364\001#\355\331\253\202\004\207\335\303\344\006\336\254>\206\354p\300A\016U0Bf}\037\305\236b\366K'W\273Q\277\3268\336\034f\275:\267\311_\306\232\010\200\354v\224g,\002(N\346Mp\357\0032)\336\244\342|\211\343y\223\250\302\321\226O@P\2454Tx\361\226\250\353#\300u\2739\244\264\377\200\367\325\307\346t\303\367z\350\343\"\231U\245\021\316;o\240q\016_p/\334\254w\177\374\241\203\002:\024\341\034v\306Z4X\273\262\025\370\004\273\235\356\2262\234\033\300?\371U\034\003\355\255\2300\362w\240\240\323\260\254\213\342\200]\364\334\321k\225>\373\010\203\311\013\325\256\332\366\332\265z\267_\277\016oz\222Q\313\003\310`\232\234\227-\n\306!\245\017Ec\212\347=\314E\237QO\240\200\214\347u\000\264\303\024\021o[\324\303\276L/<\266#\325{\265s\214G\2565\372\233\227\001ww\223 ,\370\024\000[\355>\212I\225\303\355-x\323R\026\332\024\320\314\367@\254\373\022\317\363\2261\240\"/D\356N6!=\200\036\273\253=\325glq\302\234QZ\355Y\235\206\272\234e\\c\002\355\335\305\232'\031g\\g\204Q\0060(5\273\333\3642X\001\334u\216\210\313\340\307\223\375 \357\321\312O\316i8\346\235\000\307\273\201\245g\335iXURfd\210\366PL\001Pjou\034\0160!\020 \317u\205x\241y\234\213t`\024\344L\331\274\350\004v\023#\317\034Fo;:\315\326\272\001\254#\220\364}D""\232\214\375\2433\315\241P\030\3729\016X\004K\t\016\221\020\373@u\002\266R\023x}\016\230 \302k\241`\377\0318\311\035\265\023$w\033\327\322\271{\265{\365\314\352\235J\007\300v\204`\340\346\242\022\334\210\253\3448W\347\304\266\257\000)\217\371\022\034\234\227\217\306\307(\3764\016\257\272\304\201b8\347&\217s\034\253\274\216S\030\007\326\333U_hD\032g\033\263\315^\202\211d\372\330\224\200\232\014\023\377J'Z\016m};;\333;`\001\311\356\354\252-\254\357;Vy\357\234\004\224\276\203S9\n\020=\210\263cl\014d*\230(A\275\207\030\tw`\3223P\251\323\265\267\215.\270L\307\274\251f\211\265\017\342\324\304\367\357\252\262NJ\201\006S\212q\016;7\240\215\357\327\306\202\323%\227\342&\234\232\022\270\225\320\356\231ZL\350v\337\276\001\310\375\240\032\333r\335\212\310D\314\037\241\260\223\340\313XHkr\274\241\262HA\0001\216\261\217\373\260>\227\356\221\234\001|\215o\333}\336\271\007\002^\245h\372)F\353\034\245\277\014\204\361\005>\310A\014\264\321\307.\332\035\314>T\332v8c{\253\274\r\215\315x\022\030\323p\026\334\241\233\365n\257t\027\237\321\n\200\333\027\240\353\221:\230\3734\013\300A\216\\'(z\005h\323\321<\n\303\270(\236\200\204\230(z-\323\272\247\0365c\356c\212\225\301\320'\274\270\354cJ\036\007\021b$\363\021#B\023\274\205\232\354\250\361>n\272=\204\241\314\352\020\304\246C\226\265\004\232\230\366\005\234\316v\354{w\275\273\376\225\270B\255\325\273\320\353<$\271\243\376\005\026x\004\006\267\245z7t\306\335\332qh\271o\341\001\223\226S\325I(\301\345\226\276\335\315\001\367{\260 \360\014\360\017\\\213\254\233\315}\2629]\325\300\266\n\364Ak\nJ\273\037\376\201=\376\323\213\227\267\222\341)%O#\317)y\036yC\311\033/\226\036\217\204\347Zt\236UwT_\262\367&\363\235v_\210)\367\227H\353c\357g\321]\374\315\375M\346U8k\206\222\231\310\217\224\374\210\261\221\304#\277P\362K$II\022\247\200\304\010\256\002\220\024\"\305\010\307\325\300t\027(\3408\276\372Z\234w\367\364(\207\267\300\304\267\301n|\261S\363b\330'\340\207j\224\207mY\367\330\341\357\340\232\036\272\364\363\006<\3232\240\375\016&\211\205\342&""\214f\322\351\347@\0379Bk\373{%\374~\224t\277?\336\337\000\340\357p\034U\306[\357:\350\036<\303a/\177\364+`\346\275\262\230\203\253\313|\325u\350$\206\177[\215@\023\304\326\272\371\352\323+\353X\207\377\373\326\351p\007\274\233\266\375\024\177\3241b\251z\002\270b\026L7Ba\205#\225\t{\0066\350\"G/\260\260W\320\260\373\217\311]Z\3532\025\320\362\027IRbU\256\341HK\004Y\373%\312\361{l-\210\331\036\"\264\356m\341&\364\311U@\337I\347\035\214\31090\300\373F\367\237 \023\304\232\215#\307^\026Vc\037\017o\353>e\3070|_X\213\000r\307D\311\333O\330`\365\302\323\024A?\327H7\357{\336\266p\0326\005\030\314\376\000\363\250Y9_\371\000P\321]=WM\327\036\326\247\203\342\025\242\347xm\220\227\221n\334o\216\265\3249_\200o\216\2607v\247\261\2631\357\t\344_\252\3164\247?Um4\0276Ww\327\006\334\313S\215\353\315s\315\264;\013s\003\215\205\003\363 ~\273\366|\331\035PE\224\003<\235\262[\026\231S\027Y\017)y\350\t\271\222\300M\027S\1774\203\370a0f\342{\010k\276G\357\017\035\2234\310dD9VJ\265\250y\224NQ\327g\032%Z$AI\302\273\246\313R\222\215\230\224\230\021\213\022+Rf\2017\351\312\365\367\016\272r\335\277\032#\223\004\237\034\210\200\256\253\331\345\177\001\004\327#\267\035\003\354\031\254w\365\371\227\035\020\304\213\340\004\255\272T{\3278\326\354Xo-\351&n\247\021\257\221\363\n\226<\275\255\273\007\0225m\247a\007{\216\022\314\240Kkz\206\320\323gw9\021@\350\010\272\317\003\236\0167\256q\220\254\247\217m\331.g\001z\221\354\357p\375\252h\230\265\276\223\034\210\"\200H\2469\241b'\223p\246?\257\327\341\352-V\263=\360\340\007\032\343\300%\204*\022\374\344@n\201\330\342\035\"\360v\026\276\223\346Xp\362\256@2i \024\317@\032\006\034v\\\247*e\357f\016;0je\340\265YHp\017y\340s\254\256$\260)Q\361H\375\014\314m\337\t(\005\301x1@\341\355\300\035'%\014J\230\255\003\333\232c\3504S3a\311\210\273;90xF\274w\205j\304k\\\367{\336\340{\225\035\300?\t\314s\226#\200V\343J\243\334\2145g\232%wZ\365\360\342z\220u\370\376$\006na\301]\220\240\022\337\366\367\235\2663\316,\353\304\031\300\231>\t\"\3170d\350\336\370\311\247Y""\266\357a\257\227\235d\225\267\276\013\306s\001\n\267'*g\274\313^\242h\343\357\304\013Pz\312\313\245\216\037\310I\020\203\261\261j\301W\252\204\311\272\304\216\020R\356\004\247\022\\m\315\356\340\236\014\354\316qt\2011GG\365\030 Y\271~\037\204Xl\276t\237\373*\000\033\307~\227\335e\n\242\371\257^\224\032\245Pi\306\236\345 iIB\274\344\203\322\335m\317\tl~\026\254t\216o\262&\301\200\240\371\037\327\377\231\001\267\327.\303)\3703-(8\301?\355\212\216\361\255\337<9\236\277\307\024UE\r\014\210K@7\274Ls\302\307;\035-Tv\025\336\004<\360\356\312\021X\220i\257\204 \376\021u\347\000\341#\373k\002\033\003\020\220P<\264\247C\032\300\317\312\244\026]\347x\331\353pB\0368d\256.n\333}\210\037\241\014Cd>Pp\331\355\272\007\025I\206l\303}\337\002\004\334b:\350\3125,5\2166R\315\363\3152s8\216X\316\027Xi\001\303O\001\377v}\307W\033\037\373\333]\036\376\0106_dyYh\354jX\3151\310\031\234\014\200/\310\210\370\031r\343\002I\021\031\371\025\312\364\267\216\326X\3274%\323P\320.E\234(\036\301\020\205\366D\217\223\274\333[\241\355\262\n.t\302\223\230\252\226\305\271`\213\036\203m8\357\336\0273L\346\300\273\335}\306\316!\305\033\266\263M\367:<\204f8\357>\221\027!\364\206\203H[\256(\227U\235\345\007FB\373\3720\306\005\276\276\334\305\227\345\373\217\361\035\334\367\316\002=\005\352\201?K\310\351.\214\324P}\220\337|\251\026O\340\250\316Bc\276\202\024=c\307\nz\004\004\3022eb\220\233\224\010M\321i\177G7\262Um\275u\317\2415\234\347C\\\202\305Xh\263\206\016\250h\354\260\326\307\341\271\356\177\335\032\306\351\375\001\2506)o\010\374`\316\006\372D\200u\372\3702\242{K\n\035\006\353\r\003W\0144\375\233\007\272n&\267\0362\372'\227\014\216\222\370|k\020U\271\021?D\376hG\303\312\005}\306\367\374\237\240z\t'\337E>j\275\343_\270\263i\262J\002 aQ\374\320p\361\257\034\304\212<\220\351\305\254;\355\004\230dQ\256\322\274y\037\222\347K\257\032nrx{\007L\353R-\243n\013U\233\307\325~\230kK\275#\232l\246\230\354>\266\305\002Ay\330;8R\202\264Z\021\335w\224|\267\301\211\233\216\320\242R\366\020\343\340\2016\273\031d?G\207""\025\244\307;[\356j\007,\347\022T\361}~\204\362_\272\253u\357\r\232\\\314g\330\372\234\207CLn\225\270Q\344\336x\365\3638\251\2166\345o!Jt\215`\326\316p\014\247\037hk\2569@\227\204;\370M\352_hIs\321\243\322\313\260\202\235\340\214\037\3533\365\262<\304\222\226\320~\037\354/\235\327\265\275\365\233\215\330\357\035t\247\361ee\332\335v\251:\375\361\n\005\211\325\223!?\216\370\247\237_\004wV\313\265\205\255n\254\346\236\003\022uT;V;\334m\267\3530\326\375n\377\250;\n\375\3761\337AO;\373\335\263\327j\005y(\033\\h\361\345\002\317K\357\212;\311m|\344\354t/`\210\372Js\027=\316\201\201\2233\027\360\366\253\373\253\\\301<\240C}\340\035\270\362\024\324{\273\331\310\346\233\257#\374,U@==\307\364\336\337\335l|\327\314\361[\003\361\001\275\367\241\024h\334w4d\207;a[-\250\352=\365\013\215Hc`\235_\215\315\243j\245\272\277\366\262\376\266\271\337\235\223+\246$\371\032_\250\232W\330H\307:?R\353\246W \033_\207m\371\262,\374\242e]n\035NA\234,yN\243\256\027\256s\374\231b\363\364\026*\346\374\010\210\335!/\306\375\026\204{\302_\3278\266\332\332\342:\275\207u\270\235\311\227l\333+\301\203\260u~\362\005 \241\236y]p\264u\025m\357\366\014\366\013{\212a\022=\307\232\257%\353\207\353\227\353\251\306\205f\027?\013\235c\322\274q\337\000`\370O:\010\261l\320\337\374\004\314\236n)\035\223(\202a/\254\253LI|K\267\363\222{\211\230\355x\377\307\371\016\212\013\316s\254\361%t\360s\350\365\213\r\257\3771\302z\353\373\3701\241\222\365 n\001I6(\242\272\371\005\226\333\331[y\207\271\016\326\377\331,\270o\260\344%\260\327rG\214\270,\026\231\204{\331\353a\016b\231A \336$\034\232W09;\340o\235m\274\200\352J0\005\324\365vhg=`\365\275\344\235\255\301sP\231\323\266A\357\345\345\311\320\260}\203\337<b\265\202\253v\311\033y\260\224<%!\374K\256\346[z4I\341\235$\266\3237\200U\310S\224\343Qg;|\254\235\214<\372\330Cp\207\275\253at(\343\314\336s\020\361H\215\035\265\253\364\302b\355\344Y\277\323\2513\316Yg\256z\201\003b'\317P\220\310\275$Og\027\326\272\371E\233\247\t\017;c\3569\361\326\304\345z\251hMW\232t\261\253\2365""\246\345\021\324\022\007x\016I\010\035c\2113\353\351Uw@\342\201\022'\340`e\360\354\224\026\036[\353\356\345x\257\346\367\240\000\271\233\220\300!,\203)\257\343\350LR\352~\241\277>\216S\031n^i\276\347g\312\2029\025\220t\213\357\335\367\002uU,b*\322\242\345\351\014.:1\2718\230\345\017\002\t\364\367\031gT\320~\276\221h\342(\372\251\035\214\\7\275#\371A\334\037\3512\314/\275R\034\250\352b\307\225\364\371=\300\217q\272\247\001\371B\301~\177\234\377\354\344\364\242p\227]\206dG8\354\261\\+a\266Lc\266\331\347N\343\234\345A?\330J\302h\362d\203\036\255\004\324\333\317o}}\020O\177/\221b\310\005>\177l\237r\336\002\245Q(p\343\247\2076\316A\014\017S04\2044>\335s\337\352\367p\267\207\340\261\365\327\3076}\006\343\2222\351q\246[\306}P\211\265>\224\2043\017\r\376\205\275\340F\277\206\241\375[\343\035\377u\007\231\306\007L#\376[\004~YL\027\335\217\352\007\350\225\"?\005X\353\034t\026H\230\334}\203\374\367;\307\257@\324\216\243\031\235\313e\326W\317\340\205&!\2061h-rt}\322\037B\337\320\027\275\370\014\276z*\337\021\363\213\003\032$\017\310\007\336\230\250\226\217I\333\365T\2368\337\362\337\250\274\242\013\252iwZP:\260\025\316P\360\254\240t\310\203\367\220F\351\273'\377\017\3078\t\364";
    PyObject *data = __Pyx_DecompressString(cstring, 12231, 1);
    if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
    const char* const bytes = __Pyx_PyBytes_AsString(data);
    #if !CYTHON_ASSUME_SAFE_MACROS
    if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
    #endif
    #else /* compression: none (30960 bytes) */
const char* const bytes = ": 12e5d6e\n    Abstract base class for formatting progress display of optimizations.\n    All dimensions preceding dimension %d must be indexed and not slicedAn error occured on iteration Bad pointer, check cython code\n            **Beta Feature**\n            \n            .. note::\n                \n                This class is subject to rapid iteration and/or removal in\n                future minor version increments.\n            \n            Class for plotting optimization progress on matplotlib axes.\n            \n            Parameters\n            ----------\n            \n            stream: DiplayHandle\n                DisplayHandle for where plots will be displayed\n            nrow: int, optional\n                number of rows of plots in output, the default is 1\n            ncol: int, optional\n                number of columns of plots in output, the default is 1\n            xlim: tuple[tuple[tuple[int|float|str, int|float|str],...],...]\n                nrow x ncol x 2 nested tuples, identifying min and max values\n                for x axis of given [row][col] plot. If 'min' or 'max', take\n                said values in arrays. Defautl is for 1x1 'min', 'max' values\n            ylim: tuple[tuple[tuple[int|float|str, int|float|str],...],...]\n                nrow x ncol x 2 nested tuples, identifying min and max values\n                for y axis of given [row][col] plot. If 'min' or 'max', take\n                said values in arrays. Defautl is for 1x1 'min', 'max' values\n            plot_kwargs: dict, optional\n                dictionary of keword argumetns given to ax.plot on first iteration\n                Default is empty dictionary.\n            **kwargs: dict\n                kwargs handed to plt.subplots when creating initial figure and plots.\n            Buffer view does not expose stridesBursts photons are out of order, please check your dataCan only create a buffer that is contiguous in memory.Cannot assign to read-only memo""ryviewCannot change the number of statesCannot change the number of states in a modelCannot change the number of streams in the modelCannot create writable memory view from read-only memoryviewCannot give negative or non-int values for nstate or ndetCannot have negative iterationsCannot index with type 'Cannot set niter for this type of modelCannot transpose memoryview with indirect dimensions\n        Class for prining to :code:`IPython.display.DisplayHandle` object.\n        \n        Parameters\n        ----------\n        buffer: IPython.display.DisplayHandle\n            DisplayHandle where output is displayed\n        keep: bool, optional\n            Whether to keep old output or replace with new. The default is False\n        Conflicting values for numbers of states encountered at Conflicting values for numbers of photon streams encountered at Converged Model cannot have -inf loglikD, must be 1D uint8 arrayDetector indexes out of rangeDim 0 of one of the matrices does not match the others, these represent the number of states, so input matrices do not represent a single modelDimension %d is not directEmpty or null array, raise issue on githubEmpty shape tuple for cython.arrayFixed model, cannot mutate converged stateFixed models cannot be alteredH2MM_C/H2MM_C.pyxIndex out of bounds (axis %d)Indirect dimensions not supportedInit model, no data linked, therefore BIC not known.Initial model out of min/max obs range, will result in undefined behaviorInitial model out of min/max prior range, will result in undefined behaviorInitial model out of min/max trans range, will result in undefined behaviorInput array not stochastic, new array will be normalizedInput matrix not row stochastic, new matrix will be normalizedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis Iteration:Iteration \nIteration time:Length must be at least 3Limits and model have different number of states, got Limits and model have different number of photon streams, got  (Max:<Me""moryView of Mismatch in photon streams between model (Mismatch in states between model (Model uninitialized with data, cannot set convergedMust be h2mm_modelMust have at least 2 timesMust have at least 3 time pointsMust have at least 3 timesMust implement closeMust implement updateMust specify number of photons if loglik is specifiedNo limits specified, this is a non-limiting h2mm_limits objectNon-int options for num_cores are 'single' or 'multi', cannot process NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Obs matrix must have ndim=2, wrong dimensionallity of obs matrixObs must be a 2D numpy floating point arrayOptimization limits:: num_cores: Optimization reached maximum number of iterationsOptimization reached maxiumum timeOut of bounds on buffer access (axis Out of order photonPrior matrix must have ndim=1, too many dimensions in priorPrior must be 1D numpy floating point array\n    Special class for setting limits on the h2mm_model, as min and max values\n    \n    Parameters\n    ----------\n    model : h2mm_model, optional\n        An :class:`h2mm_model` to base the limits off of, if None. The main purpose\n        is to allow the user to check that the limits are valid for the model.\n        Specifying this model will also lock the states/streams of the model,\n        while if None, the limits is more flexible\n        If None, none of these checks will be in place\n        The default is None.\n    min_prior : float or 1D numpy array, optional\n        The minimum value(s) of the prior array. If float, all values are\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible.\n        If None, no limits are set (all values min is 0.0)\n        The default is None.\n    max_prior : float or 1D numpy array, optional\n        The maximum value(s) of the prior array. If float, all values are""\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible.\n        If None, no limits are set (all values min is 1.0)\n        The default is None.\n    min_trans : float or 2D square numpy array, optional\n        The minimum value(s) of the trans array. If float, all values are\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible. Values on diagonal set to 0.0\n        If None, no limits are set (all values min is 0.0)\n        The default is None.\n    max_trans : float or 2D square numpy array, optional\n        The maximum value(s) of the trans array. If float, all values are\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible. Values on diagonal set to 1.0\n        If None, no limits are set (all values min is 1.0)\n        The default is None.\n    min_obs : float or 2D numpy array, optional\n        The minimum value(s) of the obs array. If float, all values are\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible.\n        If None, no limits are set (all values min is 0.0)\n        The default is None.\n    max_obs : float or 2D numpy array, optional\n        The maximum value(s) of the obs array. If float, all values are\n        set the same, but unless fixed elsewhere, the number of states is\n        flexible.\n        If None, no limits are set (all values min is 1.0)\n        The default is None.\n    nstate : int, optional\n        Number of states in the model to be optimized, if set to 0, and not\n        specified elsewhere, number of states is flexible.\n        The default is 0.\n    ndet : int, optional\n        Number of streams in the model to be optimized, if set to 0, and not\n        specified elsewhere, number of states is flexible.\n        The default is 0.\n        \n    Step may not be zero (axis %d)The model converged after Times must be 1DToo many photon streams in data for H2M""M modelToo many photon streams in data for one or more H2MM models, Total:Trans matrix is not square, and connot be used for a modelTrans matrix must have ndim=2, wrong dimensionallity of trans matrixTrans must be a 2D numpy floating point arrayTrans must be a square arrayType of max_obs changedType of max_prior changedType of max_trans changedType of min_obs changedType of min_prior changedType of min_trans changedUknown error, raise issue on githubUnable to convert item to objectUnknown error, check C code- raise issue on GitHub, res=Unknown error in phtragen, raise issue on githubUnknown error in sparsestatepath, raise issue on githubUnknown error, raise issue on github(,\n \r.,  (?>')add_noteall elements of models must be h2mm_model objects and ) and limits object ( at 0xbounds_func must be None, 'minmax', 'revert', or 'revert_old', or or callablebounds must be None or h2mm_limits objectbounds states incompatible with modelbounds streams incompatible with modelburst , but buffer has size bytes too small to read as h2mm_model cannot be read as 1D uint8 numpy arraycannot find package versioncannot inplace evaluate fixed modelcannot inpnlace optimize fixed hashable model, check array dimensionscollections.abccomputed mode<contiguous and direct><contiguous and indirect>, conv= converged, converged_min: converged_min must be float and greater than 0converged_min must be float, got converged_min must be float greater than 0converged_min must be greater than 0 converged state: copmuted model by  dets, meaning buffer size should be  difference is too large different from others specified (disableenable error in current calculation error in next iterationfinal optimized model by ,\nformatter: gc (got got differing extents in dimension  has different size from other specified (hashed hashed model, improvement: in  in time is not 1D in times has different size from other bursts arrays (insufficent memory to allocate path arraysinsufficient memoryinsufficient memory, cannot"" allocate insufficient memory, cannot allocate prior arrayinsufficient memory, cannot allocate trans arrayinsufficient memory for deltasinsufficient memory for gammainsufficient memory for gamma arrayinsufficient memory for h2mm_model outputinsufficient memory for time deltasinsufficient memory to allocate loglik array is is_conv must be boolean or int is too short, must have at least 2 photons, got isenableditemsize <= 0 for cython.array iteration time: iterations kb for output models arraylimits function must return bool, h2mm_model, (h2mm_model, bool) or (h2mm_model, int [0,2])limits function must return model of same shape as inintial model, loglik: , loglik:loglik must be negativeloglik not calculated against data, will be meaningless -infloglik not calculated against data, BIC meaningless -infmallformed h2mm_model bytes array, specified , max_iter: max_iter must be greater than 0max_iter must be int, got max_iter must be integer greater than 0max_obs dissallows row stochastic matrix, max_time: max_time must be float and greater than 0max_time must be float, got  maximum iterations maximum timemid-optimization min_obs cannot be greater than max_obsmin_obs disallows row stochastic matrixmin_prior cannot be greater than max_priormin_trans cannot be greater than max_transmin_trans disallows row stochastic matrixmodel must be h2mm_model or None, got model obs out of range of min/max obs valuesmodel prior out of range of min/max prior valuesmodel trans out of range of min/max trans valuesmodels must be sequence or array of h2mm_model objects must be None, float or numpy array, got  must be readable as sequence or numpy array of 1D arrays, ndet: newly created model, niter: niter must be integerniter must be positiveno default __reduce__ due to non-trivial __cinit__, nphot: nphot must be positivenstate: nubmer of bursts in nubmer of bursts in times (num_cores must be greater than 0num_cores must be int and greater than 0num_cores must be integer greater than 0numpy._c""ore.multiarray failed to importnumpy._core.umath failed to import object>obs:\nobs array can have no negative valuesobs bounds not valid for this number of streamsobs_dist must be 'equal' or 'random'opt_array must be True, False, 0 (False), 1 (True), or 2 (return all assigned models) out of order, outstream= photons times post-optimization LL, previous loglik:print_func must be None, 'all', 'diff', or 'comp' or callableprior:\nprior array can have no negative valuesprior bounds not valid for the number of statesprior_dist must be 'equal' or 'random', returning previous modelrevert-oldself.name is not Nonesingly-computedstandard bounding styles requires bounds argument to be of type h2mm_limits, not  states= states and , streams=<strided and direct><strided and direct or indirect><strided and indirect><stringsource>times array must be 1D, total:trans:\ntrans array can have no negative valuestrans bounds not valid for this number of statestrans_dist must be 'equal' or 'random'un-unable to allocate array data.unable to allocate shape and strides.unhashable model, must sort_states first vs , vs  with errorxlim and ylim must be nrow x ncol arrayxlim and ylim must be nrow x ncol x 2 arrayABCASCIIBICConvCodesConvCodes.__reduce_cython__ConvCodes.__setstate_cython__DisplayHandleEM_H2MM_CEllipsisFalseH2MM_CH2MM_arrIPyPlotIPyPlot.__init__IPyPlot.__init__.<locals>.genexprIPyPlot._get_xylimIPyPlot.closeIPyPlot.updateIPyPrinterIPyPrinter.__init__IPyPrinter.closeIPyPrinter.updateIPython.displayPackageNotFoundErrorPrettyPrinterPrinter.__call__Printer.__enter__Printer.__exit__Printer.closePrinter.update__Pyx_PyDict_NextRefSequenceStdPrinterStdPrinter.__init__StdPrinter.closeStdPrinter.updateTView.MemoryViewabcabstractmethodallallocate_bufferanyappendarg_listargsargsortargwherearrarrayasarrayascontiguousarrayastypeasyncio.coroutinesatleast_2daxaxisbbasebegsbicbnd_ptrbndsboundbound_errbound_funcboundsbounds_funcbounds_kwargsbufbufferburst_sizesburst_typeburst_type_tempburstshapebursts""inglecc_min__call__cdeltaschaincindexes__cinit__.<locals>.<lambda>__class____class_getitem__clear_outputcline_in_tracebackcloseclscollections.abccompcomp_timeconcatenateconst_obsconvconv_codeconvcodeconvergedconverged_mincopy__copy__countcpathscpu_countcstate_pathctimescurrentdatadeltasdemardetsdets_n__dict___dictdiffdiff_timedisplay__doc__doubledtypedtype_is_objectdwell_begdwell_burstdwell_enddwell_middxdyeelnemptyencodeends__enter__enumerateequalerrerrorevaluateexc_tbexc_typeexc_val__exit__expeyefactory_h2mm_modelfigflagsfloatingflushformatformatterfortranfrom_iterablefrombytes__func__gammagamma_gamma_arrgamma_outgenexpr_get_converged_min_get_formatter_get_max_iter_get_max_time_get_num_cores_get_outstreamget_stdout_get_xylim__getstate__h2mm_limitsh2mm_limits.__init__h2mm_limits._make_modelh2mm_limits.make_model_h2mm_lims_h2mm_lims.__reduce_cython___h2mm_lims.__setstate_cython__h2mm_modelh2mm_model.__copy__h2mm_model.__reduce_cython__h2mm_model.__setstate_cython__h2mm_model.copyh2mm_model.evaluateh2mm_model.frombytesh2mm_model.normalizeh2mm_model.optimizeh2mm_model.set_convergedh2mm_model.sort_statesh2mm_model.tobytesh_modhas_ipythonhas_matplotlib__hash__.<locals>.genexprhmodiiclididxs__import__importlib.metadataimportlib_metadataindexindexesindxsinf__init__inplaceint64integeris_conv_is_coroutineisnanissubdtypeitemsitemsizeiteriter_timeitertoolsjjoinkkeepkwargsl<lambda>lenplimitslinspacelllnlogloglikloglikarrayloglikploglikpathlongm_iterm_time__main__majormake_h2mm_arr_modptr.<locals>.genexprmake_model_make_modelmatplotlibmatplotlib.pyplotmaxmax_itermax_obsmax_priormax_timemax_transmdlmemview__metaclass__minmin_obsmin_priormin_transminmaxminormodemodelmodelsmodelshapemodelsingle__module____mro_entries__multin_corename__name__nburstsncolsncorendetndim__new__newnewaxisnextniternmodelsnonenone_kwargsnormalizenoutnpnphotnrowsnstatenumnum_coresnumpyobjobjectobject_obsobs_alphaobs_betaobs_distobs_sigmaoldonesopt_arrayopt_array_opt_lim_constopt_lim_const.__reduce_cython__""opt_lim_const.__setstate_cython__opt_lim_const._get_converged_minopt_lim_const._get_formatteropt_lim_const._get_max_iteropt_lim_const._get_max_timeopt_lim_const._get_num_coresopt_lim_const._get_outstreamoptimization_limitsoptimizeosoutout_arrout_arr_sizeout_modout_modelout_textoutstreampackparampathpath_loglikpath_loglik.<locals>.genexprpath_npathsph_begph_burstph_countsph_counts_tempph_endph_midplotplot_bicplot_bic_obsplot_kwargsplot_obsplot_typepltpop__prepare__printprint_argsprint_errprint_fmt_argsprint_fmt_kwargsprint_fmtrprint_formatterprint_freqprint_funcprint_kwargsprint_streamprint_stringspriorprior_alphaprior_betaprior_distprior_sigmaprnt_strctproductptr_print_funcpyplotpython_version__pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_ConvCodes__pyx_unpickle_Enum__pyx_vtable____qualname__random__reduce____reduce_cython____reduce_ex__registerreplaceresreset_niterreshaperetrevertrevert_oldscalescatterseedseedpselfsendset_converged__set_name__set_xlimset_ylimsetdefault__setstate____setstate_cython__shapesim_phtraj_from_statesim_phtraj_from_timessim_sparsestatepathsim_statepathsinglesingle_linesize__slots__sortsort_statessrtststartstatestate_pathstatesstates_arrstates_nstdoutstepstopstreamstripstructsubplotssumsum_logliksys__test__testtextthrowtimetimestimes_arrtimes_ntobytestotal_logliktotal_timetranstrans_disttrans_scaleuint8uniformunpackupdateuse_setstatevaluevaluesversion__version__version_infoviterbi_pathviterbi_sortwarnwarningwarningswidthwritexxlimxmaxxminxxyylimymaxyminyyzeroszipT{^:}\320\0000\260\001\360<\000\005\r\210B\320\016 \240\001\240\027\250\006\250b\260\001\330\004\007\200u\210F\220#\220Q\330\010\016\210i\220q\230\001\330\004\007\200u\210F\220!\2203\220b\230\001\330\010\016\210j\230\001\230\021\330\0042\260!\330\004\030\230\n\240)\2506\260\021\260!\330\004\034\230K\240y\260\001\330\004-\250R\250v\260Q\260f\270F\300\"\300A\330\004\033\230;\240d\250!\330\004\036\230a\330\004\007\200u\210G\2201\330\010\020\220\017\230q\330\004\023\220?""\240!\2404\240x\250v\260Y\270h\300a\330\004\007\200t\2103\210a\330\010\016\210j\230\001\230\021\330\t\r\210S\220\001\330\010\016\210l\230!\2301\330\004\013\2101\320\0000\260\001\330\016 \240\r\250Q\330\016!\240\036\320/@\300\001\330\016!\240\021\330\016#\2401\330\027\031\230\026\320\0373\2601\330\016 \240\r\250Q\360\\\010\000\005\026\220U\230&\240\017\250s\260*\270A\330\004\025\320\025'\240z\260\021\3202B\300-\310q\330\004\027\220t\2306\320!2\260#\260Z\270t\3001\300A\330\004\021\220\025\220f\230K\240s\250*\260A\330\004\021\220\036\230z\250\021\250,\260m\3001\330\004\023\2204\220v\230]\250#\250Z\260t\2701\270A\330\004\024\220D\230\006\230n\250C\250z\270\024\270Q\270a\340\004\027\220t\2301\230A\330\004\032\230#\230Q\230a\330\004\007\200{\220(\230#\230S\240\001\330\010\016\210j\230\001\230\021\330\004\032\320\032-\250Q\250e\2601\330\004\007\200q\330\010\013\2106\220\031\230!\360\006\000\005\013\210,\220j\320 3\260>\300\021\300!\330\004\n\210-\220z\320!4\260O\3001\300A\330\004\n\210,\220i\320\0372\260.\300\001\300\021\330\004\n\210,\220i\320\0372\3202E\300Q\300a\340\004 \240\005\240V\2507\260,\270g\300\\\320QR\330\004\007\200{\220'\230\036\240t\2504\250x\260q\270\001\330\010\016\210j\230\001\230\021\340\004\035\320\0350\260\017\270q\320@P\320PQ\320Qd\320ds\320st\320tu\330Rd\320de\340\004\016\210m\230:\240S\250\001\250\021\330\004\016\210l\230&\240\001\330\004\016\210l\230&\240\001\330\004\016\210m\230<\240q\330\004\016\210h\220a\330\004\016\210h\220a\330\004\016\210j\230\001\330\004\016\210i\220q\330\004\025\220Q\330\004\007\200{\220#\220Q\330\010\013\210;\220c\230\021\330\014\035\230Q\330\r\030\230\003\2301\330\014\035\230Q\330\r\030\230\003\2301\330\014\035\230Q\330\r\030\230\003\2301\330\014\035\230Q\330\r\030\230\003\2301\330\014\035\230Q\330\r\030\230\003\2301\330\014\035\230Q\330\t\021\220\021\220!\330\010\022\220(\230,\240a\330\010\022\220(\230,\240a\330\010\022\220*\230L\250\001\330\010\031\230\021\340\004\007\200|\2208\2306\240\030\250\032\260:\270^\310>\320Y]""\320]a\320ai\320ij\320jk\330\010\016\210j\230\001\230\021\360\010\000\005\032\230\021\330\004\021\220\021\330\004\t\210\030\220\021\330\004\t\210\032\2201\330\004\t\210\031\220!\330\004\007\200|\2204\220v\230Q\330\010\025\220Q\330\004\007\200|\2204\220z\240\032\250>\270\021\330\010\013\210<\220s\230!\330\014\031\230\021\330\r\031\230\023\230A\330\014\031\230\021\330\r\031\230\024\230^\2501\330\014\031\230\021\330\010\013\2104\210z\230\021\230(\240!\330\014\022\220)\2301\320\034o\320op\320pt\320tu\320uv\330\010\017\210v\220\\\240\021\240!\330\010\022\220(\230!\2304\230q\330\t\021\220\021\220!\330\010\021\220\025\220f\230G\2403\240j\260\001\330\010\021\220\032\230:\240Q\240h\250m\2701\330\010\025\220Q\330\010\r\210X\220\\\240\021\330\010\r\210X\220\\\240\021\330\010\r\210Z\220|\2401\330\010\022\220(\230!\2301\360\010\000\005\030\220q\330\004\033\2301\330\004 \240\001\330\004\032\230!\330\004\034\230A\330\004\013\2107\220&\320\030*\250!\2509\260G\2701\270H\300A\300Y\310a\310}\320\\]\320]c\320cd\320de\330\004\007\200t\2107\220!\330\010\016\210a\330\004\031\230\021\330\004\010\210\005\210U\220!\2201\330\010\021\220\033\230A\230Q\340\004\036\230a\360\006\000\005\010\200q\330\010\024\320\024%\240Q\240i\250s\260&\270\t\300\035\310a\310q\330\010\013\210:\220S\230\001\330\014!\240\021\240)\250=\270\006\270a\330\014\022\220+\230Q\230a\340\004 \240\006\240j\260\002\260\"\260B\260c\270\026\270z\320IY\320YZ\330\004\035\320\035/\250q\260\016\270c\300\026\300y\320PS\320SY\320Y`\320`a\330\004\007\200x\210s\220!\330\010\035\230Q\230i\240}\260F\270!\330\010\022\220!\2201\330\010\016\210k\230\021\230!\340\t\n\330\010\013\2101\330\014\017\210q\330\020\027\320\0270\260\001\260\031\270-\300x\310v\320UX\320X`\320`a\320aj\320jk\320kv\320vw\320w\177\360\000\000@\002L\002\360\000\000L\002U\002\360\000\000U\002e\002\360\000\000e\002m\002\360\000\000m\002n\002\360\000\000n\002o\002\340\020\027\320\027*\250!\2509\260M\300\030\310\026\310s\320RZ\320Zc\320cd\320do\320op\320px\360\000\000y\001E""\002\360\000\000E\002N\002\360\000\000N\002^\002\360\000\000^\002f\002\360\000\000f\002g\002\360\000\000g\002h\002\340\014\017\210q\330\020\027\320\027*\250!\2509\260M\300\030\310\026\310s\320RZ\320Z[\320[d\320de\320em\320my\360\000\000z\001C\002\360\000\000C\002S\002\360\000\000S\002[\002\360\000\000[\002\\\002\360\000\000\\\002]\002\340\020\027\220}\240A\240Y\250m\2708\3006\310\023\310H\320T]\320]^\320^f\320fr\320r{\360\000\000|\001L\002\360\000\000L\002T\002\360\000\000T\002U\002\360\000\000U\002V\002\330\004\031\230\021\230)\240=\260\006\260a\330\004\007\200z\220\027\230\001\330\010\022\220!\2201\330\010\024\220A\340\004\030\230\005\320\035-\250Q\330\004\031\230\021\340\004\007\200t\2102\210Q\330\010\013\210;\220c\230\021\330\014\023\2207\230!\2302\230Q\330\014\024\220G\2301\230B\230a\330\r\030\230\003\2301\330\014\022\220%\220r\230\035\240d\250%\250w\260a\260u\270F\300\"\300A\330\020\030\230\001\330\014\017\210u\220C\220q\330\020\030\230\001\330\014\023\2207\230!\2305\240\001\330\014\024\220G\2301\230E\240\021\330\014\024\220A\330\r\030\230\003\2301\330\014\022\220%\220r\230\035\240d\250'\260\021\260%\260v\270S\300\001\330\020\023\2207\230!\2305\240\006\240b\250\001\330\024\033\2307\240!\2405\250\001\330\024\034\230G\2401\240E\250\021\330\020\030\230\001\330\010\016\320\016\"\240!\2406\250\021\330\004\022\220!\220>\240\021\330\004\016\210a\340\004\034\230A\330\004\007\200z\220\027\230\007\230q\330\010\024\220I\230Z\240q\330\010\021\220\021\220!\330\010\022\220)\2301\330\004\034\230A\330\004\007\200u\210G\2207\230!\330\010\024\220I\230U\240!\330\010\021\220\021\220!\330\010\r\210Y\220a\330\004\007\200t\2104\210q\330\010\016\210j\230\001\230\021\330\t\r\210T\220\021\330\010\016\210j\230\001\230\021\330\t\r\210T\220\021\330\010\016\210j\230\001\230\021\330\t\r\210T\220\021\330\010\016\210i\220q\230\001\330\t\r\210T\220\021\330\010\016\210a\330\t\r\210T\220\021\330\010\016\210a\330\t\r\210S\220\001\330\010\016\210j\230\001\320\031S\320ST\320T_\320_`\320`a\340\004""\010\210\005\210U\220!\2203\220f\230A\230Q\330\010\013\210:\220Q\220c\230\021\230$\230a\330\014\022\220#\220Q\220a\340\004\007\200u\210B\210a\330\010\023\320\023/\250q\260\001\330\t\016\210b\220\001\330\010\023\2201\330\t\016\210b\220\001\330\010\023\2201\330\t\016\210b\220\001\330\010\023\320\0233\2601\260A\330\t\016\210d\220!\330\010\016\210j\230\001\320\031S\320ST\320T_\320_`\320`a\330\004\007\200t\2101\330\010\016\210c\220\021\220!\330\004\007\200\177\220g\230Q\330\010\022\220'\230\021\230!\330\010\022\220&\230\001\330\004\007\200q\330\010\016\210e\2209\230A\230V\240<\250y\270\010\300\001\300\021\330\004\013\2101\320\0040\260\001\330\036+\320+?\270q\330\0350\260\016\320>Q\320QR\330\0375\260Q\330!8\270\001\330\033\035\320\0351\3201A\300\021\330\036*\320*;\270?\310!\360t\010\000\t\014\2104\210v\220V\2302\320\0351\260\024\260Q\330\014\022\220)\2301\230A\340\010\013\2109\220C\220q\330\014\027\320\027*\250!\330\010\013\2104\210v\220V\2303\230b\240\004\240D\250\006\250g\260S\270\001\330\014\027\220t\2306\240\027\250\002\250!\330\010\016\210i\220q\230\006\230i\240w\250i\260q\330\026\"\240-\250w\260h\270n\310A\330\026!\240\034\250[\270\014\300K\310|\320[h\320hi\330\026#\240>\3201A\300\021\330\026%\320%5\3205F\300a\330\026\037\230z\250\036\260\177\300j\320PQ\330\026\"\240-\250v\260W\270J\300a\330\010\013\2101\340\014\017\210q\330\020\031\230\030\240\021\340\020\032\230!\340\014\017\210q\330\020\024\220E\230\025\230a\230w\240e\2501\250D\260\004\260A\330\024\027\220w\230a\230r\240\033\250B\250a\330\030$\240G\2501\250A\330\030\031\340\020\034\230A\330\014\026\220a\220y\240\010\250\004\250A\330\010\017\210q\2401\210\001\360\022\000\r\024\2201\220A\220R\220v\230Q\230a\230w\240g\250Q\2101\320\010#\2401\330\014\020\220\n\230!\330\014\020\220\010\230\004\230A\230Q\330\014\020\220\010\230\006\230a\230q\330\014\020\220\007\220x\230q\240\004\240A\320\004\037\230|\2501\330\010\014\210J\220a\330\010\014\210I\220Q\330\010\014\210H\220D\230\001\230\021\330\010\014\210O\2304\230q\240""\001\320\0002\260!\360@\001\000\005\r\210B\320\016 \240\001\240\027\250\006\250b\260\001\330\004\007\200u\210F\220#\220Q\330\010\016\210i\220q\230\001\330\004\007\200u\210F\220!\2203\220b\230\001\330\010\016\210j\230\001\230\021\330\004/\250q\330\004\030\230\005\230V\2401\240A\330\004\034\230K\240v\250Q\330\004-\250R\250v\260Q\260f\270F\300\"\300A\330\004\033\230;\240d\250!\330\004\036\230a\330\004\007\200u\210G\2201\330\010\020\220\017\230q\330\004\023\220?\240!\2404\240x\250v\260Y\270h\300a\330\004\007\200t\2103\210a\330\010\016\210j\230\001\230\021\330\t\r\210S\220\001\330\010\016\210l\230!\2301\330\004-\250R\250v\260Q\260f\270F\300\"\300A\330\004\033\230;\240d\250!\330\004\n\210)\2201\220D\230\010\240\006\240h\250h\260a\330\004\007\200t\2103\210a\330\010\016\210l\230!\2301\330\004\013\2107\220!\320\0002\260!\360D\003\000\005\014\2107\220$\220f\230L\250\001\250\025\250h\260f\270J\300a\360\006\000\0050\250r\260\026\260q\270\003\2701\270I\300V\3101\330\004\010\210\005\210U\220!\2203\220a\220q\340\010\032\230!\330\010\014\210F\220%\220q\230\004\230A\330\014\017\210r\220\024\220Q\220e\2301\230C\230s\240!\330\020#\2401\240B\240a\330\010\022\220!\2205\230\001\340\004\032\230!\2301\230B\230d\240%\240u\250A\250T\260\032\2704\270u\300E\310\021\310$\310a\330\004\032\230!\2301\230B\230d\240%\240u\250A\250T\260\032\2704\270u\300E\310\021\310$\310a\330\004\032\230!\2301\230B\230d\240%\240u\250A\250T\260\032\2704\270u\300E\310\021\310$\310a\330\004\034\230A\230S\240\004\240E\250\025\250a\250t\2601\330\004\027\220q\230\001\230\022\2306\240\022\2402\240T\250\027\260\006\260d\270$\270e\3005\310\001\310\024\310Z\320W[\320[`\320`e\320ef\320fj\320jk\330\004\027\220q\230\001\230\022\2306\240\022\2402\240T\250\027\260\006\260d\270$\270e\3005\310\001\310\024\310Z\320W[\320[`\320`e\320ef\320fj\320jk\330\004\027\220q\230\001\230\022\2306\240\022\2402\240T\250\027\260\006\260d\270$\270e\3005\310\001\310\024\310Z\320W[\320[`\320`e\320ef\320fj\320jk\330\004\031\230\021\230\"\230F\240\"\240B""\240d\250'\260\026\260u\270D\300\005\300U\310!\3104\310q\330\004\032\230!\2302\230V\2402\240R\240t\2507\260&\270\005\270T\300\025\300e\3101\310D\320PQ\340\0043\2602\260V\2702\270R\270t\3007\310&\320PQ\340\004\010\210\006\210g\220Y\230c\240\021\240'\250\031\260!\330\010\020\220\002\220'\230\021\230\"\230B\230e\2401\240A\330\010\017\210r\220\031\230!\2305\240\002\240\"\240C\240q\330\010\017\210r\220\027\230\001\230\024\230Q\230d\240$\240f\250A\250Q\330\010\014\210C\210u\220C\220q\230\005\230Q\330\014\020\220\005\220U\230!\2304\230q\330\020\036\230a\230r\240\026\240u\250A\250R\250s\260#\260R\260t\2702\270W\300A\300Q\330\014\025\220Q\220e\2301\230F\240\"\240L\260\002\260)\2701\270E\300\021\300$\300a\330\014\017\210q\220\003\2202\220T\230\022\2303\230d\240&\250\001\250\021\330\020\031\230\021\230%\230q\240\003\2401\240E\250\021\250#\250W\260A\260Q\260d\270!\2702\270Q\270d\300!\3004\300r\310\022\3101\330\020\026\220a\220u\230A\230S\240\001\240\025\240a\240v\250R\250|\2702\270V\3001\300E\310\021\310#\310Q\310e\320ST\320TX\320XY\330\021\022\220\"\220B\220d\230\"\230C\230t\2406\250\021\250!\330\020\031\230\021\230%\230q\240\003\2401\240E\250\021\250#\250W\260A\260Q\260d\270!\2702\270Q\270d\300!\3004\300r\310\022\3101\330\020\026\220a\220u\230A\230S\240\001\240\025\240a\240v\250R\250|\2702\270V\3001\300E\310\021\310#\310Q\310e\320ST\320TX\320XY\330\021\022\220\"\220B\220d\230!\2303\230d\240&\250\001\250\021\330\020\031\230\021\230%\230q\240\003\2401\240E\250\021\250!\2501\250C\250w\260a\260q\270\004\270A\270Q\270a\270r\300\021\300$\300a\300t\3102\310R\310q\330\020\026\220a\220u\230A\230S\240\001\240\025\240a\240q\250\001\250\026\250r\260\034\270R\270v\300Q\300e\3101\310C\310q\320PU\320UV\320VW\320WX\320X\\\320\\]\340\020\033\2301\230E\240\021\240#\240W\250A\250Q\250d\260!\2601\260A\260S\270\002\270$\270a\270t\3002\300R\300q\330\020\030\230\001\230\025\230a\230v\240R\240|\2602\260X\270Q\270e\3001\300D\310\001\330\004\010\210\005\210U\220!\2204\220q\330\010\023\2201\220E\230""\022\2306\240\021\240+\250Q\250c\260\027\270\001\270\033\300C\300q\310\013\320ST\320TX\320XZ\320Za\320ac\320ci\320ik\320km\320mp\320pw\320wx\320xy\330\010\014\210E\220\025\220a\220t\2301\330\014\025\220Q\220b\230\001\230\025\230b\240\006\240a\240y\260\001\260\022\2601\260C\260w\270a\270{\310#\310Q\310i\320WX\320XZ\320Z[\320[_\320_a\320ah\320hj\320jp\320pr\320rt\320tw\320w~\320~\177\360\000\000@\002A\002\330\014\025\220Q\220b\230\001\230\025\230b\240\006\240a\240y\260\001\260\022\2601\260C\260w\270a\270{\310#\310Q\310i\320WX\320XZ\320Z[\320[_\320_a\320ah\320hj\320jp\320pr\320rt\320tw\320w~\320~\177\360\000\000@\002A\002\330\014\025\220Q\220b\230\001\230\025\230b\240\006\240a\240y\260\001\260\022\2601\260C\260w\270a\270{\310#\310Q\310i\320WX\320XZ\320Z[\320[_\320_a\320ah\320hj\320jp\320pr\320rt\320tw\320w~\320~\177\360\000\000@\002A\002\330\004\013\2105\220\007\220w\230d\240,\250k\270\033\300K\310}\320\\g\320go\320ow\320w\177\360\000\000@\002A\002\320\0003\2601\3608\000\005\016\210R\320\017!\240\021\240(\250&\260\002\260!\330\004\007\200v\210V\2203\220a\330\010\016\210i\220q\230\001\330\004\007\200v\210V\2201\220C\220r\230\021\330\010\016\210j\230\001\230\021\330\0043\2601\330\004\030\230\n\240&\250\001\250\021\330\004\035\230[\250\n\260!\330\004-\250R\250v\260Q\260f\270F\300\"\300A\330\004\034\230K\240t\2501\330\004\036\230a\330\004\007\200u\210G\2201\330\010\020\220\017\230q\330\004\023\2209\230A\230T\240\030\250\026\250z\270\030\300\021\330\004\007\200t\2103\210a\330\010\016\210l\230!\2301\330\004\013\2101\320\0003\2601\360P\001\000\005\030\220q\330\004\033\2301\330\004 \240\001\330\004\032\230!\330\004\034\230A\330\004\013\2107\220&\320\030*\250!\2509\260G\2701\270H\300A\300Y\310a\310}\320\\]\320]c\320cd\320de\330\004\007\200t\2107\220!\330\010\016\210a\340\004\031\230\021\330\004\010\210\005\210U\220!\2201\330\010\021\220\033\230A\230Q\330\004\032\230*\320$7\260\177\300a\300q\330\004\033\2301\360\006\000\005\014\2108\320\023&\240a\240y\260\r\270U\300&\310\t\320QR""\320RS\330\004\007\200w\210c\220\021\330\010\016\210k\230\021\230!\340\t\n\330\010\016\210g\220Q\220i\230}\250H\260F\270%\270x\300x\310q\330\004\031\230\021\230)\240=\260\006\260a\340\004\005\330\010\r\210R\210v\220Q\220i\230v\240R\240q\340\010\022\220!\2201\330\010\016\210k\230\021\230!\340\004\031\230\021\330\004\010\210\005\210U\220!\2201\330\010\022\220&\230\001\230\022\2301\330\010\n\210!\2105\220\006\220a\220r\230\021\330\004\016\210a\210q\330\004\030\230\005\230W\240B\240b\250\004\250E\260\026\260r\270\023\270B\270e\3009\310B\310c\320QS\320SU\320UY\320YZ\320Zb\320bd\320df\320fh\320hi\330\004\n\210%\210q\220\006\220l\240%\240x\250q\260\010\270\005\270Q\270f\300L\320PU\320U]\320]^\320^f\320fh\320hi\320io\320o{\320{}\360\000\000~\001F\002\360\000\000F\002G\002\360\000\000G\002O\002\360\000\000O\002P\002\330\004\013\2101\200\001\340\004\013\2103\210a\210\001\360\034\000\r\024\2203\220a\220q\330\014\017\210t\2201\330\020\024\220E\230\027\240\004\240E\250\026\250r\260\025\260b\270\010\300\004\300E\310\033\320TU\340\020\024\220E\230\030\240\021\330\014\020\220\007\220w\230a\230t\2401\320\000%\320%5\260Q\360f\001\000\005\030\220t\2301\230A\340\004\n\210-\220z\320!4\260O\3001\300A\360\006\000\005\034\2301\330\004 \240\001\330\004\032\230!\330\004\034\230A\330\004\020\220\007\220v\320\035/\250q\260\t\270\027\300\001\300\035\310a\310y\320XY\320Yf\320fg\320gm\320mn\320no\330\004\007\200t\2107\220!\330\010\016\210a\340\004\034\230A\330\004\033\2301\330\004\035\230Q\330\004\020\220\006\320\026*\250!\2508\2601\260M\300\021\300)\3101\310A\330\004\007\200t\2101\330\010\035\230Q\230i\240}\260F\270!\330\010\016\210a\360\006\000\005 \230q\330\004\007\200q\330\010\024\320\024+\2501\250I\260Y\270i\300}\320TU\320UV\330\010\013\210:\220S\230\001\330\014!\240\021\240)\250=\270\006\270a\330\014\032\230!\2309\240A\330\014\022\220+\230Q\230a\360\006\000\n\013\330\010\013\2101\330\014\022\320\022\"\240!\2409\250M\270\030\300\026\300y\320PY\320YZ\320Ze\320ef\320fg\340\014\022\220*\230A""\230Y\240m\2608\2706\300\031\310)\320ST\320TU\330\004\031\230\021\230)\240=\260\006\260a\330\004\007\200q\330\010\027\220q\230\t\240\021\340\004\007\200t\2103\210a\330\010\016\320\016\"\240!\2409\250H\260H\270A\270Q\330\010\013\2101\330\014\022\220#\220Q\220a\330\004\022\220!\2209\230A\330\004\016\210a\330\004\007\200t\2103\210a\330\010\016\210j\230\001\230\021\330\t\r\210S\220\001\330\010\016\210j\230\001\230\021\330\004\007\200q\330\010\013\210<\220t\2301\330\014\023\2205\230\t\240\021\240!\330\r\016\330\014\023\2205\230\t\240\030\250\021\250!\330\r\016\330\014\023\2205\230\t\240\030\250\021\250!\340\014\023\2205\230\t\240\030\250\021\250*\260A\260Q\330\004\013\2101\320\000%\240]\260!\330\022&\320&9\270\021\360N\001\000\005\010\200{\220(\230)\2401\330\010\016\210i\220q\230\001\330\004\007\200{\220(\230)\2401\330\010\016\210i\220q\230\001\330\004\007\200y\220\010\230\t\240\021\330\010\016\210i\220q\230\001\330\004\007\200t\2101\210H\220C\220q\330\010\013\2106\220\026\220s\230\"\230D\240\006\240f\250C\250v\260Q\330\014\022\220*\230A\230Q\330\010\013\2106\220\030\230\023\230B\230d\240&\250\010\260\003\2606\270\021\330\014\022\220*\230A\230Q\340\010\024\220B\220e\2301\230H\240B\240f\250A\330\010\024\220B\220e\2301\230H\240B\240f\250A\330\010\024\220B\220e\2302\230W\240I\250R\250v\260Q\330\010\021\220\021\220)\2302\230W\240A\330\010\024\220B\220e\2302\230W\240I\250R\250v\260Q\330\010\021\220\021\220)\2302\230W\240A\330\010\022\220\"\220E\230\022\2307\240'\250\022\2506\260\021\330\010\022\220\"\220E\230\022\2307\240'\250\022\2506\260\021\330\010\024\220D\230\001\230\026\230z\250\023\250F\260$\260d\270!\2706\300\032\3103\310a\330\t\020\220\007\220q\330\010\016\210i\220q\230\001\360\006\000\t\025\220B\220f\230A\230Q\330\010\024\220B\220e\2301\230A\330\010\024\220B\220e\2302\230W\240I\250R\250q\330\010\024\220B\220e\2302\230W\240I\250R\250q\330\010\022\220\"\220F\230\"\230G\2401\330\010\022\220\"\220E\230\022\2307\240!\330\010\024\220A\340\004\007\200y\220\004\220C\220r""\230\024\230S\240\t\250\024\250S\260\002\260!\330\010\016\210j\230\001\230\021\330\004\007\200r\210\024\210Q\210g\220T\230\021\230%\230s\240\"\240E\250\023\250B\250d\260!\2607\270$\270a\270u\300C\300r\310\021\330\010\016\210j\230\001\230\021\330\004\007\200r\210\024\210Q\210i\220t\2301\230E\240\023\240B\240a\330\010\016\210j\230\001\230\021\340\004\007\200{\220#\220Q\330\010\025\220\\\240\036\250y\270\004\270D\300\t\310\024\310T\320Q[\320[]\320]^\330\010\020\220\n\230$\230a\230q\240\013\2502\250[\270\001\270\033\300A\300Q\340\010\020\220\002\220'\230\030\240\021\240*\250A\330\010\021\220\025\220d\230!\330\010\016\210b\220\004\220A\220V\2302\230[\250\003\2502\250T\260\021\260&\270\002\270!\330\014\024\220B\220g\230X\240Q\240j\260\001\330\014\025\220U\230$\230a\330\004\007\200{\220#\220Q\330\010\021\220\021\220)\2302\230W\240B\240d\250!\250:\260Q\260a\330\010\020\220\002\220$\220b\230\002\230$\230a\230z\250\021\250\"\250D\260\001\260\033\270A\270Q\340\010\020\220\002\220'\230\030\240\021\240*\250A\330\004\t\210\021\210\"\210D\220\001\220\027\230\002\230%\230q\330\004\t\210\021\210\"\210D\220\001\220\027\230\002\230%\230r\240\022\2405\250\004\250A\250U\260!\330\004\007\200y\220\003\2201\330\010\013\2101\330\014\022\220\"\220F\230\"\230G\2401\330\014\020\220\005\220U\230!\2301\330\020\023\2202\220R\220r\230\023\230A\330\024\027\220s\230%\230r\240\031\250!\2507\260!\2602\260S\270\007\270q\300\002\300#\300T\310\026\310q\320PR\320RS\320SU\320U[\320[\\\320\\]\340\024\027\220s\230%\230r\240\031\250!\2507\260!\2602\260S\270\007\270q\300\002\300#\300T\310\026\310q\320PR\320RS\320SU\320U[\320[\\\320\\]\330\014\022\220$\220b\230\003\2304\230q\240\005\240R\240x\250q\260\007\260q\340\014\027\220z\240\034\250W\260D\270\001\270\025\270d\300'\310\024\310Q\310e\320SW\320W_\320_a\320ab\330\014\022\220(\230%\230q\240\001\240\031\250\"\250I\260Q\260j\300\010\310\001\310\027\320PR\320RS\320ST\360\006\000\t\017\210b\220\007\220x\230q\240\010\250\001\330\010\016\210d\220\"\220C\220t\2301""\230E\240\022\2408\2501\250G\2601\330\010\016\210b\220\004\220A\220T\230\022\2309\240C\240r\250\024\250Q\250d\260\"\260A\330\014\022\220\"\220G\2308\2401\240H\250A\330\014\022\220$\220b\230\003\2304\230q\240\005\240R\240x\250q\260\007\260q\330\010\013\2101\330\014\023\2202\220X\230Q\230c\240\023\240A\330\014\022\220#\220Q\220a\330\004\014\210J\220a\220v\230V\2401\330\004\013\2101\200A\360\014\000\t\017\320\016!\240\021\240!\200A\3602\000\t%\240F\250!\2505\260\001\330\010\035\230S\240\001\240\021\330\010\013\2103\210c\220\037\240\001\240\022\2402\240Q\330\014\022\220*\230A\230Q\360\010\000\t\017\210a\210q\220\010\230\003\2305\240\013\2501\330\010\016\210a\210q\220\006\220c\230\025\230i\240q\320(9\270\021\330\010\016\210a\210q\220\007\220s\230%\230y\250\001\250\037\270\001\270\023\270A\330\010\036\230a\230q\240\017\250q\260\016\270b\300\001\300\021\300&\310\001\310\025\310a\310v\320UV\320VW\330\010\013\2104\210s\220!\330\014\022\220*\230A\320\035L\310A\320M`\320`a\360\000\000b\001L\002\360\000\000L\002M\002\360\000\000M\002g\002\360\000\000g\002h\002\360\000\000h\002i\002\330\010\036\230j\250\010\260\001\260\021\330\010\013\2109\320\024&\240a\240s\250(\260&\270\001\330\010\016\210a\210w\220a\220s\230&\240\010\250\003\2505\260\t\270\021\270/\310\021\310#\310Q\330\010\016\210a\210w\220a\220s\230&\240\007\240s\250%\250y\270\001\270\037\310\001\310\023\310A\330\010\016\210a\210w\220a\220s\230&\240\t\250\023\250E\260\031\270!\270?\310!\3103\310a\330\010\016\210a\210w\220c\230\026\230x\240s\250%\250y\270\001\270\037\310\001\310\021\310!\320K[\320[^\320^d\320dk\320kl\320lm\330\010\016\210a\210w\220c\230\026\230x\240s\250%\250y\270\001\270\037\310\001\310\021\310!\310>\320YZ\320Zh\320hi\320il\320lr\320r{\320{~\360\000\000\177\001E\002\360\000\000E\002L\002\360\000\000L\002M\002\360\000\000M\002P\002\360\000\000P\002V\002\360\000\000V\002]\002\360\000\000]\002^\002\360\000\000^\002_\002\330\010\016\210a\210w\220c\230\026\230v\240S\250\005\250Y\260a\260q\270\001\270\037\310""\001\310\036\320WY\320YZ\320Z[\320[^\320^d\320dl\320lm\320mp\320pv\320v}\320}~\360\000\000\177\001O\002\360\000\000O\002R\002\360\000\000R\002X\002\360\000\000X\002_\002\360\000\000_\002`\002\360\000\000`\002c\002\360\000\000c\002i\002\360\000\000i\002n\002\360\000\000n\002o\002\360\000\000o\002p\002\330\010\017\210q\200A\360&\000\t\014\2102\210[\230\001\230\024\230Q\320\036.\250b\260\001\330\014\023\220>\240\022\2403\240j\260\001\260\021\330\014\024\220A\330\r\033\2303\230a\330\014\024\220D\230\001\340\014\022\220*\230A\320\035@\300\001\300\024\300Q\300a\330\010\017\210q\200A\360\"\000\t\014\2102\210[\230\001\230\024\230Q\230k\250\022\2501\330\014\023\2209\230B\230c\240\032\2501\250A\330\014\025\220Q\330\r\026\220c\230\021\330\014\025\220T\230\021\340\014\022\220*\230A\320\035;\2701\270D\300\001\300\021\330\010\017\210q\200A\340\010\017\320\017\"\240!\2404\240q\200A\360\"\000\t\014\2104\210q\220\013\2303\230a\330\014\017\210x\220s\230!\330\020\034\230B\230j\250\002\250\"\250A\330\021\032\230#\230Q\330\020\034\230B\230j\250\001\340\020\026\220j\240\001\320!i\320ij\320jk\330\r\027\220w\230e\2404\240r\250\033\260A\260T\270\021\270,\300a\330\014\023\220:\230R\230s\240*\250A\250Q\330\014\025\220Z\230q\330\r\027\220s\230!\330\014\025\220T\230\021\340\014\022\220*\230A\320\035e\320ef\320fg\330\010\017\210q\200A\340\010\013\2104\210t\2206\230\026\230r\240\021\330\014\032\230!\2304\230q\200A\330\010\013\2109\220C\220q\330\014\020\220\006\220a\200A\360\"\000\t\014\2109\220G\2305\240\004\240B\240k\260\021\260$\260a\260z\300\021\330\014\023\2209\230B\230c\240\032\2501\250A\330\014\025\220Q\330\r\026\220c\230\021\330\014\025\220T\230\021\340\014\022\220*\230A\320\0359\270\021\270$\270a\270q\330\010\017\210q\210A\360\022\000\021\035\230A\200A\360\030\000\t%\240F\250!\2505\260\001\330\r\024\220A\220U\230!\2301\230O\2502\250T\260\026\260w\270b\300\001\300\021\300$\300f\310G\320ST\320TX\320X^\320^d\320de\320eg\320gh\320hi\330\010\016\210a\210s\220%\220{\240'\250\021\250$\250f\260I""\270Q\330\010\016\210a\210s\220%\220y\240\001\320!2\260'\270\021\270$\270f\300G\3101\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\023\260G\2701\270D\300\006\300h\310a\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\023\260G\2701\270D\300\006\300h\310a\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\023\260G\2701\270D\300\006\300g\310Q\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\023\260G\2701\270D\300\006\300i\310q\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\021\260!\3203C\3007\310$\310f\320T\\\320\\`\320`f\320fm\320mn\320no\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\021\260!\260>\300\021\300$\300f\310G\320ST\320Td\320dk\320ko\320ou\320u~\360\000\000\177\001C\002\360\000\000C\002I\002\360\000\000I\002P\002\360\000\000P\002R\002\360\000\000R\002T\002\360\000\000T\002U\002\360\000\000U\002V\002\330\010\016\210a\210s\220%\220y\240\001\240\037\260\001\260\021\260!\260>\300\021\300$\300f\310G\320SU\320UY\320Y_\320_f\320fg\320gi\320ij\320jz\360\000\000{\001B\002\360\000\000B\002F\002\360\000\000F\002L\002\360\000\000L\002R\002\360\000\000R\002V\002\360\000\000V\002\\\002\360\000\000\\\002a\002\360\000\000a\002b\002\360\000\000b\002f\002\360\000\000f\002l\002\360\000\000l\002s\002\360\000\000s\002t\002\360\000\000t\002u\002\330\010\017\210s\220(\230!\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017*\250$\250a\250w\260k\300\027\310\001\340\010\017\320\017*\250$\250a\250w\260k\300\021\200A\330\010\014\210G\2206\230\021\230!\210A\360\036\000\021\024\220:\230Q\230f\240A\330\024\025\330\020\023\2204\220v\230S\240\001\330\024\030\230\010\240\002\240&\250\002\250$\250h\260d\270)\3006\310\022\3101\330\024\030\230\003\2305\240\007\240q\250\005\250Q\250d\260)\2705\300\001\300\024\300Q\330\030\034\230E\240\021\240\"\240E\250\024\250Q\250b\260\001\260""\022\2601\260B\260a\340\024\030\230\003\2305\240\007\240q\250\005\250Q\250d\260)\2705\300\001\300\024\300Q\330\030\034\230E\240\021\240\"\240E\250\022\250<\260q\270\001\270\024\270U\300!\3002\300T\310\024\310Q\310b\320PQ\320QS\320ST\320TV\320VW\330\020\025\220U\230#\230Y\240a\240t\2508\2604\260z\300\024\300Q\330\020\025\220R\220{\240!\2401\330\020\024\220C\220u\230G\2401\240E\250\021\250$\250i\260u\270A\270T\300\021\330\024\030\230\005\230U\240!\2404\240u\250A\250R\250r\260\026\260q\270\002\270\"\270A\330\030\033\2304\230z\250\021\250\"\250A\250S\260\003\2601\330\034\036\230a\230r\240\022\2405\250\001\250\024\250U\260!\2602\260R\260s\270!\2701\270D\300\004\300E\310\021\310\"\310B\310c\320QR\320RS\320ST\320TU\320UV\340\034\036\230a\230r\240\022\2408\2501\250D\260\005\260Q\260b\270\002\270#\270Q\270a\270t\3004\300u\310A\310R\310r\320QT\320TU\320UV\320VW\320WX\320X^\320^b\320bn\320no\320oq\320qr\320rt\320tu\320uv\330\030\036\230g\240T\250\033\260A\260R\260q\330\030\032\230!\2302\230R\230y\250\001\250\021\330\030\032\230!\2302\230R\230y\250\001\250\021\330\020\023\2204\220u\230F\240!\2403\240c\250\021\330\024\030\230\007\230x\240q\250\001\340\024 \240\001\330\024\030\230\007\230w\240a\240q\200A\360\036\000\t\014\210:\220S\230\001\330\014\023\2204\220{\240!\330\010\017\210q\200A\360\036\000\t\014\210:\220S\230\001\330\014\023\2204\220q\330\010\017\210q\200A\340\010\016\210b\220\010\230\001\230\024\230Q\330\010\020\220\004\220F\230!\2301\330\010\020\220\004\220F\230!\2301\330\010\020\220\005\220S\230\001\330\010\016\210d\220$\220a\220q\330\010\036\230j\250\001\250\027\260\007\260u\270G\3004\300v\310Y\320V\\\320\\`\320`f\320fn\320nt\320tx\320x~\320~\177\330\010\013\2106\220\031\230!\330\010\017\210q\210A\330\020\026\220g\230T\240\025\240a\240r\250\021\250!\330\020\023\2205\230\003\2301\330\024\033\2302\230T\240\021\240$\240e\2501\250B\250b\260\005\260Q\330\020\023\2205\230\003\2301\330\024\033\2302\230T\240\021\240$\240e\2501\250B\250b\260\005\260Q\330\020\026\220g\230T""\240\025\240a\240r\250\021\250!\330\020\023\2205\230\003\2301\330\024\033\2302\230T\240\021\240$\240e\2501\250B\250b\260\003\2603\260a\330\020\023\2205\230\003\2301\330\024\033\2302\230T\240\021\240$\240e\2501\250B\250b\260\003\2603\260a\330\020\023\2205\230\003\2301\330\024\034\230A\330\024\034\230A\330\020\023\2205\230\003\2301\330\024\034\230A\330\024\034\230A\330\020\027\220q\230\006\230h\240f\250A\200A\330\010\017\210q\200A\330\010\017\210s\220!\2201\330\010\013\2104\210q\330\014\023\2204\220x\230q\240\006\240a\330\010\013\2104\210q\330\014\023\2205\230\002\230!\340\014\021\220\023\220A\220Q\330\014\023\2205\230\002\230%\230r\240\023\240B\240d\250'\260\022\2601\330\014\017\210s\220\"\220D\230\001\330\020\024\220I\230Q\330\010\014\210G\2206\230\021\230!\330\010\014\210G\2206\230\021\200A\330\010\017\210t\2205\230\001\200A\330\010\017\210t\2207\230\"\230H\240A\200A\360*\000\t\020\210z\230\021\230)\2404\240{\260!\2601\320\010F\300f\310A\360\030\000\r\024\2201\220A\220R\220v\230Q\230a\230q\240\007\240t\2501\250B\250e\2607\270$\270a\270r\300\025\300d\310%\310u\320TU\320U\\\320\\f\320fn\320np\320pq\230H\240C\240q\320\010J\310&\320PQ\360\032\000\r\024\2201\220A\220R\220v\230Q\230a\230w\240g\250X\260R\260v\270Q\270a\270q\300\007\300t\3101\310B\310e\320SZ\320Z^\320^_\320_a\320af\320fj\320jo\320ot\320tu\320u|\360\000\000}\001G\002\360\000\000G\002O\002\360\000\000O\002Q\002\360\000\000Q\002R\002\320\004 \240\001\360N\001\000\t\014\2104\210z\230\021\230&\240\001\330\014\022\220)\2301\230A\330\010\013\2104\210x\220s\230\"\230D\240\004\240H\250C\250u\260A\330\014\022\220*\230A\320\035A\300\021\300%\320Gd\320de\320ei\320ij\330\010\013\2104\210v\220S\230\002\230$\230d\240&\250\003\2505\260\001\330\014\022\220*\230A\320\035I\310\021\310%\320Oj\320jk\320ko\320op\330\010\017\210u\220A\330\010\021\220\025\220a\330\010\013\2104\210{\230#\230Q\330\014\030\230\002\230&\240\001\240\027\250\007\250q\260\001\330\r\027\220q\230\004\230K\240q\330\014\031\230\024\230[\250\002\250\"\250E""\260\021\260(\270'\300\021\300!\330\r\027\220q\230\004\230O\250:\260T\270\024\270Z\300v\310S\320PR\320RV\320VZ\320Zd\320dj\320jk\320kn\320nq\320qr\330\014\030\230\004\230J\240g\250Q\250a\340\014\022\220)\2301\230A\330\010\013\2104\210{\230#\230Q\330\014\030\230\002\230%\230q\240\007\240w\250a\250q\330\r\027\220q\230\004\230K\240q\330\014\031\230\024\230[\250\001\250\022\2505\260\001\260\030\270\027\300\001\300\021\330\r\027\220q\230\004\230O\250:\260T\270\024\270Z\300v\310S\320PR\320RV\320VZ\320Zd\320dj\320jk\320kn\320nq\320qr\330\014\030\230\004\230J\240g\250Q\250a\340\014\022\220)\2301\230A\330\010\013\2102\210T\220\021\220*\230B\230a\330\014\022\220*\230A\230Q\330\010\013\2104\210{\230#\230Q\330\014\030\230\002\230&\240\002\240'\250\030\260\027\270\001\270\021\330\r\027\220q\230\004\230K\240q\330\014\031\230\024\230[\250\002\250\"\250E\260\022\2607\270)\3007\310!\3101\330\014\025\220Q\220b\230\004\230A\230W\240B\240e\2501\330\r\027\220q\230\004\230O\250:\260T\270\024\270Z\300v\310S\320PR\320RV\320VZ\320Zd\320dj\320jk\320kn\320nq\320qu\320u\177\360\000\000@\002F\002\360\000\000F\002G\002\360\000\000G\002M\002\360\000\000M\002N\002\330\014\030\230\004\230J\240g\250Q\250a\340\014\022\220)\2301\230A\330\010\013\2102\210T\220\021\220)\2304\230q\240\005\240S\250\002\250!\330\014\022\220)\2301\230A\330\010\013\2104\210{\230#\230Q\330\014\030\230\002\230%\230r\240\027\250\010\260\007\260q\270\001\330\r\027\220q\230\004\230K\240q\330\014\031\230\024\230[\250\002\250\"\250E\260\022\2607\270)\3007\310!\3101\330\014\025\220Q\220b\230\004\230A\230W\240B\240e\2501\330\r\027\220q\230\004\230O\250:\260T\270\024\270Z\300v\310Q\310c\320QT\320TX\320Xb\320bh\320hi\320io\320op\330\014\030\230\004\230J\240g\250Q\250a\340\014\022\220)\2301\230A\330\010\013\2102\210T\220\021\220*\230B\230a\330\014\022\220*\230A\230Q\330\010\013\2104\210y\230\003\2301\330\014\026\220b\230\006\230b\240\007\240v\250W\260A\260Q\330\r\027\220q\230\004\230I\240Q\330\014\027\220t\2309\240B\240b\250\005\250R""\250w\260g\270W\300A\300Q\330\r\027\220q\230\004\230M\250\032\2604\260t\2708\3006\310\023\310B\310d\320RV\320V^\320^d\320de\320eh\320hk\320kr\320rv\320vz\360\000\000{\001C\002\360\000\000C\002I\002\360\000\000I\002J\002\360\000\000J\002M\002\360\000\000M\002P\002\360\000\000P\002Q\002\330\014\026\220d\230(\240'\250\021\250!\340\014\022\220)\2301\230A\330\010\013\2102\210T\220\021\220'\230\024\230Q\230e\2403\240b\250\001\330\014\022\220*\230A\230Q\330\010\013\2104\210y\230\003\2301\330\014\026\220b\230\005\230R\230w\240f\250G\2601\260A\330\r\027\220q\230\004\230I\240Q\330\014\027\220t\2309\240B\240b\250\005\250R\250w\260g\270W\300A\300Q\330\r\027\220q\230\004\230M\250\032\2604\260t\2708\3006\310\023\310B\310d\320RV\320V^\320^d\320de\320eh\320hk\320kr\320rv\320vz\360\000\000{\001C\002\360\000\000C\002I\002\360\000\000I\002J\002\360\000\000J\002M\002\360\000\000M\002P\002\360\000\000P\002Q\002\330\014\026\220d\230(\240'\250\021\250!\340\014\022\220)\2301\230A\340\010\013\2101\330\014\017\210r\220\024\220Q\220g\230T\240\021\240%\240s\250\"\250A\330\020\026\220j\240\001\240\021\330\014\017\210r\220\024\220Q\220h\230b\240\001\330\020\026\220j\240\001\240\021\330\014\017\210r\220\024\220Q\220j\240\002\240%\240x\250s\260\"\260D\270\001\270\032\3002\300U\310!\330\020\030\230\005\230Q\230a\330\014\017\210r\220\024\220Q\220j\240\002\240%\240x\250s\260\"\260D\270\001\270\032\3002\300U\310!\330\020\030\230\005\230Q\230a\330\014\017\210r\220\024\220Q\220h\230b\240\005\240V\2503\250b\260\004\260A\260X\270R\270u\300A\330\020\030\230\005\230Q\230a\330\010\017\210{\230+\240[\260\013\2709\300A\200\001\330\004\n\210+\220Q\320\000-\250Q\3604\000\005\010\200u\210B\210a\330\010\016\210j\230\001\230\021\330\004-\250R\250v\260Q\260f\270F\300\"\300A\330\004\033\230;\240d\250!\330\004\036\230a\330\004\007\200u\210G\2201\330\010\020\220\017\230q\330\004\023\2209\230A\230T\240\030\250\026\250x\260q\330\004\007\200t\2103\210a\330\010\016\210l\230!\2301\330\004\013\2101\320UV\240!\240\001\250""\001\210\001\320\000>\270a\330\020\032\320\032.\320.A\300\021\360n\001\000\005\032\230\032\320#6\260o\300Q\300a\340\004\033\2301\330\004 \240\001\330\004\035\230Q\330\004\036\230a\330\004!\240\021\330\004\013\2109\220L\240\006\320&>\270a\270y\310\007\310|\320[\\\320\\d\320de\320en\320no\320o|\320|}\360\000\000~\001H\002\360\000\000H\002I\002\360\000\000I\002R\002\360\000\000R\002S\002\360\000\000S\002T\002\330\004\007\200t\2107\220!\330\010\016\210a\340\004\031\230\023\230L\250\001\330\004\007\200q\330\010\r\210Z\220}\240A\240Y\250m\2709\300J\310m\320[`\320`h\320hi\330\010\013\2104\210z\230\021\230%\230q\330\014\025\220R\220v\230Q\230a\230q\240\004\240C\240t\2505\260\n\270&\300\002\300!\340\010\r\210Y\220h\230a\230y\250\r\260Y\270j\310\r\320UZ\320Zb\320bc\360\010\000\005\037\230a\230y\250\r\260Z\270y\310\001\340\004\007\200z\220\021\220%\220q\330\010\016\210a\330\t\r\210T\220\021\330\010\016\210j\230\001\230\021\330\t\r\210T\220\021\330\010\016\210j\230\001\230\021\330\t\r\210S\220\001\330\010\016\210l\230!\2301\340\004\016\210a\330\004\035\230R\230t\2401\240A\330\004\007\200q\330\010\013\2107\220\"\220E\230\023\230B\230b\240\004\240A\240X\250S\260\001\260\021\260!\330\004\007\200q\330\010\013\2107\220!\2201\330\004\007\200q\330\010\013\2107\220!\2206\230\030\240\021\240!\330\004\007\200q\330\010\013\2107\220!\2207\230(\240!\2401\330\004\007\200s\210!\2105\220\003\2201\330\010\016\210c\220\021\220!\340\010\016\210e\2201\220A\330\004\013\2101\320\004&\240a\340\010\024\220D\230\001\230\021\330\010\013\2104\210v\220W\230C\230r\240\023\240D\250\006\250h\260c\270\022\2703\270d\300&\310\010\320PS\320SU\320UZ\320Z]\320]_\320_e\320ef\320fj\320jp\320pq\330\014\022\220)\2301\230A\330\010\013\2104\210v\220V\2302\230Q\330\014\022\220)\2301\230A\330\010\013\2101\330\014\020\220\006\220i\230q\340\014\020\220\006\220i\230r\240\037\260\001\260\021\320\004-\320->\270a\330\031\032\360h\001\000\t\017\210h\220a\220v\230Y\240g\250V\2607\270*\300A\330\010\013\2101\330\014\027\220x\230q""\340\014\030\230\001\330\010\013\2101\330\014\017\210t\2206\230\026\230r\240\021\330\020\026\220i\230q\240\001\330\014\026\220a\220y\240\010\250\004\250A\330\010\017\210q\320\004\026\220k\240\037\260\017\270\177\310o\320]j\320jw\360\000\000x\001A\002\360\000\000A\002B\002\330\010\026\220a\330\010\013\2104\210z\230\021\230'\240\025\240c\250\024\250Z\260q\270\005\270U\300#\300W\310B\310b\320PS\320SX\320XZ\320Z[\330\014\022\220)\2301\230A\330\010\024\220L\240\013\250<\260q\330\024 \240\013\250<\260q\330\024\036\230i\240z\260\021\330\010\014\210F\220)\2308\2406\250\021\330\014\017\210z\230\021\230&\240\007\240s\250*\260A\260Z\270q\330\020\036\230a\330\020\023\220:\230Q\230j\250\001\330\024\027\220w\230c\240\021\330\030!\240\025\240f\250A\250Q\330\031 \240\003\2405\250\006\250a\250q\330\030\036\230j\250\001\320)c\320cd\320de\330\024\027\220u\230C\230z\250\023\250E\260\023\260A\330\030\033\2305\240\003\2401\330\034#\2405\250\006\250a\250q\330\035\"\240#\240U\250&\260\001\260\021\330\034\"\240*\250A\320-o\320op\320pq\330\021\027\220w\230a\330\020\026\220j\240\001\240\022\2401\320$R\320RS\320SW\320WX\320XY\330\010\013\2101\330\014\024\220E\230\021\230!\340\010\013\210:\220Q\220f\230A\330\014\017\210w\220c\230\021\330\020\027\220s\230%\230q\330\021\030\230\003\2305\240\001\330\020\026\220j\240\001\320!Y\320YZ\320Zf\320fg\320gl\320lm\330\014\017\210u\220C\220q\330\020\027\220u\230A\330\021\026\220c\230\025\230a\330\020\026\220j\240\001\320!a\320ab\320bl\320lm\320mr\320rs\330\014\020\220\n\230'\240\025\240d\250\"\250D\260\001\260\032\2702\270U\300)\3104\310z\320Y`\320`e\320ei\320ik\320ko\320op\320pz\320z|\360\000\000}\001B\002\360\000\000B\002C\002\330\020\026\220j\240\001\240\021\330\014\017\210z\230\021\230*\240A\330\020\023\2202\220T\230\021\230*\240B\240e\2506\260\021\260\"\260D\270\001\270\025\270h\300b\310\001\330\024\032\230*\240A\240Q\330\021\033\2301\230N\250!\330\020\023\2202\220T\230\021\230)\2401\240B\240d\250!\2505\260\010\270\002\270#\270R\270u\300F\310!\3102""\310T\320QR\320RW\320W_\320_a\320ab\330\024\032\230*\240A\240Q\330\014\017\210z\230\021\230*\240A\330\020\023\2202\220T\230\021\230*\240B\240e\2506\260\021\260\"\260D\270\001\270\025\270h\300b\310\001\330\024\032\230*\240A\240Q\330\021\033\2301\230N\250!\330\020\023\2202\220T\230\021\230)\2401\240B\240d\250!\2505\260\010\270\002\270#\270R\270u\300F\310!\3102\310T\320QR\320RW\320W_\320_a\320ab\330\024\032\230*\240A\240Q\330\014\020\220\010\230\007\230u\240D\250\002\250$\250a\250x\260r\270\025\270g\300T\310\030\320QX\320X]\320]a\320ac\320cg\320gh\320hp\320pr\320rw\320wx\330\020\026\220j\240\001\240\021\330\r\023\2207\230!\330\014\022\220*\230A\320\035E\300Q\300d\310!\3101\330\010\014\210M\230\035\240j\260\007\260z\300\021\330\010\014\210M\230\035\240j\260\007\260z\300\021\330\010\013\2102\210T\220\021\220$\220k\240\022\2404\240q\330\014\022\220*\230A\230Q\330\010\014\210M\230\035\240j\260\007\260z\300\021\330\010\014\210M\230\035\240j\260\007\260z\300\021\330\010\014\210K\220{\240(\250'\260\032\2701\330\010\014\210K\220{\240(\250'\260\032\2701\330\010\013\2102\210T\220\021\220$\220i\230r\240\024\240Q\330\014\022\220*\230A\230Q\330\010\014\210H\220A\330\010\014\210J\220a\330\010\014\210I\220Q\240q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2209\230H\240A\240Q\330\004\007\200|\2207\230!\330\010+\2501\250L\270\016\300a\330\004\013\2101\200\001\330\004'\240q\250\006\250a\320\014'\240y\260\001\330\0314\260A\330\031+\2501\330\020\023\2203\220a\220v\230S\240\006\240c\250\023\250A\250V\2603\260a\330\024\032\230*\240A\240Q\330\020'\240q\330\024\032\230*\240A\240Q\330\020#\2401\330\024\032\230*\240A\240Q\330\020\024\220J\230a\330\020\024\220I\230Q\330\020\024\220I\230Q\330\020\024\220H\230A\330\020\024\220H\230A\330\020\024\220H\230A\330\020\024\220J\230a\330\020\024\220M\240\021\330\020\024\220O\240?\260,\270g\300Z\310q\320PQ\320QV\320VZ\320Z^\320^c\320ch\320hi\320iq\320qu\320uz\320z\177\360\000\000@\002A\002\360\000\000A\002B\002O";
    PyObject *data = NULL;
    CYTHON_UNUSED_VAR(__Pyx_DecompressString);
    #endif
    PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
    Py_ssize_t pos = 0;
    for (int i = 0; i < 743; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
      if (likely(string) && i >= 270) PyUnicode_InternInPlace(&string);
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
      stringtab[i] = string;
      pos += bytes_length;
    }
    for (int i = 743; i < 807; i++) {
      Py_ssize_t bytes_length = index[i].length;
      PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
      stringtab[i] = string;
      pos += bytes_length;
      if (unlikely(!string)) {
        Py_XDECREF(data);
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    Py_XDECREF(data);
    for (Py_ssize_t i = 0; i < 807; i++) {
      if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
        __PYX_ERR(0, 1, __pyx_L1_error)
      }
    }
    #if CYTHON_IMMORTAL_CONSTANTS
    {
      PyObject **table = stringtab + 743;
      for (Py_ssize_t i=0; i<64; ++i) {
        #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
        #else
        Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
        #endif
      }
    }
    #endif
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
    double const c_constants[] = {0.0,1.0,1e-5,1e-14};
    for (int i = 0; i < 4; i++) {
      numbertab[i] = PyFloat_FromDouble(c_constants[i]);
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  {
    PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 4;
    int8_t const cint_constants_1[] = {0,-1,1,-2,2,3,7,8};
    int16_t const cint_constants_2[] = {2046};
    int32_t const cint_constants_4[] = {136983863L,238750788L};
    for (int i = 0; i < 11; i++) {
      numbertab[i] = PyLong_FromLong((i < 8 ? cint_constants_1[i - 0] : (i < 9 ? cint_constants_2[i - 8] : cint_constants_4[i - 9])));
      if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #if CYTHON_IMMORTAL_CONSTANTS
  {
    PyObject **table = __pyx_mstate->__pyx_number_tab;
    for (Py_ssize_t i=0; i<15; ++i) {
      #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
      #else
      Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
      #endif
    }
  }
  #endif
  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: init_codeobjects ### */
typedef struct {
    unsigned int argcount : 5;
    unsigned int num_posonly_args : 1;
    unsigned int num_kwonly_args : 1;
    unsigned int nlocals : 6;
    unsigned int flags : 10;
    unsigned int first_line : 12;
} __Pyx_PyCode_New_function_description;
/* NewCodeObj.proto */
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        PyObject *line_table,
        PyObject *tuple_dedup_map
);


static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  PyObject* tuple_dedup_map = PyDict_New();
  if (unlikely(!tuple_dedup_map)) return -1;
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 285};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 287};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 287};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_xx, __pyx_mstate->__pyx_n_u_yy};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_UV, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1290};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__24, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1291};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__24, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1292};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__25, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3093};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_model};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3702};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__26, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 142};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_text};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 150};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 158};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_call, __pyx_mstate->__pyx_kp_b_iso88591_A_t7_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 161};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_enter, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 164};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exc_type, __pyx_mstate->__pyx_n_u_exc_val, __pyx_mstate->__pyx_n_u_exc_tb};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_exit, __pyx_mstate->__pyx_kp_b_iso88591_A_9Cq_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 171};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_buffer, __pyx_mstate->__pyx_n_u_keep, __pyx_mstate->__pyx_n_u_single_line};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_1_Ja_IQ_HD_O4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 177};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_ln};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_s_1_4q_4xq_a_4q_5_AQ_5_r_Bd_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 191};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_G6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 211};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_buffer, __pyx_mstate->__pyx_n_u_keep};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_1_AQ_aq_xq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 217};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_test_2};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_3aq_t1_E_E_r_b_E_TU_E_wat1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 238};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591__27, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 280};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stream, __pyx_mstate->__pyx_n_u_nrows, __pyx_mstate->__pyx_n_u_ncols, __pyx_mstate->__pyx_n_u_xlim, __pyx_mstate->__pyx_n_u_ylim, __pyx_mstate->__pyx_n_u_plot_kwargs, __pyx_mstate->__pyx_n_u_plot_type, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_y_4A_1_3avS_c_AV3a_AQ_q_AQ_1_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 299};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_fig, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_xlim, __pyx_mstate->__pyx_n_u_ylim};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_mstate->__pyx_kp_b_iso88591_A_QfA_4vS_hd_6_1_5_q_Qd_5_Q_E_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 340};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_xmin, __pyx_mstate->__pyx_n_u_xmax, __pyx_mstate->__pyx_n_u_ymin, __pyx_mstate->__pyx_n_u_ymax};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_xylim, __pyx_mstate->__pyx_kp_b_iso88591_A_gT_ar_5_1_2T_e1Bb_Q_5_1_2T_e1B, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 359};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_mstate->__pyx_kp_b_iso88591_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 370};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_niter, __pyx_mstate->__pyx_n_u_new_2, __pyx_mstate->__pyx_n_u_current, __pyx_mstate->__pyx_n_u_old, __pyx_mstate->__pyx_n_u_iter_time, __pyx_mstate->__pyx_n_u_total_time};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_plot_bic, __pyx_mstate->__pyx_kp_b_iso88591_1ARvQawgQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 381};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_niter, __pyx_mstate->__pyx_n_u_new_2, __pyx_mstate->__pyx_n_u_current, __pyx_mstate->__pyx_n_u_old, __pyx_mstate->__pyx_n_u_iter_time, __pyx_mstate->__pyx_n_u_total_time, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_plot_obs, __pyx_mstate->__pyx_kp_b_iso88591_FfA_1ARvQaq_t1Be7_ar_d_uTUU_ffn, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 395};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_niter, __pyx_mstate->__pyx_n_u_new_2, __pyx_mstate->__pyx_n_u_current, __pyx_mstate->__pyx_n_u_old, __pyx_mstate->__pyx_n_u_iter_time, __pyx_mstate->__pyx_n_u_total_time, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_plot_bic_obs, __pyx_mstate->__pyx_kp_b_iso88591_J_PQ_1ARvQawgXRvQaq_t1BeSZZ___a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 437};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_HCq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 527};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_iter, __pyx_mstate->__pyx_n_u_m_iter};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_max_iter, __pyx_mstate->__pyx_kp_b_iso88591_A_9G5_Bk_az_9Bc_1A_Q_c_T_A_9_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 553};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_time, __pyx_mstate->__pyx_n_u_m_time};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_max_time, __pyx_mstate->__pyx_kp_b_iso88591_A_2_Qk_1_9Bc_1A_Q_c_T_A_1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 579};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_converged_min, __pyx_mstate->__pyx_n_u_c_min};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_converged_min, __pyx_mstate->__pyx_kp_b_iso88591_A_2_Q_b_3j_A_3a_D_A_Qa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 607};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_n_core};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_num_cores, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_3a_xs_Bj_A_Q_Bj_j_iijjk_we4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 640};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_formatter};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_formatter, __pyx_mstate->__pyx_kp_b_iso88591_A_S_4q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 659};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_outstream};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_outstream, __pyx_mstate->__pyx_kp_b_iso88591_A_S_4_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 678};
    PyObject* const varnames[] = {0};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_get_stdout, __pyx_mstate->__pyx_kp_b_iso88591_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_awk_awk, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 976};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_arr};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_tobytes, __pyx_mstate->__pyx_kp_b_iso88591_A_F_5_AU_1O2T_wb_fGSTTXX_ddeeggh, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1001};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls, __pyx_mstate->__pyx_n_u_buffer, __pyx_mstate->__pyx_n_u_buf, __pyx_mstate->__pyx_n_u_ln, __pyx_mstate->__pyx_n_u_nstate, __pyx_mstate->__pyx_n_u_ndet_2, __pyx_mstate->__pyx_n_u_nphot, __pyx_mstate->__pyx_n_u_eln, __pyx_mstate->__pyx_n_u_new_2};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_frombytes, __pyx_mstate->__pyx_kp_b_iso88591_A2_F_5_S_3c_2Q_AQ_aq_5_1_aq_c_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1232};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_converged_2};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_set_converged, __pyx_mstate->__pyx_kp_b_iso88591_a_D_4vWCr_D_hc_3d_PSSUUZZ___eef, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1244};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_srt, __pyx_mstate->__pyx_n_u_prior, __pyx_mstate->__pyx_n_u_trans, __pyx_mstate->__pyx_n_u_obs, __pyx_mstate->__pyx_n_u_out};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_sort_states, __pyx_mstate->__pyx_kp_b_iso88591_A_b_Q_F_1_F_1_S_d_aq_j_uG4vYV_ff, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1275};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_normalize, __pyx_mstate->__pyx_kp_b_iso88591_A_4t6_r_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1280};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1284};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_copy_2, __pyx_mstate->__pyx_kp_b_iso88591_A_t5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {22, 0, 0, 26, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1295};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_max_iter, __pyx_mstate->__pyx_n_u_bounds_func, __pyx_mstate->__pyx_n_u_bounds, __pyx_mstate->__pyx_n_u_bounds_kwargs, __pyx_mstate->__pyx_n_u_print_func, __pyx_mstate->__pyx_n_u_print_freq, __pyx_mstate->__pyx_n_u_print_args, __pyx_mstate->__pyx_n_u_print_kwargs, __pyx_mstate->__pyx_n_u_print_stream, __pyx_mstate->__pyx_n_u_print_formatter, __pyx_mstate->__pyx_n_u_print_fmt_args, __pyx_mstate->__pyx_n_u_print_fmt_kwargs, __pyx_mstate->__pyx_n_u_max_time, __pyx_mstate->__pyx_n_u_converged_min, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_reset_niter, __pyx_mstate->__pyx_n_u_gamma, __pyx_mstate->__pyx_n_u_opt_array, __pyx_mstate->__pyx_n_u_inplace, __pyx_mstate->__pyx_n_u_out_model, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_out_arr, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_optimize, __pyx_mstate->__pyx_kp_b_iso88591_0_q_0_QQR_5Q_8_11A_t_4vV2_1_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1614};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_gamma, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_inplace, __pyx_mstate->__pyx_n_u_out_model, __pyx_mstate->__pyx_n_u_out};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_evaluate, __pyx_mstate->__pyx_kp_b_iso88591_a_h_havYgV7_A_1_xq_1_t6_r_iq_ay, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {10, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1807};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_min_prior, __pyx_mstate->__pyx_n_u_max_prior, __pyx_mstate->__pyx_n_u_min_trans, __pyx_mstate->__pyx_n_u_max_trans, __pyx_mstate->__pyx_n_u_min_obs, __pyx_mstate->__pyx_n_u_max_obs, __pyx_mstate->__pyx_n_u_nstate, __pyx_mstate->__pyx_n_u_ndet_2, __pyx_mstate->__pyx_n_u_none_kwargs, __pyx_mstate->__pyx_n_u_arg_list, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_param};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_mstate->__pyx_kp_b_iso88591_k_o_jjw_x_A_A_B_a_4z_c_Zq_U_WBb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1873};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_warning, __pyx_mstate->__pyx_n_u_ndet_2, __pyx_mstate->__pyx_n_u_nstate, __pyx_mstate->__pyx_n_u_min_prior, __pyx_mstate->__pyx_n_u_max_prior, __pyx_mstate->__pyx_n_u_min_trans, __pyx_mstate->__pyx_n_u_max_trans, __pyx_mstate->__pyx_n_u_min_obs, __pyx_mstate->__pyx_n_u_max_obs};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_make_model, __pyx_mstate->__pyx_kp_b_iso88591_N_4z_1A_4xs_D_HCuA_A_A_Gddeeiij, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1992};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_model};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_make_model_2, __pyx_mstate->__pyx_kp_b_iso88591_A_z_4_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 26, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2016};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_nstate, __pyx_mstate->__pyx_n_u_ndet_2, __pyx_mstate->__pyx_n_u_bounds, __pyx_mstate->__pyx_n_u_trans_scale, __pyx_mstate->__pyx_n_u_prior_dist, __pyx_mstate->__pyx_n_u_trans_dist, __pyx_mstate->__pyx_n_u_obs_dist, __pyx_mstate->__pyx_n_u_prior, __pyx_mstate->__pyx_n_u_min_prior, __pyx_mstate->__pyx_n_u_max_prior, __pyx_mstate->__pyx_n_u_trans, __pyx_mstate->__pyx_n_u_min_trans, __pyx_mstate->__pyx_n_u_max_trans, __pyx_mstate->__pyx_n_u_obs, __pyx_mstate->__pyx_n_u_min_obs, __pyx_mstate->__pyx_n_u_max_obs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_const_obs, __pyx_mstate->__pyx_n_u_prior_alpha, __pyx_mstate->__pyx_n_u_prior_beta, __pyx_mstate->__pyx_n_u_prior_sigma, __pyx_mstate->__pyx_n_u_obs_alpha, __pyx_mstate->__pyx_n_u_obs_beta, __pyx_mstate->__pyx_n_u_obs_sigma, __pyx_mstate->__pyx_n_u_sort, __pyx_mstate->__pyx_n_u_model};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_factory_h2mm_model, __pyx_mstate->__pyx_kp_b_iso88591_9_N_1_iq_1_iq_y_iq_t1HCq_6_s_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {21, 0, 0, 55, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2597};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_max_iter, __pyx_mstate->__pyx_n_u_bounds_func, __pyx_mstate->__pyx_n_u_bounds, __pyx_mstate->__pyx_n_u_bounds_kwargs, __pyx_mstate->__pyx_n_u_print_func, __pyx_mstate->__pyx_n_u_print_freq, __pyx_mstate->__pyx_n_u_print_args, __pyx_mstate->__pyx_n_u_print_kwargs, __pyx_mstate->__pyx_n_u_print_stream, __pyx_mstate->__pyx_n_u_print_formatter, __pyx_mstate->__pyx_n_u_print_fmt_args, __pyx_mstate->__pyx_n_u_print_fmt_kwargs, __pyx_mstate->__pyx_n_u_max_time, __pyx_mstate->__pyx_n_u_converged_min, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_reset_niter, __pyx_mstate->__pyx_n_u_gamma, __pyx_mstate->__pyx_n_u_opt_array, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_gamma_2, __pyx_mstate->__pyx_n_u_opt_array_2, __pyx_mstate->__pyx_n_u_mdl, __pyx_mstate->__pyx_n_u_limits, __pyx_mstate->__pyx_n_u_print_strings, __pyx_mstate->__pyx_n_u_prnt_strct, __pyx_mstate->__pyx_n_u_print_fmtr, __pyx_mstate->__pyx_n_u_ptr_print_func, __pyx_mstate->__pyx_n_u_bound_func, __pyx_mstate->__pyx_n_u_bnds, __pyx_mstate->__pyx_n_u_bound, __pyx_mstate->__pyx_n_u_bnd_ptr, __pyx_mstate->__pyx_n_u_single, __pyx_mstate->__pyx_n_u_nbursts, __pyx_mstate->__pyx_n_u_burst_sizes, __pyx_mstate->__pyx_n_u_idxs, __pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_shape, __pyx_mstate->__pyx_n_u_indxs, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_nphot, __pyx_mstate->__pyx_n_u_gamma_arr, __pyx_mstate->__pyx_n_u_gamma_out, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_out_arr_size, __pyx_mstate->__pyx_n_u_out_arr, __pyx_mstate->__pyx_n_u_nout, __pyx_mstate->__pyx_n_u_conv_2, __pyx_mstate->__pyx_n_u_niter, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_print_err, __pyx_mstate->__pyx_n_u_bound_err, __pyx_mstate->__pyx_n_u_out_text};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_EM_H2MM_C, __pyx_mstate->__pyx_kp_b_iso88591_0_Q_1_31_Q_U_s_A_z_2B_q_t6_2_Zt, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3192};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_models, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_gamma, __pyx_mstate->__pyx_n_u_gamma_2, __pyx_mstate->__pyx_n_u_limits, __pyx_mstate->__pyx_n_u_burstsingle, __pyx_mstate->__pyx_n_u_nbursts, __pyx_mstate->__pyx_n_u_burst_sizes, __pyx_mstate->__pyx_n_u_idxs, __pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_burstshape, __pyx_mstate->__pyx_n_u_indxs, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_modelsingle, __pyx_mstate->__pyx_n_u_nmodels, __pyx_mstate->__pyx_n_u_out_mod, __pyx_mstate->__pyx_n_u_modelshape, __pyx_mstate->__pyx_n_u_gamma_out, __pyx_mstate->__pyx_n_u_gamma_arr, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_out};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_H2MM_arr, __pyx_mstate->__pyx_kp_b_iso88591_5Qf_t1A_z_4O1A_1_A_v_q_ayXYYffg, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3334};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_h_mod, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_single, __pyx_mstate->__pyx_n_u_nbursts, __pyx_mstate->__pyx_n_u_burst_sizes, __pyx_mstate->__pyx_n_u_idxs, __pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_shape, __pyx_mstate->__pyx_n_u_indxs, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_nphot, __pyx_mstate->__pyx_n_u_n_core, __pyx_mstate->__pyx_n_u_cpaths, __pyx_mstate->__pyx_n_u_paths, __pyx_mstate->__pyx_n_u_scale, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_ll, __pyx_mstate->__pyx_n_u_loglik, __pyx_mstate->__pyx_n_u_icl, __pyx_mstate->__pyx_n_u_out};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_viterbi_path, __pyx_mstate->__pyx_kp_b_iso88591_31P_q_1_A_7_9G1HAYa_ccdde_t7_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 46, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3414};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hmod, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_st, __pyx_mstate->__pyx_n_u_paths, __pyx_mstate->__pyx_n_u_scale, __pyx_mstate->__pyx_n_u_ll, __pyx_mstate->__pyx_n_u_icl, __pyx_mstate->__pyx_n_u_burst_type, __pyx_mstate->__pyx_n_u_burst_type_temp, __pyx_mstate->__pyx_n_u_dwell_mid, __pyx_mstate->__pyx_n_u_dwell_beg, __pyx_mstate->__pyx_n_u_dwell_end, __pyx_mstate->__pyx_n_u_dwell_burst, __pyx_mstate->__pyx_n_u_ph_mid, __pyx_mstate->__pyx_n_u_ph_beg, __pyx_mstate->__pyx_n_u_ph_end, __pyx_mstate->__pyx_n_u_ph_burst, __pyx_mstate->__pyx_n_u_ph_counts, __pyx_mstate->__pyx_n_u_time, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_ph_counts_temp, __pyx_mstate->__pyx_n_u_demar, __pyx_mstate->__pyx_n_u_begs, __pyx_mstate->__pyx_n_u_ends, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_viterbi_sort, __pyx_mstate->__pyx_kp_b_iso88591_2_D_7_fL_hfJa_0r_q_1IV1_U_3aq_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {9, 0, 0, 28, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3635};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_model, __pyx_mstate->__pyx_n_u_indexes, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_state_path, __pyx_mstate->__pyx_n_u_num_cores, __pyx_mstate->__pyx_n_u_BIC, __pyx_mstate->__pyx_n_u_total_loglik, __pyx_mstate->__pyx_n_u_loglikarray, __pyx_mstate->__pyx_n_u_loglikpath, __pyx_mstate->__pyx_n_u_ncore, __pyx_mstate->__pyx_n_u_single, __pyx_mstate->__pyx_n_u_nbursts, __pyx_mstate->__pyx_n_u_burst_sizes, __pyx_mstate->__pyx_n_u_cdeltas, __pyx_mstate->__pyx_n_u_cindexes, __pyx_mstate->__pyx_n_u_cstate_path, __pyx_mstate->__pyx_n_u_shape, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_nphot, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_loglikp, __pyx_mstate->__pyx_n_u_loglik, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_sum_loglik, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_l};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_path_loglik, __pyx_mstate->__pyx_kp_b_iso88591_a_A_n_6oQa_1_Q_a_9L_ay_ddeennoo, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3741};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hmod, __pyx_mstate->__pyx_n_u_lenp, __pyx_mstate->__pyx_n_u_seed, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_path_n, __pyx_mstate->__pyx_n_u_seedp, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_sim_statepath, __pyx_mstate->__pyx_kp_b_iso88591_Q4_uBa_j_RvQfF_A_d_a_uG1_q_9AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3780};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hmod, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_seed, __pyx_mstate->__pyx_n_u_times_arr, __pyx_mstate->__pyx_n_u_lenp, __pyx_mstate->__pyx_n_u_times_n, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_path_n, __pyx_mstate->__pyx_n_u_seedp, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_sim_sparsestatepath, __pyx_mstate->__pyx_kp_b_iso88591_0_B_b_uF_Q_iq_uF_3b_j_2_6_Ky_Rv, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3831};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hmod, __pyx_mstate->__pyx_n_u_states_2, __pyx_mstate->__pyx_n_u_seed, __pyx_mstate->__pyx_n_u_states_arr, __pyx_mstate->__pyx_n_u_lenp, __pyx_mstate->__pyx_n_u_states_n, __pyx_mstate->__pyx_n_u_dets, __pyx_mstate->__pyx_n_u_dets_n, __pyx_mstate->__pyx_n_u_seedp, __pyx_mstate->__pyx_n_u_exp};
    __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_sim_phtraj_from_state, __pyx_mstate->__pyx_kp_b_iso88591_318_R_vV3a_iq_vV1Cr_j_31_RvQfF, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3878};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hmod, __pyx_mstate->__pyx_n_u_times, __pyx_mstate->__pyx_n_u_seed, __pyx_mstate->__pyx_n_u_ctimes, __pyx_mstate->__pyx_n_u_lenp, __pyx_mstate->__pyx_n_u_times_n, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_path_n, __pyx_mstate->__pyx_n_u_seedp, __pyx_mstate->__pyx_n_u_exp, __pyx_mstate->__pyx_n_u_dets, __pyx_mstate->__pyx_n_u_dets_n};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_H2MM_C_H2MM_C_pyx, __pyx_mstate->__pyx_n_u_sim_phtraj_from_times, __pyx_mstate->__pyx_kp_b_iso88591_2_B_b_uF_Q_iq_uF_3b_j_q_V1A_KvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_ConvCodes, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_9HAQ_7_1L_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  Py_DECREF(tuple_dedup_map);
  return 0;
  bad:
  Py_DECREF(tuple_dedup_map);
  return -1;
}
/* #### Code section: init_globals ### */

static int __Pyx_InitGlobals(void) {
  /* PythonCompatibility.init */
  if (likely(__Pyx_init_co_variables() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* AssertionsEnabled.init */
  if (likely(__Pyx_init_assertions_enabled() == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CommonTypesMetaclass.init */
  if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CachedMethodType.init */
  #if CYTHON_COMPILING_IN_LIMITED_API
  {
      PyObject *typesModule=NULL;
      typesModule = PyImport_ImportModule("types");
      if (typesModule) {
          __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
          Py_DECREF(typesModule);
      }
  } // error handling follows
  #endif
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* CythonFunctionShared.init */
  if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  /* Generator.init */
  if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  
  if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  return 0;
  __pyx_L1_error:;
  return -1;
}
/* #### Code section: cleanup_globals ### */
/* #### Code section: cleanup_module ### */
/* #### Code section: main_method ### */
/* #### Code section: utility_code_pragmas ### */
#ifdef _MSC_VER
#pragma warning( push )
/* Warning 4127: conditional expression is constant
 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
 * compile-time, so this warning is not useful
 */
#pragma warning( disable : 4127 )
#endif



/* #### Code section: utility_code_def ### */

/* --- 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

/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
#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);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    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) {
    int result;
    PyObject *exc_type;
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *current_exception = tstate->current_exception;
    if (unlikely(!current_exception)) return 0;
    exc_type = (PyObject*) Py_TYPE(current_exception);
    if (exc_type == err) return 1;
#else
    exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
#endif
    #if CYTHON_AVOID_BORROWED_REFS
    Py_INCREF(exc_type);
    #endif
    if (unlikely(PyTuple_Check(err))) {
        result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    } else {
        result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
    }
    #if CYTHON_AVOID_BORROWED_REFS
    Py_DECREF(exc_type);
    #endif
    return result;
}
#endif

/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    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);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *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
}
#endif

/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
#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);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
    return result;
#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
#endif
}

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
    if (unlikely(!result) && !PyErr_Occurred()) {
        PyErr_Format(PyExc_NameError,
            "name '%U' is not defined", name);
    }
    return result;
}

/* TupleAndListFromArray (used by fastcall) */
#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    Py_ssize_t i;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    for (i = 0; i < n; i++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    return res;
}
#elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject *
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
    }
    res = PyTuple_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
    return res;
}
static CYTHON_INLINE PyObject *
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
{
    PyObject *res;
    if (n <= 0) {
        return PyList_New(0);
    }
    res = PyList_New(n);
    if (unlikely(res == NULL)) return NULL;
    __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
    return res;
}
#endif

/* BytesEquals (used by UnicodeEquals) */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
        !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
    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_VERSION_HEX < 0x030B0000)
            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 (used by fastcall) */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    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 (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length, length2;
        int kind;
        void *data1, *data2;
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length < 0)) return -1;
        #endif
        length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(length2 < 0)) return -1;
        #endif
        if (length != length2) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
            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));
            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_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    return (equals == Py_EQ);
return_ne:
    return (equals == Py_NE);
#endif
}

/* fastcall */
#if CYTHON_METH_FASTCALL
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
{
    Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
    #if !CYTHON_ASSUME_SAFE_SIZE
    if (unlikely(n == -1)) return NULL;
    #endif
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        if (s == namei) return kwvalues[i];
    }
    for (i = 0; i < n; i++)
    {
        PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
        #if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!namei)) return NULL;
        #endif
        int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
        if (unlikely(eq != 0)) {
            if (unlikely(eq < 0)) return NULL;
            return kwvalues[i];
        }
    }
    return NULL;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
    Py_ssize_t i, nkwargs;
    PyObject *dict;
#if !CYTHON_ASSUME_SAFE_SIZE
    nkwargs = PyTuple_Size(kwnames);
    if (unlikely(nkwargs < 0)) return NULL;
#else
    nkwargs = PyTuple_GET_SIZE(kwnames);
#endif
    dict = PyDict_New();
    if (unlikely(!dict))
        return NULL;
    for (i=0; i<nkwargs; i++) {
#if !CYTHON_ASSUME_SAFE_MACROS
        PyObject *key = PyTuple_GetItem(kwnames, i);
        if (!key) goto bad;
#else
        PyObject *key = PyTuple_GET_ITEM(kwnames, i);
#endif
        if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
            goto bad;
    }
    return dict;
bad:
    Py_DECREF(dict);
    return NULL;
}
#endif
#endif

/* PyDictVersioning (used by GetModuleGlobalName) */
#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_COMPILING_IN_LIMITED_API
    if (unlikely(!__pyx_m)) {
        if (!PyErr_Occurred())
            PyErr_SetNone(PyExc_NameError);
        return NULL;
    }
    result = PyObject_GetAttr(__pyx_m, name);
    if (likely(result)) {
        return result;
    }
    PyErr_Clear();
#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return result;
    }
#else
    result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectCall (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall(" 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

/* PyObjectCallMethO (used by PyObjectFastCall) */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
    self = __Pyx_CyOrPyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall(" 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

/* PyObjectFastCall (used by PyObjectCallOneArg) */
#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
    PyObject *argstuple;
    PyObject *result = 0;
    size_t i;
    argstuple = PyTuple_New((Py_ssize_t)nargs);
    if (unlikely(!argstuple)) return NULL;
    for (i = 0; i < nargs; i++) {
        Py_INCREF(args[i]);
        if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
    }
    result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  bad:
    Py_DECREF(argstuple);
    return result;
}
#endif
#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x03090000
    #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  #elif CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
    PyTypeObject *tp = Py_TYPE(callable);
    #if defined(__Pyx_CyFunction_USED)
    if (__Pyx_CyFunction_CheckExact(callable)) {
        return __Pyx_CyFunction_func_vectorcall(callable);
    }
    #endif
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));
    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);
    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}
  #else
    #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  #endif
#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
    Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
#if CYTHON_COMPILING_IN_CPYTHON
    if (nargs == 0 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
            return __Pyx_PyObject_CallMethO(func, NULL);
    }
    else if (nargs == 1 && kwargs == NULL) {
        if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
            return __Pyx_PyObject_CallMethO(func, args[0]);
    }
#endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL
          #if CYTHON_COMPILING_IN_LIMITED_API
            return PyObject_Vectorcall(func, args, _nargs, NULL);
          #else
            vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
            if (f) {
                return f(func, args, _nargs, NULL);
            }
          #endif
        #endif
    }
    if (nargs == 0) {
        return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
    }
    #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
    return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
    #else
    return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
    #endif
}

/* PyObjectCallOneArg (used by CallUnboundCMethod0) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
    PyObject *result;
    PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
    if (unlikely(!selfless_args)) return NULL;
    result = PyObject_Call(method, selfless_args, kwargs);
    Py_DECREF(selfless_args);
    return result;
}
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
        return _PyObject_Vectorcall
            (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
}
#else
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
    return
#if PY_VERSION_HEX < 0x03090000
    _PyObject_Vectorcall
#else
    PyObject_Vectorcall
#endif
        (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
}
#endif
static PyMethodDef __Pyx_UnboundCMethod_Def = {
     "CythonUnboundCMethod",
     __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
     METH_VARARGS | METH_KEYWORDS,
#else
     METH_FASTCALL | METH_KEYWORDS,
#endif
     NULL
};
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method, *result=NULL;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    result = method;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    {
        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);
    } else
#endif
#if CYTHON_COMPILING_IN_PYPY
#else
    if (PyCFunction_Check(method))
#endif
    {
        PyObject *self;
        int self_found;
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        self = PyObject_GetAttrString(method, "__self__");
        if (!self) {
            PyErr_Clear();
        }
#else
        self = PyCFunction_GET_SELF(method);
#endif
        self_found = (self && self != Py_None);
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
        Py_XDECREF(self);
#endif
        if (self_found) {
            PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
            if (unlikely(!unbound_method)) return -1;
            Py_DECREF(method);
            result = unbound_method;
        }
    }
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    if (unlikely(target->method)) {
        Py_DECREF(result);
    } else
#endif
    target->method = result;
    return 0;
}

/* CallUnboundCMethod0 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        if (likely(cfunc->flag == METH_NOARGS))
            return __Pyx_CallCFunction(cfunc, self, NULL);
        if (likely(cfunc->flag == METH_FASTCALL))
            return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
        if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
            return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
        if (cfunc->flag == METH_VARARGS)
            return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
        return __Pyx__CallUnboundCMethod0(cfunc, self);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *result;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
    result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
    return result;
}

/* py_dict_items (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

/* py_dict_values (used by OwnedDictNext) */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
}

/* OwnedDictNext (used by ParseKeywordsImpl) */
#if CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
    PyObject *next = NULL;
    if (!*ppos) {
        if (pvalue) {
            PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
            if (unlikely(!dictview)) goto bad;
            *ppos = PyObject_GetIter(dictview);
            Py_DECREF(dictview);
        } else {
            *ppos = PyObject_GetIter(p);
        }
        if (unlikely(!*ppos)) goto bad;
    }
    next = PyIter_Next(*ppos);
    if (!next) {
        if (PyErr_Occurred()) goto bad;
        return 0;
    }
    if (pkey && pvalue) {
        *pkey = __Pyx_PySequence_ITEM(next, 0);
        if (unlikely(*pkey)) goto bad;
        *pvalue = __Pyx_PySequence_ITEM(next, 1);
        if (unlikely(*pvalue)) goto bad;
        Py_DECREF(next);
    } else if (pkey) {
        *pkey = next;
    } else {
        assert(pvalue);
        *pvalue = next;
    }
    return 1;
  bad:
    Py_XDECREF(next);
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
    PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
#else
    PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
#endif
    if (pkey) *pkey = NULL;
    if (pvalue) *pvalue = NULL;
    return 0;
}
#else // !CYTHON_AVOID_BORROWED_REFS
static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
    int result = PyDict_Next(p, ppos, pkey, pvalue);
    if (likely(result == 1)) {
        if (pkey) Py_INCREF(*pkey);
        if (pvalue) Py_INCREF(*pvalue);
    }
    return result;
}
#endif

/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
        }
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
    }
#endif
    PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *result = NULL;
        PyObject *args = PyTuple_New(2);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
        return result;
    }
#endif
    {
        PyObject *args[4] = {NULL, self, arg1, arg2};
        return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
    }
}

/* ParseKeywordsImpl (used by ParseKeywords) */
static int __Pyx_ValidateDuplicatePosArgs(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char* function_name)
{
    PyObject ** const *name = argnames;
    while (name != first_kw_arg) {
        PyObject *key = **name;
        int found = PyDict_Contains(kwds, key);
        if (unlikely(found)) {
            if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
            goto bad;
        }
        name++;
    }
    return 0;
bad:
    return -1;
}
#if CYTHON_USE_UNICODE_INTERNALS
static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
    int kind;
    Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
    if (len != PyUnicode_GET_LENGTH(s2)) return 0;
    kind = PyUnicode_KIND(s1);
    if (kind != PyUnicode_KIND(s2)) return 0;
    const void *data1 = PyUnicode_DATA(s1);
    const void *data2 = PyUnicode_DATA(s2);
    return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
}
#endif
static int __Pyx_MatchKeywordArg_str(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    #if CYTHON_USE_UNICODE_INTERNALS
    Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
    if (unlikely(key_hash == -1)) {
        key_hash = PyObject_Hash(key);
        if (unlikely(key_hash == -1))
            goto bad;
    }
    #endif
    name = first_kw_arg;
    while (*name) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) {
                *index_found = (size_t) (name - argnames);
                return 1;
            }
        }
        #endif
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        PyObject *name_str = **name;
        #if CYTHON_USE_UNICODE_INTERNALS
        if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
            if (__Pyx_UnicodeKeywordsEqual(name_str, key))
                goto arg_passed_twice;
        }
        #else
        #if CYTHON_ASSUME_SAFE_SIZE
        if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
        #endif
        {
            if (unlikely(name_str == key)) goto arg_passed_twice;
            int cmp = PyUnicode_Compare(name_str, key);
            if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
            if (cmp == 0) goto arg_passed_twice;
        }
        #endif
        name++;
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
bad:
    return -1;
}
static int __Pyx_MatchKeywordArg_nostr(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    PyObject ** const *name;
    if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
    name = first_kw_arg;
    while (*name) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (cmp == 1) {
            *index_found = (size_t) (name - argnames);
            return 1;
        }
        if (unlikely(cmp == -1)) goto bad;
        name++;
    }
    name = argnames;
    while (name != first_kw_arg) {
        int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
        if (unlikely(cmp != 0)) {
            if (cmp == 1) goto arg_passed_twice;
            else goto bad;
        }
        name++;
    }
    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;
bad:
    return -1;
}
static CYTHON_INLINE int __Pyx_MatchKeywordArg(
    PyObject *key,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    size_t *index_found,
    const char *function_name)
{
    return likely(PyUnicode_CheckExact(key)) ?
        __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
        __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
}
static void __Pyx_RejectUnknownKeyword(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject ** const *first_kw_arg,
    const char *function_name)
{
    #if CYTHON_AVOID_BORROWED_REFS
    PyObject *pos = NULL;
    #else
    Py_ssize_t pos = 0;
    #endif
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (
        #if CYTHON_AVOID_BORROWED_REFS
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
        #else
        PyDict_Next(kwds, &pos, &key, NULL)
        #endif
    ) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp != 1) {
                if (cmp == 0) {
                    PyErr_Format(PyExc_TypeError,
                        "%s() got an unexpected keyword argument '%U'",
                        function_name, key);
                }
                #if CYTHON_AVOID_BORROWED_REFS
                Py_DECREF(key);
                #endif
                break;
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        #endif
    }
    __Pyx_END_CRITICAL_SECTION();
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(pos);
    #endif
    assert(PyErr_Occurred());
}
static int __Pyx_ParseKeywordDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t extracted = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    name = first_kw_arg;
    while (*name && num_kwargs > extracted) {
        PyObject * key = **name;
        PyObject *value;
        int found = 0;
        #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        found = PyDict_GetItemRef(kwds, key, &value);
        #else
        value = PyDict_GetItemWithError(kwds, key);
        if (value) {
            Py_INCREF(value);
            found = 1;
        } else {
            if (unlikely(PyErr_Occurred())) goto bad;
        }
        #endif
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            extracted++;
        }
        name++;
    }
    if (num_kwargs > extracted) {
        if (ignore_unknown_kwargs) {
            if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
                goto bad;
        } else {
            __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
            goto bad;
        }
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordDictToDict(
    PyObject *kwds,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject** const *name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    Py_ssize_t len;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
    if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
#endif
    if (PyDict_Update(kwds2, kwds) < 0) goto bad;
    name = first_kw_arg;
    while (*name) {
        PyObject *key = **name;
        PyObject *value;
#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
        int found = PyDict_Pop(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
        }
#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
        int found = PyDict_GetItemRef(kwds2, key, &value);
        if (found) {
            if (unlikely(found < 0)) goto bad;
            values[name-argnames] = value;
            if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
        }
#else
    #if CYTHON_COMPILING_IN_CPYTHON
        value = _PyDict_Pop(kwds2, key, kwds2);
    #else
        value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
    #endif
        if (value == kwds2) {
            Py_DECREF(value);
        } else {
            if (unlikely(!value)) goto bad;
            values[name-argnames] = value;
        }
#endif
        name++;
    }
    len = PyDict_Size(kwds2);
    if (len > 0) {
        return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
    } else if (unlikely(len == -1)) {
        goto bad;
    }
    return 0;
bad:
    return -1;
}
static int __Pyx_ParseKeywordsTuple(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    PyObject *key = NULL;
    PyObject** const * name;
    PyObject** const *first_kw_arg = argnames + num_pos_args;
    for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
#if CYTHON_AVOID_BORROWED_REFS
        key = __Pyx_PySequence_ITEM(kwds, pos);
#else
        key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
#endif
#if !CYTHON_ASSUME_SAFE_MACROS
        if (unlikely(!key)) goto bad;
#endif
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            PyObject *value = kwvalues[pos];
            values[name-argnames] = __Pyx_NewRef(value);
        } else {
            size_t index_found = 0;
            int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
            if (cmp == 1) {
                PyObject *value = kwvalues[pos];
                values[index_found] = __Pyx_NewRef(value);
            } else {
                if (unlikely(cmp == -1)) goto bad;
                if (kwds2) {
                    PyObject *value = kwvalues[pos];
                    if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                } else if (!ignore_unknown_kwargs) {
                    goto invalid_keyword;
                }
            }
        }
        #if CYTHON_AVOID_BORROWED_REFS
        Py_DECREF(key);
        key = NULL;
        #endif
    }
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    goto bad;
bad:
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(key);
    #endif
    return -1;
}

/* ParseKeywords */
static int __Pyx_ParseKeywords(
    PyObject *kwds,
    PyObject * const *kwvalues,
    PyObject ** const argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    Py_ssize_t num_kwargs,
    const char* function_name,
    int ignore_unknown_kwargs)
{
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
        return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
    else if (kwds2)
        return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
    else
        return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
}

/* 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);
}

/* ArgTypeTestFunc (used by ArgTypeTest) */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    __Pyx_TypeName type_name;
    __Pyx_TypeName obj_type_name;
    PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
    int from_annotation_subclass = 0;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (!exact) {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    } else if (exact == 2) {
        if (__Pyx_TypeCheck(obj, type)) {
            from_annotation_subclass = 1;
            extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
        }
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
        ", got " __Pyx_FMT_TYPENAME ")"
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        "%s%U"
#endif
        , name, type_name, obj_type_name
#if __PYX_LIMITED_VERSION_HEX < 0x030C0000
        , (from_annotation_subclass ? ". " : ""), extra_info
#endif
        );
#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
    if (exact == 2 && from_annotation_subclass) {
        PyObject *res;
        PyObject *vargs[2];
        vargs[0] = PyErr_GetRaisedException();
        vargs[1] = extra_info;
        res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
        Py_XDECREF(res);
        PyErr_SetRaisedException(vargs[0]);
    }
#endif
    __Pyx_DECREF_TypeName(type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* RaiseException */
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 PY_VERSION_HEX >= 0x030C00A6
        PyException_SetTraceback(value, tb);
#elif CYTHON_FAST_THREAD_STATE
        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);
        }
#else
        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);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}

/* PyObjectFastCallMethod */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
    PyObject *result;
    PyObject *attr = PyObject_GetAttr(args[0], name);
    if (unlikely(!attr))
        return NULL;
    result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
    Py_DECREF(attr);
    return result;
}
#endif

/* RaiseUnexpectedTypeError */
static int
__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
{
    __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
                 expected, obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return 0;
}

/* CIntToDigits (used by CIntToPyUnicode) */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode (used by COrdinalToPyUnicode) */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyUnicode_Concat(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyUnicode_Concat(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* COrdinalToPyUnicode (used by CIntToPyUnicode) */
static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) {
    return value <= 1114111;
}
static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) {
    Py_ssize_t padding_length = ulength - 1;
    if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) {
        char chars[256];
        if (value <= 255) {
            memset(chars, padding_char, (size_t) padding_length);
            chars[ulength-1] = (char) value;
            return PyUnicode_DecodeLatin1(chars, ulength, NULL);
        }
        char *cpos = chars + sizeof(chars);
        if (value < 0x800) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xc0 | (value & 0x1f));
        } else if (value < 0x10000) {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xe0 | (value & 0x0f));
        } else {
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0x80 | (value & 0x3f));
            value >>= 6;
            *--cpos = (char) (0xf0 | (value & 0x07));
        }
        cpos -= padding_length;
        memset(cpos, padding_char, (size_t) padding_length);
        return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL);
    }
    if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) {
        const char chars[1] = {(char) value};
        return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char);
    }
    {
        PyObject *uchar, *padding_uchar, *padding, *result;
        padding_uchar = PyUnicode_FromOrdinal(padding_char);
        if (unlikely(!padding_uchar)) return NULL;
        padding = PySequence_Repeat(padding_uchar, padding_length);
        Py_DECREF(padding_uchar);
        if (unlikely(!padding)) return NULL;
        uchar = PyUnicode_FromOrdinal(value);
        if (unlikely(!uchar)) {
            Py_DECREF(padding);
            return NULL;
        }
        result = PyUnicode_Concat(padding, uchar);
        Py_DECREF(padding);
        Py_DECREF(uchar);
        return result;
    }
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int)*3+2];
    char *dpos, *end = digits + sizeof(int)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind, kind_shift;
    Py_ssize_t i, char_pos;
    void *result_udata;
    if (max_char > 1114111) max_char = 1114111;
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
    result_udata = PyUnicode_DATA(result_uval);
    assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
    if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0))
        goto overflow;
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = values[i];
        #if !CYTHON_COMPILING_IN_LIMITED_API
        if (__Pyx_PyUnicode_READY(uval) == (-1))
            goto bad;
        #endif
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(ulength < 0)) goto bad;
        #endif
        if (unlikely(!ulength))
            continue;
        if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (ukind == result_ukind) {
            memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
        } else {
            #if PY_VERSION_HEX >= 0x030d0000
            if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
            #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    Py_ssize_t i;
    PyObject *result = NULL;
    PyObject *value_tuple = PyTuple_New(value_count);
    if (unlikely(!value_tuple)) return NULL;
    CYTHON_UNUSED_VAR(max_char);
    CYTHON_UNUSED_VAR(result_ulength);
    for (i=0; i<value_count; i++) {
        if (__Pyx_PyTuple_SET_ITEM(value_tuple, i, values[i]) != (0)) goto bad;
        Py_INCREF(values[i]);
    }
    result = PyUnicode_Join(__pyx_mstate_global->__pyx_empty_unicode, value_tuple);
bad:
    Py_DECREF(value_tuple);
    return result;
#endif
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n)))
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!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,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
        return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
    } else
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_SIZE && 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)))) {
        return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    (void)wraparound;
    (void)boundscheck;
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
            return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
        } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_NewRef(PyList_GET_ITEM(o, n));
        }
    } else
    #if !CYTHON_AVOID_BORROWED_REFS
    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)))) {
            return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
        }
    } else
    #endif
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    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, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError,
            "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
        __Pyx_DECREF_TypeName(index_type_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
    __Pyx_TypeName obj_type_name;
    if (likely(PyType_Check(obj))) {
        PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
        if (!meth) {
            PyErr_Clear();
        } else {
            PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
            Py_DECREF(meth);
            return result;
        }
    }
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    PyErr_Format(PyExc_TypeError,
        "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
    PyTypeObject *tp = Py_TYPE(obj);
    PyMappingMethods *mm = tp->tp_as_mapping;
    PySequenceMethods *sm = tp->tp_as_sequence;
    if (likely(mm && mm->mp_subscript)) {
        return mm->mp_subscript(obj, key);
    }
    if (likely(sm && sm->sq_item)) {
        return __Pyx_PyObject_GetIndex(obj, key);
    }
    return __Pyx_PyObject_GetItem_Slow(obj, key);
}
#endif

/* RejectKeywords */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) {
    PyObject *key = NULL;
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) {
        key = __Pyx_PySequence_ITEM(kwds, 0);
    } else {
#if CYTHON_AVOID_BORROWED_REFS
        PyObject *pos = NULL;
#else
        Py_ssize_t pos = 0;
#endif
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL);
#if CYTHON_AVOID_BORROWED_REFS
        Py_XDECREF(pos);
#endif
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* DivInt[Py_ssize_t] */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    Py_ssize_t adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* GetAttr3 */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
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;
}
#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r;
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    int res = PyObject_GetOptionalAttr(o, n, &r);
    return (res != 0) ? r : __Pyx_NewRef(d);
#else
  #if CYTHON_USE_TYPE_SLOTS
    if (likely(PyUnicode_Check(n))) {
        r = __Pyx_PyObject_GetAttrStrNoError(o, n);
        if (unlikely(!r) && likely(!PyErr_Occurred())) {
            r = __Pyx_NewRef(d);
        }
        return r;
    }
  #endif
    r = PyObject_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
#endif
}

/* 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");
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    __Pyx_TypeName obj_type_name;
    __Pyx_TypeName type_name;
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
    type_name = __Pyx_PyType_GetFullyQualifiedName(type);
    PyErr_Format(PyExc_TypeError,
                 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
                 obj_type_name, type_name);
    __Pyx_DECREF_TypeName(obj_type_name);
    __Pyx_DECREF_TypeName(type_name);
    return 0;
}

/* GetTopmostException (used by SaveResetException) */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == 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 && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif 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;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    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
}
#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 = NULL, *local_value, *local_tb = NULL;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
  #if PY_VERSION_HEX >= 0x030C0000
    local_value = tstate->current_exception;
    tstate->current_exception = 0;
  #else
    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;
  #endif
#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
    local_value = PyErr_GetRaisedException();
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
#if __PYX_LIMITED_VERSION_HEX > 0x030C0000
    if (likely(local_value)) {
        local_type = (PyObject*) Py_TYPE(local_value);
        Py_INCREF(local_type);
        local_tb = PyException_GetTraceback(local_value);
    }
#else
    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 (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
    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;
      #if PY_VERSION_HEX >= 0x030B00a4
        tmp_value = exc_info->exc_value;
        exc_info->exc_value = local_value;
        tmp_type = NULL;
        tmp_tb = NULL;
        Py_XDECREF(local_type);
        Py_XDECREF(local_tb);
      #else
        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;
      #endif
    }
    #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);
#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    PyErr_SetHandledException(local_value);
    Py_XDECREF(local_value);
    Py_XDECREF(local_type);
    Py_XDECREF(local_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
#endif
}

/* 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 && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_value = exc_info->exc_value;
    exc_info->exc_value = *value;
    if (tmp_value == NULL || tmp_value == Py_None) {
        Py_XDECREF(tmp_value);
        tmp_value = NULL;
        tmp_type = NULL;
        tmp_tb = NULL;
    } else {
        tmp_type = (PyObject*) Py_TYPE(tmp_value);
        Py_INCREF(tmp_type);
        #if CYTHON_COMPILING_IN_CPYTHON
        tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
        Py_XINCREF(tmp_tb);
        #else
        tmp_tb = PyException_GetTraceback(tmp_value);
        #endif
    }
  #elif 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

/* HasAttr (used by ImportImpl) */
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!PyUnicode_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_PyObject_GetAttrStrNoError(o, n);
    if (!r) {
        return (unlikely(PyErr_Occurred())) ? -1 : 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}
#endif

/* ImportImpl (used by Import) */
static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
    PyObject *imported_module = PyImport_GetModule(qualname);
    if (unlikely(!imported_module)) {
        *module = NULL;
        if (PyErr_Occurred()) {
            return -1;
        }
        return 0;
    }
    *module = imported_module;
    return 1;
}
static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
    PyObject *imported_module;
    PyObject *top_level_package_name;
    Py_ssize_t i;
    int status, module_found;
    Py_ssize_t dot_index;
    module_found = __Pyx__Import_GetModule(qualname, &imported_module);
    if (unlikely(!module_found || module_found == -1)) {
        *module = NULL;
        return module_found;
    }
    if (imported_names) {
        for (i = 0; i < len_imported_names; i++) {
            PyObject *imported_name = imported_names[i];
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
            int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
#else
            int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
            if (unlikely(has_imported_attribute == -1)) goto error;
#endif
            if (!has_imported_attribute) {
                goto not_found;
            }
        }
        *module = imported_module;
        return 1;
    }
    dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
    if (dot_index == -1) {
        *module = imported_module;
        return 1;
    }
    if (unlikely(dot_index == -2)) goto error;
    top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
    if (unlikely(!top_level_package_name)) goto error;
    Py_DECREF(imported_module);
    status = __Pyx__Import_GetModule(top_level_package_name, module);
    Py_DECREF(top_level_package_name);
    return status;
error:
    Py_DECREF(imported_module);
    *module = NULL;
    return -1;
not_found:
    Py_DECREF(imported_module);
    *module = NULL;
    return 0;
}
static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *from_list = 0;
    int module_found;
    if (!qualname) {
        qualname = name;
    }
    module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
    if (likely(module_found == 1)) {
        return module;
    } else if (unlikely(module_found == -1)) {
        return NULL;
    }
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (imported_names) {
#if CYTHON_COMPILING_IN_CPYTHON
        from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
        if (unlikely(!from_list))
            goto bad;
#else
        from_list = PyList_New(len_imported_names);
        if (unlikely(!from_list)) goto bad;
        for (Py_ssize_t i=0; i<len_imported_names; ++i) {
            if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
        }
#endif
    }
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, moddict, empty_dict, from_list, 1);
            if (unlikely(!module)) {
                if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
                    goto bad;
                PyErr_Clear();
            }
        }
        level = 0;
    }
    if (!module) {
        module = PyImport_ImportModuleLevelObject(
            name, moddict, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(from_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
    return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
        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);
}
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (cls == a || cls == b) return 1;
    mro = cls->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            PyObject *base = PyTuple_GET_ITEM(mro, i);
            if (base == (PyObject *)a || base == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
}
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    if (exc_type1) {
        return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
    } else {
        return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
}
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);
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        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

/* PySequenceMultiply */
#if CYTHON_USE_TYPE_SLOTS
static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) {
    PyObject *result, *pymul = PyLong_FromSsize_t(mul);
    if (unlikely(!pymul))
        return NULL;
    result = PyNumber_Multiply(seq, pymul);
    Py_DECREF(pymul);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) {
    PyTypeObject *type = Py_TYPE(seq);
    if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) {
        return type->tp_as_sequence->sq_repeat(seq, mul);
    } else {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}
#endif

/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
    if (unlikely(!s)) return NULL;
    if (likely(PyUnicode_CheckExact(s))) return s;
    return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
    PyObject *result;
    if (unlikely(!s)) return NULL;
    result = PyObject_Format(s, f);
    Py_DECREF(s);
    return result;
}

/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
    int ret;
    _PyUnicodeWriter writer;
    if (likely(PyFloat_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyFloat_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else if (likely(PyLong_CheckExact(obj))) {
        _PyUnicodeWriter_Init(&writer);
        ret = _PyLong_FormatAdvancedWriter(
            &writer,
            obj,
            format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
    } else {
        return PyObject_Format(obj, format_spec);
    }
    if (unlikely(ret == -1)) {
        _PyUnicodeWriter_Dealloc(&writer);
        return NULL;
    }
    return _PyUnicodeWriter_Finish(&writer);
}
#endif

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (unlikely(!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,
                                               int wraparound, int boundscheck, int unsafe_shared) {
    CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
            Py_INCREF(v);
            return PyList_SetItem(o, n, v);
        } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old;
            Py_INCREF(v);
            old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 0;
        }
    } else
#endif
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
    {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (!is_list && mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (is_list || likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_SetItem(o, i, v);
    }
#endif
    (void)wraparound;
    (void)boundscheck;
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* DivInt[long] */
static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) {
    long q = a / b;
    long r = a - q*b;
    long adapt_python = (b_is_constant ?
        ((r != 0) & ((r < 0) ^ (b < 0))) :
        ((r != 0) & ((r ^ b) < 0))
    );
    return q - adapt_python;
}

/* PyObjectCall2Args (used by PyObjectCallMethod1) */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod (used by PyObjectCallMethod1) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
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
    __Pyx_TypeName type_name;
    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 defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
        #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 (likely(descr != NULL)) {
        *method = descr;
        return 0;
    }
    type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
    PyErr_Format(PyExc_AttributeError,
                 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
                 type_name, name);
    __Pyx_DECREF_TypeName(type_name);
    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;
}
#endif

/* PyObjectCallMethod1 (used by StringJoin) */
#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    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);
#endif
}

/* StringJoin */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    (void) __Pyx_PyObject_CallMethod1;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030e0000 || defined(PyBytes_Join)
    return PyBytes_Join(sep, values);
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyBytes_Join)
    return _PyBytes_Join(sep, values);
#else
    return __Pyx_PyObject_CallMethod1(sep, __pyx_mstate_global->__pyx_n_u_join, values);
#endif
}

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (size_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(size_t)*3+2];
    char *dpos, *end = digits + sizeof(size_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    size_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (size_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (size_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (size_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* 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);
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseClosureNameError */
static void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* pep479 */
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
    PyObject *exc, *val, *tb, *cur_exc, *new_exc;
    __Pyx_PyThreadState_declare
    int is_async_stopiteration = 0;
    CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
    __Pyx_PyThreadState_assign
    cur_exc = __Pyx_PyErr_CurrentExceptionType();
    if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
        if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
            is_async_stopiteration = 1;
        } else {
            return;
        }
    }
    __Pyx_GetException(&exc, &val, &tb);
    Py_XDECREF(exc);
    Py_XDECREF(tb);
    new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
        is_async_stopiteration ? "async generator raised StopAsyncIteration" :
        in_async_gen ? "async generator raised StopIteration" :
        "generator raised StopIteration");
    if (!new_exc) {
        Py_XDECREF(val);
        return;
    }
    PyException_SetCause(new_exc, val); // steals ref to val
    PyErr_SetObject(PyExc_RuntimeError, new_exc);
}

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    args[n] = value;
    return 0;
}
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_VectorcallBuilder_AddArgStr;
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
}
static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    PyObject *pyKey = PyUnicode_FromString(key);
    if (!pyKey) return -1;
    return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
}
#else // CYTHON_VECTORCALL
CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
    if (unlikely(!PyUnicode_Check(key))) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
        return -1;
    }
    return PyDict_SetItem(builder, key, value);
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op1);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } 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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2);
    }
    calculate_long:
        {
            long q, r;
            q = a / b;
            r = a - q*b;
            q -= ((r != 0) & ((r ^ b) < 0));
            return PyLong_FromLong(q);
        }
    calculate_long_long:
        {
            PY_LONG_LONG q, r;
            q = lla / llb;
            r = lla - q*llb;
            q -= ((r != 0) & ((r ^ llb) < 0));
            return PyLong_FromLongLong(q);
        }
    
}
#endif
static CYTHON_INLINE PyObject* __Pyx_PyLong_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    return __Pyx_Fallback___Pyx_PyLong_FloorDivideObjC(op1, op2, inplace);
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long a = intval;
    long b;
    const PY_LONG_LONG lla = intval;
    PY_LONG_LONG llb;
    if (unlikely(__Pyx_PyLong_IsZero(op2))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op2);
    const digit* digits = __Pyx_PyLong_Digits(op2);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
    if (likely(size == 1)) {
        b = (long) digits[0];
        if (!is_positive) b *= -1;
    } else {
        switch (size) {
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) {
                    b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) b *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) {
                    llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    if (!is_positive) llb *= -1;
                    goto calculate_long_long;
                }
                break;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) {
                    b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) b *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) {
                    llb = (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]));
                    if (!is_positive) llb *= -1;
                    goto calculate_long_long;
                }
                break;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) {
                    b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if (!is_positive) b *= -1;
                    goto calculate_long;
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) {
                    llb = (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]));
                    if (!is_positive) llb *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_multiply(op1, op2);
    }
    calculate_long:
        CYTHON_UNUSED_VAR(a);
        CYTHON_UNUSED_VAR(b);
        llb = b;
        goto calculate_long_long;
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla * llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_MultiplyCObj(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long a = intval;
    double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) * (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        return __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        return __Pyx_Float___Pyx_PyLong_MultiplyCObj(op2, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(op1, op2, inplace);
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } 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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a + b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla + llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) + (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
}
#endif

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 1;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) == 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 0;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 0;
        }
        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));
        return (unequal == 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a == (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    CYTHON_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    if (likely(PyFloat_CheckExact(op1))) {
        a = __Pyx_PyFloat_AS_DOUBLE(op1);
        
    } else
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsZero(op1)) {
            a = 0.0;
            
        } else if (__Pyx_PyLong_IsCompact(op1)) {
            a = (double) __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                case 2:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                        a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -2)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                case 3:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                        a = (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) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -3)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                case 4:
                    if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                        a = (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) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -4)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                default:
        #endif
                    a = PyLong_AsDouble(op1);
                    if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        #if CYTHON_USE_PYLONG_INTERNALS
            }
        }
        #endif
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        result = a - b;
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    CYTHON_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    if (likely(PyFloat_CheckExact(op1))) {
        a = __Pyx_PyFloat_AS_DOUBLE(op1);
        
    } else
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsZero(op1)) {
            a = 0.0;
            
        } else if (__Pyx_PyLong_IsCompact(op1)) {
            a = (double) __Pyx_PyLong_CompactValue(op1);
        } else {
            const digit* digits = __Pyx_PyLong_Digits(op1);
            const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
            switch (size) {
                case -2:
                case 2:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                        a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -2)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                case 3:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                        a = (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) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -3)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                case 4:
                    if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                        a = (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) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                            if (size == -4)
                                a = -a;
                            break;
                        }
                    }
                    CYTHON_FALLTHROUGH;
                default:
        #endif
                    a = PyLong_AsDouble(op1);
                    if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        #if CYTHON_USE_PYLONG_INTERNALS
            }
        }
        #endif
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        result = a + b;
        return PyFloat_FromDouble(result);
}
#endif

/* CIntToPyUnicode */
static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int64_t(int64_t value, Py_ssize_t width, char padding_char) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                    !(sizeof(value) <= 2 || value & ~ (int64_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
        PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
        return NULL;
    }
    if (width <= 1) {
        return PyUnicode_FromOrdinal((int) value);
    }
    return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
}
static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int64_t(int64_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(int64_t)*3+2];
    char *dpos, *end = digits + sizeof(int64_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    int64_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (int64_t) (remaining / (8*8));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (int64_t) (remaining / (10*10));
            dpos -= 2;
            memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (int64_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    assert(!last_one_off || *dpos == '0');
    dpos += last_one_off;
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* UnicodeConcatInPlace */
# if CYTHON_COMPILING_IN_CPYTHON
static int
__Pyx_unicode_modifiable(PyObject *unicode, int unsafe_shared)
{
    if (!__Pyx_IS_UNIQUELY_REFERENCED(unicode, unsafe_shared))
        return 0;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030F0000
    if (PyUnstable_Unicode_GET_CACHED_HASH(unicode) != -1)
        return 0;
#endif
    if (!PyUnicode_CheckExact(unicode))
        return 0;
    if (PyUnicode_CHECK_INTERNED(unicode))
        return 0;
    return 1;
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared
        #if CYTHON_REFNANNY
        , void* __pyx_refnanny
        #endif
    ) {
    PyObject *left = *p_left;
    Py_ssize_t left_len, right_len, new_len;
    if (unlikely(__Pyx_PyUnicode_READY(left) == -1))
        return NULL;
    if (unlikely(__Pyx_PyUnicode_READY(right) == -1))
        return NULL;
    left_len = PyUnicode_GET_LENGTH(left);
    if (left_len == 0) {
        Py_INCREF(right);
        return right;
    }
    right_len = PyUnicode_GET_LENGTH(right);
    if (right_len == 0) {
        Py_INCREF(left);
        return left;
    }
    if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) {
        PyErr_SetString(PyExc_OverflowError,
                        "strings are too large to concat");
        return NULL;
    }
    new_len = left_len + right_len;
    if (__Pyx_unicode_modifiable(left, unsafe_shared)
            && PyUnicode_CheckExact(right)
            && PyUnicode_KIND(right) <= PyUnicode_KIND(left)
            && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) {
        int ret;
        __Pyx_GIVEREF(*p_left);
        ret = PyUnicode_Resize(p_left, new_len);
        __Pyx_GOTREF(*p_left);
        if (unlikely(ret != 0))
            return NULL;
        #if PY_VERSION_HEX >= 0x030d0000
        if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL;
        #else
        _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
        #endif
        __Pyx_INCREF(*p_left);
        __Pyx_GIVEREF(*p_left);
        return *p_left;
    } else {
        return __Pyx_PyUnicode_Concat(left, right);
    }
  }
#endif

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    int was_initialized =  __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return __Pyx_CallCFunction(cfunc, self, arg);
        } else if (flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1);
        } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, NULL);
        }
    }
#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    else if (unlikely(was_initialized == 1)) {
        __Pyx_CachedCFunction tmp_cfunc = {
#ifndef __cplusplus
            0
#endif
        };
        tmp_cfunc.type = cfunc->type;
        tmp_cfunc.method_name = cfunc->method_name;
        return __Pyx__CallUnboundCMethod1(&tmp_cfunc, self, arg);
    }
#endif
    PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *args = PyTuple_New(1);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
    } else
#endif
    {
        result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg);
    }
    return result;
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    const char* function_name,
    PyObject *kw)
{
#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments)
    CYTHON_UNUSED_VAR(function_name);
    CYTHON_UNUSED_VAR(kw);
    return 0;
#else
    if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
#if PY_VERSION_HEX >= 0x03090000
        CYTHON_UNUSED_VAR(function_name);
#else
        Py_ssize_t kwsize;
        #if CYTHON_ASSUME_SAFE_SIZE
        kwsize = PyTuple_GET_SIZE(kw);
        #else
        kwsize = PyTuple_Size(kw);
        if (unlikely(kwsize < 0)) return -1;
        #endif
        for (Py_ssize_t pos = 0; pos < kwsize; pos++) {
            PyObject* key = NULL;
            #if CYTHON_ASSUME_SAFE_MACROS
            key = PyTuple_GET_ITEM(kw, pos);
            #else
            key = PyTuple_GetItem(kw, pos);
            if (unlikely(!key)) return -1;
            #endif
            if (unlikely(!PyUnicode_Check(key))) {
                PyErr_Format(PyExc_TypeError,
                    "%.200s() keywords must be strings", function_name);
                return -1;
            }
        }
#endif
    } else {
        if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1;
    }
    return 0;
#endif
}

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 0;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) != 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 1;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 1;
        }
        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));
        return (unequal != 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a != (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
    CYTHON_UNUSED_VAR(clineno);
    CYTHON_UNUSED_VAR(lineno);
    CYTHON_UNUSED_VAR(filename);
    CYTHON_MAYBE_UNUSED_VAR(nogil);
    __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(0);
    }
    ctx = PyUnicode_FromString(name);
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
    if (nogil)
        PyGILState_Release(state);
}

/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
    if (unlikely(obj == Py_None))
        obj = __pyx_mstate_global->__pyx_kp_u_None;
    return __Pyx_NewRef(obj);
}

/* PyObjectVectorCallMethodKwBuilder */
#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) {
    PyObject *result;
    PyObject *obj = PyObject_GetAttr(args[0], name);
    if (unlikely(!obj))
        return NULL;
    result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames);
    Py_DECREF(obj);
    return result;
}
#endif

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(inplace);
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    long a;
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla;
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return PyLong_FromLong(-intval);
    }
    const int is_positive = __Pyx_PyLong_IsPos(op1);
    const digit* digits = __Pyx_PyLong_Digits(op1);
    const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
    if (likely(size == 1)) {
        a = (long) digits[0];
        if (!is_positive) a *= -1;
    } 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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
            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]));
                    if (!is_positive) a *= -1;
                    goto calculate_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]));
                    if (!is_positive) lla *= -1;
                    goto calculate_long_long;
                }
                break;
        }
        return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    calculate_long:
        {
            long x;
            x = a - b;
            return PyLong_FromLong(x);
        }
    calculate_long_long:
        {
            PY_LONG_LONG llx;
            llx = lla - llb;
            return PyLong_FromLongLong(llx);
        }
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(PyObject *float_val, long intval, int zerodivision_check) {
    CYTHON_UNUSED_VAR(zerodivision_check);
    const long b = intval;
    double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
        double result;
        
        result = ((double)a) - (double)b;
        return PyFloat_FromDouble(result);
}
static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(zerodivision_check);
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        return __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
}
#endif

/* IsLittleEndian (used by BufferFormatCheck) */
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 (used by BufferGetAndValidate) */
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              const __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 '?': return "'bool'";
    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 "unparsable 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 '?': 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);
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    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;
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  CYTHON_UNUSED_VAR(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);
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
    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;
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) {
  CYTHON_UNUSED_VAR(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);
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
    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 '?': 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 {
    const __Pyx_StructField* field = ctx->head->field;
    const __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 {
    const __Pyx_StructField* field = ctx->head->field;
    const __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 int
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return -1;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1;
    ndim = ctx->head->field->type->ndim;
    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 -1;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) {
            PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
            return -1;
        }
        if (*ts != ',' && *ts != ')') {
            PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
            return -1;
        }
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim) {
        PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
        return -1;
    }
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return -1;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return 0;
}
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 '?': 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->is_valid_array)) {
          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) < 0) 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;
    PyBuffer_Release(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,  const __Pyx_TypeInfo* dtype, int flags,
          int nd, int cast, __Pyx_BufFmt_StackElem* stack)
  {
    buf->buf = NULL;
    if (unlikely(PyObject_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;
  }
  
/* BufferIndexError */
  static void __Pyx_RaiseBufferIndexError(int axis) {
    PyErr_Format(PyExc_IndexError,
       "Out of bounds on buffer access (axis %d)", axis);
  }
  
/* PyObjectCallNoArg (used by PyObjectCallMethod0) */
  static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
      PyObject *arg[2] = {NULL, NULL};
      return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  }
  
/* PyObjectCallMethod0 (used by dict_iter) */
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
      PyObject *args[1] = {obj};
      (void) __Pyx_PyObject_CallOneArg;
      (void) __Pyx_PyObject_CallNoArg;
      return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  #else
      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;
  #endif
  }
  
/* UnpackTupleError (used by UnpackTuple2) */
  static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
      if (t == Py_None) {
        __Pyx_RaiseNoneNotIterableError();
      } else {
        Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t);
   #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely(size < 0)) return;
   #endif
        if (size < index) {
          __Pyx_RaiseNeedMoreValuesError(size);
        } else {
          __Pyx_RaiseTooManyValuesError(index);
        }
      }
  }
  
/* UnpackTuple2 (used by dict_iter) */
  static CYTHON_INLINE int __Pyx_unpack_tuple2(
          PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) {
      if (likely(is_tuple || PyTuple_Check(tuple))) {
          Py_ssize_t size;
          if (has_known_size) {
              return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
          }
          size = __Pyx_PyTuple_GET_SIZE(tuple);
          if (likely(size == 2)) {
              return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple);
          }
          if (size >= 0) {
              __Pyx_UnpackTupleError(tuple, 2);
          }
          return -1;
      } else {
          return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple);
      }
  }
  static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
          PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
      PyObject *value1 = NULL, *value2 = NULL;
  #if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
      value1 = __Pyx_PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
      value2 = __Pyx_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_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  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 = __Pyx_PyObject_GetIterNextFunc(iter);
      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 */
  #if CYTHON_COMPILING_IN_PYPY
  #include <string.h>
  #endif
  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;
  #else
          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);
  }
  #if !CYTHON_AVOID_BORROWED_REFS
  static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict(
          PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
          PyObject** pkey, PyObject** pvalue, PyObject** pitem) {
      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);
          #if CYTHON_ASSUME_SAFE_MACROS
          PyTuple_SET_ITEM(tuple, 0, key);
          PyTuple_SET_ITEM(tuple, 1, value);
          #else
          if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) {
              Py_DECREF(value);
              Py_DECREF(tuple);
              return -1;
          }
          if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) {
              Py_DECREF(tuple);
              return -1;
          }
          #endif
          *pitem = tuple;
      } else {
          if (pkey) {
              Py_INCREF(key);
              *pkey = key;
          }
          if (pvalue) {
              Py_INCREF(value);
              *pvalue = value;
          }
      }
      return 1;
  }
  #endif
  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_AVOID_BORROWED_REFS
      if (source_is_dict) {
          int result;
  #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_BEGIN_CRITICAL_SECTION(iter_obj);
  #endif
          result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem);
  #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_END_CRITICAL_SECTION();
  #endif
          return result;
      } else if (PyTuple_CheckExact(iter_obj)) {
          Py_ssize_t pos = *ppos;
          Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely(tuple_size < 0)) return -1;
          #endif
          if (unlikely(pos >= tuple_size)) return 0;
          *ppos = pos + 1;
          #if CYTHON_ASSUME_SAFE_MACROS
          next_item = PyTuple_GET_ITEM(iter_obj, pos);
          #else
          next_item = PyTuple_GetItem(iter_obj, pos);
          if (unlikely(!next_item)) return -1;
          #endif
          Py_INCREF(next_item);
      } else if (PyList_CheckExact(iter_obj)) {
          Py_ssize_t pos = *ppos;
          Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely(list_size < 0)) return -1;
          #endif
          if (unlikely(pos >= list_size)) return 0;
          *ppos = pos + 1;
          next_item = __Pyx_PyList_GetItemRef(iter_obj, pos);
          if (unlikely(!next_item)) return -1;
      } 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;
  }
  
/* PyLongCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
      CYTHON_MAYBE_UNUSED_VAR(intval);
      CYTHON_UNUSED_VAR(inplace);
      if (op1 == op2) {
          Py_RETURN_TRUE;
      }
      #if CYTHON_USE_PYLONG_INTERNALS
      if (likely(PyLong_CheckExact(op1))) {
          int unequal;
          unsigned long uintval;
          Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
          const digit* digits = __Pyx_PyLong_Digits(op1);
          if (intval == 0) {
              if (__Pyx_PyLong_IsZero(op1) == 1) Py_RETURN_TRUE; else Py_RETURN_FALSE;
          } else if (intval < 0) {
              if (__Pyx_PyLong_IsNonNeg(op1))
                  Py_RETURN_FALSE;
              intval = -intval;
          } else {
              if (__Pyx_PyLong_IsNeg(op1))
                  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 = __Pyx_PyFloat_AS_DOUBLE(op1);
          if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
      }
      return (
          PyObject_RichCompare(op1, op2, Py_EQ));
  }
  
/* BufferFallbackError */
  static void __Pyx_RaiseBufferFallbackError(void) {
    PyErr_SetString(PyExc_ValueError,
       "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
  }
  
/* PyLongBinop */
  #if !CYTHON_COMPILING_IN_PYPY
  static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, int inplace) {
      return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  }
  #if CYTHON_USE_PYLONG_INTERNALS
  static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
      CYTHON_MAYBE_UNUSED_VAR(inplace);
      CYTHON_UNUSED_VAR(zerodivision_check);
      const long a = intval;
      long b;
      const PY_LONG_LONG lla = intval;
      PY_LONG_LONG llb;
      if (unlikely(__Pyx_PyLong_IsZero(op2))) {
          return __Pyx_NewRef(op1);
      }
      const int is_positive = __Pyx_PyLong_IsPos(op2);
      const digit* digits = __Pyx_PyLong_Digits(op2);
      const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
      if (likely(size == 1)) {
          b = (long) digits[0];
          if (!is_positive) b *= -1;
      } else {
          switch (size) {
              case 2:
                  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                      b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                      if (!is_positive) b *= -1;
                      goto calculate_long;
                  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                      llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                      if (!is_positive) llb *= -1;
                      goto calculate_long_long;
                  }
                  break;
              case 3:
                  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                      b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                      if (!is_positive) b *= -1;
                      goto calculate_long;
                  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                      llb = (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]));
                      if (!is_positive) llb *= -1;
                      goto calculate_long_long;
                  }
                  break;
              case 4:
                  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                      b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                      if (!is_positive) b *= -1;
                      goto calculate_long;
                  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                      llb = (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]));
                      if (!is_positive) llb *= -1;
                      goto calculate_long_long;
                  }
                  break;
          }
          return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
      }
      calculate_long:
          {
              long x;
              x = a - b;
              return PyLong_FromLong(x);
          }
      calculate_long_long:
          {
              PY_LONG_LONG llx;
              llx = lla - llb;
              return PyLong_FromLongLong(llx);
          }
      
  }
  #endif
  static PyObject* __Pyx_Float___Pyx_PyLong_SubtractCObj(PyObject *float_val, long intval, int zerodivision_check) {
      CYTHON_UNUSED_VAR(zerodivision_check);
      const long a = intval;
      double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
          double result;
          
          result = ((double)a) - (double)b;
          return PyFloat_FromDouble(result);
  }
  static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
      CYTHON_MAYBE_UNUSED_VAR(intval);
      CYTHON_UNUSED_VAR(zerodivision_check);
      #if CYTHON_USE_PYLONG_INTERNALS
      if (likely(PyLong_CheckExact(op2))) {
          return __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(op1, op2, intval, inplace, zerodivision_check);
      }
      #endif
      if (PyFloat_CheckExact(op2)) {
          return __Pyx_Float___Pyx_PyLong_SubtractCObj(op2, intval, zerodivision_check);
      }
      return __Pyx_Fallback___Pyx_PyLong_SubtractCObj(op1, op2, inplace);
  }
  #endif
  
/* PyLongBinop */
  #if !CYTHON_COMPILING_IN_PYPY
  static PyObject* __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
      return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
  }
  #if CYTHON_USE_PYLONG_INTERNALS
  static PyObject* __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
      CYTHON_MAYBE_UNUSED_VAR(inplace);
      CYTHON_UNUSED_VAR(zerodivision_check);
      const long b = intval;
      long a;
      if (unlikely(__Pyx_PyLong_IsZero(op1))) {
      }
      const int is_positive = __Pyx_PyLong_IsPos(op1);
      const digit* digits = __Pyx_PyLong_Digits(op1);
      const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
      if (likely(size == 1)) {
          a = (long) digits[0];
          if (!is_positive) a *= -1;
      } 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]));
                      if (!is_positive) a *= -1;
                      goto calculate_long;
                  }
                  break;
              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]));
                      if (!is_positive) a *= -1;
                      goto calculate_long;
                  }
                  break;
              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]));
                      if (!is_positive) a *= -1;
                      goto calculate_long;
                  }
                  break;
          }
          return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
      }
      calculate_long:
          if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                  || __Pyx_PyLong_DigitCount(op1) <= 52 / PyLong_SHIFT) {
              return PyFloat_FromDouble((double)a / (double)b);
          }
          return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
  }
  #endif
  static PyObject* __Pyx_Float___Pyx_PyLong_TrueDivideObjC(PyObject *float_val, long intval, int zerodivision_check) {
      CYTHON_UNUSED_VAR(zerodivision_check);
      const long b = intval;
      double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
          double result;
          
          result = ((double)a) / (double)b;
          return PyFloat_FromDouble(result);
  }
  static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
      CYTHON_MAYBE_UNUSED_VAR(intval);
      CYTHON_UNUSED_VAR(zerodivision_check);
      #if CYTHON_USE_PYLONG_INTERNALS
      if (likely(PyLong_CheckExact(op1))) {
          return __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check);
      }
      #endif
      if (PyFloat_CheckExact(op1)) {
          return __Pyx_Float___Pyx_PyLong_TrueDivideObjC(op1, intval, zerodivision_check);
      }
      return __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(op1, op2, inplace);
  }
  #endif
  
/* ModInt[Py_ssize_t] */
  static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) {
      Py_ssize_t r = a % b;
      Py_ssize_t adapt_python = (b_is_constant ?
          ((r != 0) & ((r < 0) ^ (b < 0))) :
          ((r != 0) & ((r ^ b) < 0))
      );
      return r + adapt_python * b;
  }
  
/* 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) {
      __Pyx_TypeName obj_type_name;
  #if CYTHON_USE_TYPE_SLOTS
      PyMappingMethods* 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 = PyLong_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 = PyLong_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;
      }
      obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
      PyErr_Format(PyExc_TypeError,
          "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
      __Pyx_DECREF_TypeName(obj_type_name);
  bad:
      return NULL;
  }
  
/* ModInt[int64_t] */
  static CYTHON_INLINE int64_t __Pyx_mod_int64_t(int64_t a, int64_t b, int b_is_constant) {
      int64_t r = a % b;
      int64_t adapt_python = (b_is_constant ?
          ((r != 0) & ((r < 0) ^ (b < 0))) :
          ((r != 0) & ((r ^ b) < 0))
      );
      return r + adapt_python * b;
  }
  
/* CIntToPyUnicode */
  static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_npy_intp(npy_intp value, Py_ssize_t width, char padding_char) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const npy_intp neg_one = (npy_intp) -1, const_zero = (npy_intp) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!(is_unsigned || value == 0 || value > 0) ||
                      !(sizeof(value) <= 2 || value & ~ (npy_intp) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) {
          PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)");
          return NULL;
      }
      if (width <= 1) {
          return PyUnicode_FromOrdinal((int) value);
      }
      return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char);
  }
  static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_npy_intp(npy_intp value, Py_ssize_t width, char padding_char, char format_char) {
      char digits[sizeof(npy_intp)*3+2];
      char *dpos, *end = digits + sizeof(npy_intp)*3+2;
      const char *hex_digits = DIGITS_HEX;
      Py_ssize_t length, ulength;
      int prepend_sign, last_one_off;
      npy_intp remaining;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const npy_intp neg_one = (npy_intp) -1, const_zero = (npy_intp) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (format_char == 'X') {
          hex_digits += 16;
          format_char = 'x';
      }
      remaining = value;
      last_one_off = 0;
      dpos = end;
      do {
          int digit_pos;
          switch (format_char) {
          case 'o':
              digit_pos = abs((int)(remaining % (8*8)));
              remaining = (npy_intp) (remaining / (8*8));
              dpos -= 2;
              memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2);
              last_one_off = (digit_pos < 8);
              break;
          case 'd':
              digit_pos = abs((int)(remaining % (10*10)));
              remaining = (npy_intp) (remaining / (10*10));
              dpos -= 2;
              memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2);
              last_one_off = (digit_pos < 10);
              break;
          case 'x':
              *(--dpos) = hex_digits[abs((int)(remaining % 16))];
              remaining = (npy_intp) (remaining / 16);
              break;
          default:
              assert(0);
              break;
          }
      } while (unlikely(remaining != 0));
      assert(!last_one_off || *dpos == '0');
      dpos += last_one_off;
      length = end - dpos;
      ulength = length;
      prepend_sign = 0;
      if (!is_unsigned && value <= neg_one) {
          if (padding_char == ' ' || width <= length + 1) {
              *(--dpos) = '-';
              ++length;
          } else {
              prepend_sign = 1;
          }
          ++ulength;
      }
      if (width > ulength) {
          ulength = width;
      }
      if (ulength == 1) {
          return PyUnicode_FromOrdinal(*dpos);
      }
      return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
  }
  
/* PyLongCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
      CYTHON_MAYBE_UNUSED_VAR(intval);
      CYTHON_UNUSED_VAR(inplace);
      if (op1 == op2) {
          Py_RETURN_FALSE;
      }
      #if CYTHON_USE_PYLONG_INTERNALS
      if (likely(PyLong_CheckExact(op1))) {
          int unequal;
          unsigned long uintval;
          Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
          const digit* digits = __Pyx_PyLong_Digits(op1);
          if (intval == 0) {
              if (__Pyx_PyLong_IsZero(op1) != 1) Py_RETURN_TRUE; else Py_RETURN_FALSE;
          } else if (intval < 0) {
              if (__Pyx_PyLong_IsNonNeg(op1))
                  Py_RETURN_TRUE;
              intval = -intval;
          } else {
              if (__Pyx_PyLong_IsNeg(op1))
                  Py_RETURN_TRUE;
          }
          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 = __Pyx_PyFloat_AS_DOUBLE(op1);
          if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
      }
      return (
          PyObject_RichCompare(op1, op2, Py_NE));
  }
  
/* 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_mstate_global->__pyx_n_u_append, x);
          if (unlikely(!retval))
              return -1;
          Py_DECREF(retval);
      }
      return 0;
  }
  
/* AllocateExtensionType */
  static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
      if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
          allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
          return alloc_func(t, 0);
      } else {
          newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
      #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
          if (!tp_new) {
              PyObject *new_str = PyUnicode_FromString("__new__");
              if (likely(new_str)) {
                  PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
                  Py_DECREF(new_str);
                  return o;
              } else
                  return NULL;
          } else
      #endif
          return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
      }
  }
  
/* CallTypeTraverse */
  #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  #else
  static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
      #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
      if (__Pyx_get_runtime_version() < 0x03090000) return 0;
      #endif
      if (!always_call) {
          PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
          unsigned long flags = PyType_GetFlags(base);
          if (flags & Py_TPFLAGS_HEAPTYPE) {
              return 0;
          }
      }
      Py_VISIT((PyObject*)Py_TYPE(o));
      return 0;
  }
  #endif
  
/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
  #if CYTHON_COMPILING_IN_LIMITED_API
  static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
      PyObject *tp_dictoffset_o;
      Py_ssize_t tp_dictoffset;
      tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
      if (unlikely(!tp_dictoffset_o)) return -1;
      tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
      Py_DECREF(tp_dictoffset_o);
      if (unlikely(tp_dictoffset == 0)) {
          PyErr_SetString(
              PyExc_TypeError,
              "'type' doesn't have a dictoffset");
          return -1;
      } else if (unlikely(tp_dictoffset < 0)) {
          PyErr_SetString(
              PyExc_TypeError,
              "'type' has an unexpected negative dictoffset. "
              "Please report this as Cython bug");
          return -1;
      }
      return tp_dictoffset;
  }
  static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
      static Py_ssize_t tp_dictoffset = 0;
      if (unlikely(tp_dictoffset == 0)) {
          tp_dictoffset = __Pyx_GetTypeDictOffset();
          if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
              tp_dictoffset = 0; // try again next time?
              return NULL;
          }
      }
      return *(PyObject**)((char*)tp + tp_dictoffset);
  }
  #endif
  
/* SetItemOnTypeDict (used by FixUpExtensionType) */
  static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
      int result;
      PyObject *tp_dict;
  #if CYTHON_COMPILING_IN_LIMITED_API
      tp_dict = __Pyx_GetTypeDict(tp);
      if (unlikely(!tp_dict)) return -1;
  #else
      tp_dict = tp->tp_dict;
  #endif
      result = PyDict_SetItem(tp_dict, k, v);
      if (likely(!result)) {
          PyType_Modified(tp);
          if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
              PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name,  (PyObject *) tp, k, NULL);
              if (!setNameResult) return -1;
              Py_DECREF(setNameResult);
          }
      }
      return result;
  }
  
/* FixUpExtensionType */
  static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  #if __PYX_LIMITED_VERSION_HEX > 0x030900B1
      CYTHON_UNUSED_VAR(spec);
      CYTHON_UNUSED_VAR(type);
      CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  #else
      const PyType_Slot *slot = spec->slots;
      int changed = 0;
  #if !CYTHON_COMPILING_IN_LIMITED_API
      while (slot && slot->slot && slot->slot != Py_tp_members)
          slot++;
      if (slot && slot->slot == Py_tp_members) {
  #if !CYTHON_COMPILING_IN_CPYTHON
          const
  #endif  // !CYTHON_COMPILING_IN_CPYTHON)
              PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
          while (memb && memb->name) {
              if (memb->name[0] == '_' && memb->name[1] == '_') {
                  if (strcmp(memb->name, "__weaklistoffset__") == 0) {
                      assert(memb->type == T_PYSSIZET);
                      assert(memb->flags == READONLY);
                      type->tp_weaklistoffset = memb->offset;
                      changed = 1;
                  }
                  else if (strcmp(memb->name, "__dictoffset__") == 0) {
                      assert(memb->type == T_PYSSIZET);
                      assert(memb->flags == READONLY);
                      type->tp_dictoffset = memb->offset;
                      changed = 1;
                  }
  #if CYTHON_METH_FASTCALL
                  else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
                      assert(memb->type == T_PYSSIZET);
                      assert(memb->flags == READONLY);
                      type->tp_vectorcall_offset = memb->offset;
                      changed = 1;
                  }
  #endif  // CYTHON_METH_FASTCALL
  #if !CYTHON_COMPILING_IN_PYPY
                  else if (strcmp(memb->name, "__module__") == 0) {
                      PyObject *descr;
                      assert(memb->type == T_OBJECT);
                      assert(memb->flags == 0 || memb->flags == READONLY);
                      descr = PyDescr_NewMember(type, memb);
                      if (unlikely(!descr))
                          return -1;
                      int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                      Py_DECREF(descr);
                      if (unlikely(set_item_result < 0)) {
                          return -1;
                      }
                      changed = 1;
                  }
  #endif  // !CYTHON_COMPILING_IN_PYPY
              }
              memb++;
          }
      }
  #endif  // !CYTHON_COMPILING_IN_LIMITED_API
  #if !CYTHON_COMPILING_IN_PYPY
      slot = spec->slots;
      while (slot && slot->slot && slot->slot != Py_tp_getset)
          slot++;
      if (slot && slot->slot == Py_tp_getset) {
          PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
          while (getset && getset->name) {
              if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
                  PyObject *descr = PyDescr_NewGetSet(type, getset);
                  if (unlikely(!descr))
                      return -1;
                  #if CYTHON_COMPILING_IN_LIMITED_API
                  PyObject *pyname = PyUnicode_FromString(getset->name);
                  if (unlikely(!pyname)) {
                      Py_DECREF(descr);
                      return -1;
                  }
                  int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
                  Py_DECREF(pyname);
                  #else
                  CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
                  int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
                  #endif
                  Py_DECREF(descr);
                  if (unlikely(set_item_result < 0)) {
                      return -1;
                  }
                  changed = 1;
              }
              ++getset;
          }
      }
  #else
      CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  #endif  // !CYTHON_COMPILING_IN_PYPY
      if (changed)
          PyType_Modified(type);
  #endif  // PY_VERSION_HEX > 0x030900B1
      return 0;
  }
  
/* ValidateBasesTuple (used by PyType_Ready) */
  #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
      Py_ssize_t i, n;
  #if CYTHON_ASSUME_SAFE_SIZE
      n = PyTuple_GET_SIZE(bases);
  #else
      n = PyTuple_Size(bases);
      if (unlikely(n < 0)) return -1;
  #endif
      for (i = 1; i < n; i++)
      {
          PyTypeObject *b;
  #if CYTHON_AVOID_BORROWED_REFS
          PyObject *b0 = PySequence_GetItem(bases, i);
          if (!b0) return -1;
  #elif CYTHON_ASSUME_SAFE_MACROS
          PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  #else
          PyObject *b0 = PyTuple_GetItem(bases, i);
          if (!b0) return -1;
  #endif
          b = (PyTypeObject*) b0;
          if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
          {
              __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
              PyErr_Format(PyExc_TypeError,
                  "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
              __Pyx_DECREF_TypeName(b_name);
  #if CYTHON_AVOID_BORROWED_REFS
              Py_DECREF(b0);
  #endif
              return -1;
          }
          if (dictoffset == 0)
          {
              Py_ssize_t b_dictoffset = 0;
  #if CYTHON_USE_TYPE_SLOTS
              b_dictoffset = b->tp_dictoffset;
  #else
              PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
              if (!py_b_dictoffset) goto dictoffset_return;
              b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
              Py_DECREF(py_b_dictoffset);
              if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  #endif
              if (b_dictoffset) {
                  {
                      __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
                      PyErr_Format(PyExc_TypeError,
                          "extension type '%.200s' has no __dict__ slot, "
                          "but base type '" __Pyx_FMT_TYPENAME "' has: "
                          "either add 'cdef dict __dict__' to the extension type "
                          "or add '__slots__ = [...]' to the base type",
                          type_name, b_name);
                      __Pyx_DECREF_TypeName(b_name);
                  }
  #if !CYTHON_USE_TYPE_SLOTS
                dictoffset_return:
  #endif
  #if CYTHON_AVOID_BORROWED_REFS
                  Py_DECREF(b0);
  #endif
                  return -1;
              }
          }
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(b0);
  #endif
      }
      return 0;
  }
  #endif
  
/* PyType_Ready */
  CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
      while (t) {
          PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
          if (bases) {
              return 1;
          }
          t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
      }
      return 0;
  }
  static int __Pyx_PyType_Ready(PyTypeObject *t) {
  #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
      (void)__Pyx_PyObject_CallMethod0;
  #if CYTHON_USE_TYPE_SPECS
      (void)__Pyx_validate_bases_tuple;
  #endif
      return PyType_Ready(t);
  #else
      int r;
      if (!__Pyx_PyType_HasMultipleInheritance(t)) {
          return PyType_Ready(t);
      }
      PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
      if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
          return -1;
  #if !defined(PYSTON_MAJOR_VERSION)
      {
          int gc_was_enabled;
      #if PY_VERSION_HEX >= 0x030A00b1
          gc_was_enabled = PyGC_Disable();
          (void)__Pyx_PyObject_CallMethod0;
      #else
          PyObject *ret, *py_status;
          PyObject *gc = NULL;
          #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
                  !CYTHON_COMPILING_IN_GRAAL
          gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
          #endif
          if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
          if (unlikely(!gc)) return -1;
          py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
          if (unlikely(!py_status)) {
              Py_DECREF(gc);
              return -1;
          }
          gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
          Py_DECREF(py_status);
          if (gc_was_enabled > 0) {
              ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
              if (unlikely(!ret)) {
                  Py_DECREF(gc);
                  return -1;
              }
              Py_DECREF(ret);
          } else if (unlikely(gc_was_enabled == -1)) {
              Py_DECREF(gc);
              return -1;
          }
      #endif
          t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  #if PY_VERSION_HEX >= 0x030A0000
          t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  #endif
  #else
          (void)__Pyx_PyObject_CallMethod0;
  #endif
      r = PyType_Ready(t);
  #if !defined(PYSTON_MAJOR_VERSION)
          t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
      #if PY_VERSION_HEX >= 0x030A00b1
          if (gc_was_enabled)
              PyGC_Enable();
      #else
          if (gc_was_enabled) {
              PyObject *tp, *v, *tb;
              PyErr_Fetch(&tp, &v, &tb);
              ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
              if (likely(ret || r == -1)) {
                  Py_XDECREF(ret);
                  PyErr_Restore(tp, v, tb);
              } else {
                  Py_XDECREF(tp);
                  Py_XDECREF(v);
                  Py_XDECREF(tb);
                  r = -1;
              }
          }
          Py_DECREF(gc);
      #endif
      }
  #endif
      return r;
  #endif
  }
  
/* DelItemOnTypeDict (used by SetupReduce) */
  static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) {
      int result;
      PyObject *tp_dict;
  #if CYTHON_COMPILING_IN_LIMITED_API
      tp_dict = __Pyx_GetTypeDict(tp);
      if (unlikely(!tp_dict)) return -1;
  #else
      tp_dict = tp->tp_dict;
  #endif
      result = PyDict_DelItem(tp_dict, k);
      if (likely(!result)) PyType_Modified(tp);
      return result;
  }
  
/* SetupReduce */
  static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
    int ret;
    PyObject *name_attr;
    name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_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_getstate = NULL;
      PyObject *object_reduce_ex = NULL;
      PyObject *reduce = NULL;
      PyObject *reduce_ex = NULL;
      PyObject *reduce_cython = NULL;
      PyObject *setstate = NULL;
      PyObject *setstate_cython = NULL;
      PyObject *getstate = NULL;
  #if CYTHON_USE_PYTYPE_LOOKUP
      getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
  #else
      getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate);
      if (!getstate && PyErr_Occurred()) {
          goto __PYX_BAD;
      }
  #endif
      if (getstate) {
  #if CYTHON_USE_PYTYPE_LOOKUP
          object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
  #else
          object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate);
          if (!object_getstate && PyErr_Occurred()) {
              goto __PYX_BAD;
          }
  #endif
          if (object_getstate != getstate) {
              goto __PYX_GOOD;
          }
      }
  #if CYTHON_USE_PYTYPE_LOOKUP
      object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  #else
      object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  #endif
      reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
      if (reduce_ex == object_reduce_ex) {
  #if CYTHON_USE_PYTYPE_LOOKUP
          object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
  #else
          object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD;
  #endif
          reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
          if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) {
              reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython);
              if (likely(reduce_cython)) {
                  ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                  ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
              } else if (reduce == object_reduce || PyErr_Occurred()) {
                  goto __PYX_BAD;
              }
              setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate);
              if (!setstate) PyErr_Clear();
              if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) {
                  setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython);
                  if (likely(setstate_cython)) {
                      ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                      ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                  } else if (!setstate || PyErr_Occurred()) {
                      goto __PYX_BAD;
                  }
              }
              PyType_Modified((PyTypeObject*)type_obj);
          }
      }
      goto __PYX_GOOD;
  __PYX_BAD:
      if (!PyErr_Occurred()) {
          __Pyx_TypeName type_obj_name =
              __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj);
          PyErr_Format(PyExc_RuntimeError,
              "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
          __Pyx_DECREF_TypeName(type_obj_name);
      }
      ret = -1;
  __PYX_GOOD:
  #if !CYTHON_USE_PYTYPE_LOOKUP
      Py_XDECREF(object_reduce);
      Py_XDECREF(object_reduce_ex);
      Py_XDECREF(object_getstate);
      Py_XDECREF(getstate);
  #endif
      Py_XDECREF(reduce);
      Py_XDECREF(reduce_ex);
      Py_XDECREF(reduce_cython);
      Py_XDECREF(setstate);
      Py_XDECREF(setstate_cython);
      return ret;
  }
  
/* SetVTable */
  static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
      PyObject *ob = PyCapsule_New(vtable, 0, 0);
      if (unlikely(!ob))
          goto bad;
  #if CYTHON_COMPILING_IN_LIMITED_API
      if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
  #else
      if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0))
  #endif
          goto bad;
      Py_DECREF(ob);
      return 0;
  bad:
      Py_XDECREF(ob);
      return -1;
  }
  
/* GetVTable (used by MergeVTables) */
  static void* __Pyx_GetVtable(PyTypeObject *type) {
      void* ptr;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
  #else
      PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable);
  #endif
      if (!ob)
          goto bad;
      ptr = PyCapsule_GetPointer(ob, 0);
      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;
  }
  
/* MergeVTables */
  static int __Pyx_MergeVtables(PyTypeObject *type) {
      int i=0;
      Py_ssize_t size;
      void** base_vtables;
      __Pyx_TypeName tp_base_name = NULL;
      __Pyx_TypeName base_name = NULL;
      void* unknown = (void*)-1;
      PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*);
      int base_depth = 0;
      {
          PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
          while (base) {
              base_depth += 1;
              base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
          }
      }
      base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1));
      base_vtables[0] = unknown;
  #if CYTHON_COMPILING_IN_LIMITED_API
      size = PyTuple_Size(bases);
      if (size < 0) goto other_failure;
  #else
      size = PyTuple_GET_SIZE(bases);
  #endif
      for (i = 1; i < size; i++) {
          PyObject *basei;
          void* base_vtable;
  #if CYTHON_AVOID_BORROWED_REFS
          basei = PySequence_GetItem(bases, i);
          if (unlikely(!basei)) goto other_failure;
  #elif !CYTHON_ASSUME_SAFE_MACROS
          basei = PyTuple_GetItem(bases, i);
          if (unlikely(!basei)) goto other_failure;
  #else
          basei = PyTuple_GET_ITEM(bases, i);
  #endif
          base_vtable = __Pyx_GetVtable((PyTypeObject*)basei);
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(basei);
  #endif
          if (base_vtable != NULL) {
              int j;
              PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
              for (j = 0; j < base_depth; j++) {
                  if (base_vtables[j] == unknown) {
                      base_vtables[j] = __Pyx_GetVtable(base);
                      base_vtables[j + 1] = unknown;
                  }
                  if (base_vtables[j] == base_vtable) {
                      break;
                  } else if (base_vtables[j] == NULL) {
                      goto bad;
                  }
                  base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*);
              }
          }
      }
      PyErr_Clear();
      PyMem_Free(base_vtables);
      return 0;
  bad:
      {
          PyTypeObject* basei = NULL;
          PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
          tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base);
  #if CYTHON_AVOID_BORROWED_REFS
          basei = (PyTypeObject*)PySequence_GetItem(bases, i);
          if (unlikely(!basei)) goto really_bad;
  #elif !CYTHON_ASSUME_SAFE_MACROS
          basei = (PyTypeObject*)PyTuple_GetItem(bases, i);
          if (unlikely(!basei)) goto really_bad;
  #else
          basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
  #endif
          base_name = __Pyx_PyType_GetFullyQualifiedName(basei);
  #if CYTHON_AVOID_BORROWED_REFS
          Py_DECREF(basei);
  #endif
      }
      PyErr_Format(PyExc_TypeError,
          "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
  #if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  really_bad: // bad has failed!
  #endif
      __Pyx_DECREF_TypeName(tp_base_name);
      __Pyx_DECREF_TypeName(base_name);
  #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS
  other_failure:
  #endif
      PyMem_Free(base_vtables);
      return -1;
  }
  
/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType_3_2_3
  #define __PYX_HAVE_RT_ImportType_3_2_3
  static PyTypeObject *__Pyx_ImportType_3_2_3(PyObject *module, const char *module_name, const char *class_name,
      size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_3 check_size)
  {
      PyObject *result = 0;
      Py_ssize_t basicsize;
      Py_ssize_t itemsize;
  #if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API)
      PyObject *py_basicsize;
      PyObject *py_itemsize;
  #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;
      }
  #if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) )
      basicsize = ((PyTypeObject *)result)->tp_basicsize;
      itemsize = ((PyTypeObject *)result)->tp_itemsize;
  #else
      if (size == 0) {
          return (PyTypeObject *)result;
      }
      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;
      py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
      if (!py_itemsize)
          goto bad;
      itemsize = PyLong_AsSsize_t(py_itemsize);
      Py_DECREF(py_itemsize);
      py_itemsize = 0;
      if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
          goto bad;
  #endif
      if (itemsize) {
          if (size % alignment) {
              alignment = size % alignment;
          }
          if (itemsize < (Py_ssize_t)alignment)
              itemsize = (Py_ssize_t)alignment;
      }
      if ((size_t)(basicsize + itemsize) < 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+itemsize);
          goto bad;
      }
      if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_3 &&
              ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
          PyErr_Format(PyExc_ValueError,
              "%.200s.%.200s size changed, may indicate binary incompatibility. "
              "Expected %zd from C header, got %zd-%zd from PyObject",
              module_name, class_name, size, basicsize, basicsize+itemsize);
          goto bad;
      }
      else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_3 && (size_t)basicsize > size) {
          if (PyErr_WarnFormat(NULL, 0,
                  "%.200s.%.200s size changed, may indicate binary incompatibility. "
                  "Expected %zd from C header, got %zd from PyObject",
                  module_name, class_name, size, basicsize) < 0) {
              goto bad;
          }
      }
      return (PyTypeObject *)result;
  bad:
      Py_XDECREF(result);
      return NULL;
  }
  #endif
  
/* ImportFrom */
  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
      PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
      if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
          const char* module_name_str = 0;
          PyObject* module_name = 0;
          PyObject* module_dot = 0;
          PyObject* full_name = 0;
          PyErr_Clear();
          module_name_str = PyModule_GetName(module);
          if (unlikely(!module_name_str)) { goto modbad; }
          module_name = PyUnicode_FromString(module_name_str);
          if (unlikely(!module_name)) { goto modbad; }
          module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
          if (unlikely(!module_dot)) { goto modbad; }
          full_name = PyUnicode_Concat(module_dot, name);
          if (unlikely(!full_name)) { goto modbad; }
          #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
                  CYTHON_COMPILING_IN_GRAAL
          {
              PyObject *modules = PyImport_GetModuleDict();
              if (unlikely(!modules))
                  goto modbad;
              value = PyObject_GetItem(modules, full_name);
          }
          #else
          value = PyImport_GetModule(full_name);
          #endif
        modbad:
          Py_XDECREF(full_name);
          Py_XDECREF(module_dot);
          Py_XDECREF(module_name);
      }
      if (unlikely(!value)) {
          PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
      }
      return value;
  }
  
/* Py3UpdateBases */
  static PyObject*
  __Pyx_PEP560_update_bases(PyObject *bases)
  {
      Py_ssize_t i, j, size_bases;
      PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL;
  #if CYTHON_ASSUME_SAFE_SIZE
      size_bases = PyTuple_GET_SIZE(bases);
  #else
      size_bases = PyTuple_Size(bases);
      if (size_bases < 0) return NULL;
  #endif
      for (i = 0; i < size_bases; i++) {
  #if CYTHON_AVOID_BORROWED_REFS
          Py_CLEAR(base);
  #endif
  #if CYTHON_ASSUME_SAFE_MACROS
          base = PyTuple_GET_ITEM(bases, i);
  #else
          base = PyTuple_GetItem(bases, i);
          if (!base) goto error;
  #endif
  #if CYTHON_AVOID_BORROWED_REFS
          Py_INCREF(base);
  #endif
          if (PyType_Check(base)) {
              if (new_bases) {
                  if (PyList_Append(new_bases, base) < 0) {
                      goto error;
                  }
              }
              continue;
          }
          meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries);
          if (!meth && PyErr_Occurred()) {
              goto error;
          }
          if (!meth) {
              if (new_bases) {
                  if (PyList_Append(new_bases, base) < 0) {
                      goto error;
                  }
              }
              continue;
          }
          new_base = __Pyx_PyObject_CallOneArg(meth, bases);
          Py_DECREF(meth);
          if (!new_base) {
              goto error;
          }
          if (!PyTuple_Check(new_base)) {
              PyErr_SetString(PyExc_TypeError,
                              "__mro_entries__ must return a tuple");
              Py_DECREF(new_base);
              goto error;
          }
          if (!new_bases) {
              if (!(new_bases = PyList_New(i))) {
                  goto error;
              }
              for (j = 0; j < i; j++) {
                  PyObject *base_from_list;
  #if CYTHON_ASSUME_SAFE_MACROS
                  base_from_list = PyTuple_GET_ITEM(bases, j);
                  PyList_SET_ITEM(new_bases, j, base_from_list);
                  Py_INCREF(base_from_list);
  #else
                  base_from_list = PyTuple_GetItem(bases, j);
                  if (!base_from_list) goto error;
                  Py_INCREF(base_from_list);
                  if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error;
  #endif
              }
          }
  #if CYTHON_ASSUME_SAFE_SIZE
          j = PyList_GET_SIZE(new_bases);
  #else
          j = PyList_Size(new_bases);
          if (j < 0) goto error;
  #endif
          if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
              goto error;
          }
          Py_DECREF(new_base);
      }
      if (!new_bases) {
          Py_INCREF(bases);
          return bases;
      }
      result = PyList_AsTuple(new_bases);
      Py_DECREF(new_bases);
  #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(base);
  #endif
      return result;
  error:
      Py_XDECREF(new_bases);
  #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(base);
  #endif
      return NULL;
  }
  
/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
      Py_ssize_t i, nbases;
  #if CYTHON_ASSUME_SAFE_SIZE
      nbases = PyTuple_GET_SIZE(bases);
  #else
      nbases = PyTuple_Size(bases);
      if (nbases < 0) return NULL;
  #endif
      for (i=0; i < nbases; i++) {
          PyTypeObject *tmptype;
  #if CYTHON_ASSUME_SAFE_MACROS
          PyObject *tmp = PyTuple_GET_ITEM(bases, i);
  #else
          PyObject *tmp = PyTuple_GetItem(bases, i);
          if (!tmp) return NULL;
  #endif
          tmptype = Py_TYPE(tmp);
          if (!metaclass) {
              metaclass = tmptype;
              continue;
          }
          if (PyType_IsSubtype(metaclass, tmptype))
              continue;
          if (PyType_IsSubtype(tmptype, metaclass)) {
              metaclass = tmptype;
              continue;
          }
          PyErr_SetString(PyExc_TypeError,
                          "metaclass conflict: "
                          "the metaclass of a derived class "
                          "must be a (non-strict) subclass "
                          "of the metaclasses of all its bases");
          return NULL;
      }
      if (!metaclass) {
          metaclass = &PyType_Type;
      }
      Py_INCREF((PyObject*) metaclass);
      return (PyObject*) metaclass;
  }
  
/* dict_setdefault (used by FetchCommonType) */
  static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
      PyObject* value;
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
      PyObject *args[] = {d, key, default_value};
      value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  #elif CYTHON_COMPILING_IN_LIMITED_API
      value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
  #elif PY_VERSION_HEX >= 0x030d0000
      PyDict_SetDefaultRef(d, key, default_value, &value);
  #else
      value = PyDict_SetDefault(d, key, default_value);
      if (unlikely(!value)) return NULL;
      Py_INCREF(value);
  #endif
      return value;
  }
  
/* AddModuleRef (used by FetchSharedCythonModule) */
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
    static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
        PyObject *module_dict = PyImport_GetModuleDict();
        PyObject *m;
        if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
            return NULL;
        }
        if (m != NULL && PyModule_Check(m)) {
            return m;
        }
        Py_XDECREF(m);
        m = PyModule_NewObject(name);
        if (m == NULL)
            return NULL;
        if (PyDict_CheckExact(module_dict)) {
            PyObject *new_m;
            (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
            Py_DECREF(m);
            return new_m;
        } else {
             if (PyObject_SetItem(module_dict, name, m) != 0) {
                  Py_DECREF(m);
                  return NULL;
              }
              return m;
        }
    }
    static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
        PyObject *py_name = PyUnicode_FromString(name);
        if (!py_name) return NULL;
        PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
        Py_DECREF(py_name);
        return module;
    }
  #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
    #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  #else
    static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
        PyObject *module = PyImport_AddModule(name);
        Py_XINCREF(module);
        return module;
    }
  #endif
  
/* FetchSharedCythonModule (used by FetchCommonType) */
  static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
      return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
  }
  
/* FetchCommonType (used by CommonTypesMetaclass) */
  #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
      PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
      if (result && metaclass) {
          PyObject *old_tp = (PyObject*)Py_TYPE(result);
      Py_INCREF((PyObject*)metaclass);
  #if __PYX_LIMITED_VERSION_HEX >= 0x03090000
          Py_SET_TYPE(result, metaclass);
  #else
          result->ob_type = metaclass;
  #endif
          Py_DECREF(old_tp);
      }
      return result;
  }
  #else
  #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
  #endif
  static int __Pyx_VerifyCachedType(PyObject *cached_type,
                                 const char *name,
                                 Py_ssize_t expected_basicsize) {
      Py_ssize_t basicsize;
      if (!PyType_Check(cached_type)) {
          PyErr_Format(PyExc_TypeError,
              "Shared Cython type %.200s is not a type object", name);
          return -1;
      }
      if (expected_basicsize == 0) {
          return 0; // size is inherited, nothing useful to check
      }
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *py_basicsize;
      py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
      if (unlikely(!py_basicsize)) return -1;
      basicsize = PyLong_AsSsize_t(py_basicsize);
      Py_DECREF(py_basicsize);
      py_basicsize = NULL;
      if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
  #else
      basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
  #endif
      if (basicsize != expected_basicsize) {
          PyErr_Format(PyExc_TypeError,
              "Shared Cython type %.200s has the wrong size, try recompiling",
              name);
          return -1;
      }
      return 0;
  }
  static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
      PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
      int get_item_ref_result;
      const char* object_name = strrchr(spec->name, '.');
      object_name = object_name ? object_name+1 : spec->name;
      py_object_name = PyUnicode_FromString(object_name);
      if (!py_object_name) return NULL;
      abi_module = __Pyx_FetchSharedCythonABIModule();
      if (!abi_module) goto done;
      abi_module_dict = PyModule_GetDict(abi_module);
      if (!abi_module_dict) goto done;
      get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
      if (get_item_ref_result == 1) {
          if (__Pyx_VerifyCachedType(
                cached_type,
                object_name,
                spec->basicsize) < 0) {
              goto bad;
          }
          goto done;
      } else if (unlikely(get_item_ref_result == -1)) {
          goto bad;
      }
      cached_type = __Pyx_PyType_FromMetaclass(
          metaclass,
          CYTHON_USE_MODULE_STATE ? module : abi_module,
          spec, bases);
      if (unlikely(!cached_type)) goto bad;
      if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
      new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
      if (unlikely(new_cached_type != cached_type)) {
          if (unlikely(!new_cached_type)) goto bad;
          Py_DECREF(cached_type);
          cached_type = new_cached_type;
          if (__Pyx_VerifyCachedType(
                  cached_type,
                  object_name,
                  spec->basicsize) < 0) {
              goto bad;
          }
          goto done;
      } else {
          Py_DECREF(new_cached_type);
      }
  done:
      Py_XDECREF(abi_module);
      Py_DECREF(py_object_name);
      assert(cached_type == NULL || PyType_Check(cached_type));
      return (PyTypeObject *) cached_type;
  bad:
      Py_XDECREF(cached_type);
      cached_type = NULL;
      goto done;
  }
  
/* CommonTypesMetaclass (used by CythonFunctionShared) */
  static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
      return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
  }
  #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
      PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
      return NULL;
  }
  static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
      PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
      return -1;
  }
  #endif
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
      {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
      {0, 0, 0, 0, 0}
  };
  static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
      {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
      #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
      {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
      {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
      {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
      #endif
      {0, 0}
  };
  static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
      __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
      0,
      0,
      Py_TPFLAGS_IMMUTABLETYPE |
      Py_TPFLAGS_DISALLOW_INSTANTIATION |
      Py_TPFLAGS_DEFAULT,
      __pyx_CommonTypesMetaclass_slots
  };
  static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
      __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
      PyObject *bases = PyTuple_Pack(1, &PyType_Type);
      if (unlikely(!bases)) {
          return -1;
      }
      mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
      Py_DECREF(bases);
      if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
          return -1;
      }
      return 0;
  }
  
/* PyMethodNew (used by CythonFunctionShared) */
  #if CYTHON_COMPILING_IN_LIMITED_API
  static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
      PyObject *result;
      CYTHON_UNUSED_VAR(typ);
      if (!self)
          return __Pyx_NewRef(func);
      #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
      {
          PyObject *args[] = {func, self};
          result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
      }
      #else
      result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
      #endif
      return result;
  }
  #else
  static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
      CYTHON_UNUSED_VAR(typ);
      if (!self)
          return __Pyx_NewRef(func);
      return PyMethod_New(func, self);
  }
  #endif
  
/* PyVectorcallFastCallDict (used by CythonFunctionShared) */
  #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  {
      PyObject *res = NULL;
      PyObject *kwnames;
      PyObject **newargs;
      PyObject **kwvalues;
      Py_ssize_t i;
      #if CYTHON_AVOID_BORROWED_REFS
      PyObject *pos;
      #else
      Py_ssize_t pos;
      #endif
      size_t j;
      PyObject *key, *value;
      unsigned long keys_are_strings;
      #if !CYTHON_ASSUME_SAFE_SIZE
      Py_ssize_t nkw = PyDict_Size(kw);
      if (unlikely(nkw == -1)) return NULL;
      #else
      Py_ssize_t nkw = PyDict_GET_SIZE(kw);
      #endif
      newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
      if (unlikely(newargs == NULL)) {
          PyErr_NoMemory();
          return NULL;
      }
      for (j = 0; j < nargs; j++) newargs[j] = args[j];
      kwnames = PyTuple_New(nkw);
      if (unlikely(kwnames == NULL)) {
          PyMem_Free(newargs);
          return NULL;
      }
      kwvalues = newargs + nargs;
      pos = 0;
      i = 0;
      keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
      while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
          keys_are_strings &=
          #if CYTHON_COMPILING_IN_LIMITED_API
              PyType_GetFlags(Py_TYPE(key));
          #else
              Py_TYPE(key)->tp_flags;
          #endif
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
          #else
          PyTuple_SET_ITEM(kwnames, i, key);
          #endif
          kwvalues[i] = value;
          i++;
      }
      if (unlikely(!keys_are_strings)) {
          PyErr_SetString(PyExc_TypeError, "keywords must be strings");
          goto cleanup;
      }
      res = vc(func, newargs, nargs, kwnames);
  cleanup:
      #if CYTHON_AVOID_BORROWED_REFS
      Py_DECREF(pos);
      #endif
      Py_DECREF(kwnames);
      for (i = 0; i < nkw; i++)
          Py_DECREF(kwvalues[i]);
      PyMem_Free(newargs);
      return res;
  }
  static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  {
      Py_ssize_t kw_size =
          likely(kw == NULL) ?
          0 :
  #if !CYTHON_ASSUME_SAFE_SIZE
          PyDict_Size(kw);
  #else
          PyDict_GET_SIZE(kw);
  #endif
      if (kw_size == 0) {
          return vc(func, args, nargs, NULL);
      }
  #if !CYTHON_ASSUME_SAFE_SIZE
      else if (unlikely(kw_size == -1)) {
          return NULL;
      }
  #endif
      return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  }
  #endif
  
/* CythonFunctionShared (used by CythonFunction) */
  #if CYTHON_COMPILING_IN_LIMITED_API
  static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
      if (__Pyx_CyFunction_Check(func)) {
          return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
      } else if (PyCFunction_Check(func)) {
          return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
      }
      return 0;
  }
  static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
      if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
          int result;
          PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
          if (unlikely(!newFunc)) {
              PyErr_Clear(); // It's only an optimization, so don't throw an error
              return 0;
          }
          result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
          Py_DECREF(newFunc);
          return result;
      }
      return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
  }
  #else
  static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
      if (PyMethod_Check(func)) {
          func = PyMethod_GET_FUNCTION(func);
      }
      return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  }
  #endif
  static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
      __Pyx_Py_XDECREF_SET(
          __Pyx_CyFunction_GetClassObj(f),
              ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  #else
      __Pyx_Py_XDECREF_SET(
          ((PyCMethodObject *) (f))->mm_class,
          (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  #endif
  }
  static PyObject *
  __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
  {
      if (unlikely(op->func_doc == NULL)) {
  #if CYTHON_COMPILING_IN_LIMITED_API
          op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
          if (unlikely(!op->func_doc)) return NULL;
  #else
          if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
              op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
              if (unlikely(op->func_doc == NULL))
                  return NULL;
          } else {
              Py_INCREF(Py_None);
              return Py_None;
          }
  #endif
      }
      Py_INCREF(op->func_doc);
      return op->func_doc;
  }
  static PyObject *
  __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
      PyObject *result;
      CYTHON_UNUSED_VAR(closure);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      result = __Pyx_CyFunction_get_doc_locked(op);
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static int
  __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      if (value == NULL) {
          value = Py_None;
      }
      Py_INCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->func_doc, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  static PyObject *
  __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
  {
      if (unlikely(op->func_name == NULL)) {
  #if CYTHON_COMPILING_IN_LIMITED_API
          op->func_name = PyObject_GetAttrString(op->func, "__name__");
  #else
          op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  #endif
          if (unlikely(op->func_name == NULL))
              return NULL;
      }
      Py_INCREF(op->func_name);
      return op->func_name;
  }
  static PyObject *
  __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  {
      PyObject *result = NULL;
      CYTHON_UNUSED_VAR(context);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      result = __Pyx_CyFunction_get_name_locked(op);
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static int
  __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      if (unlikely(value == NULL || !PyUnicode_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__name__ must be set to a string object");
          return -1;
      }
      Py_INCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->func_name, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  static PyObject *
  __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      PyObject *result;
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      Py_INCREF(op->func_qualname);
      result = op->func_qualname;
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static int
  __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      if (unlikely(value == NULL || !PyUnicode_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__qualname__ must be set to a string object");
          return -1;
      }
      Py_INCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->func_qualname, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  static PyObject *
  __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  {
      CYTHON_UNUSED_VAR(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;
  }
  #endif
  static PyObject *
  __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      Py_INCREF(op->func_globals);
      return op->func_globals;
  }
  static PyObject *
  __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  {
      CYTHON_UNUSED_VAR(op);
      CYTHON_UNUSED_VAR(context);
      Py_INCREF(Py_None);
      return Py_None;
  }
  static PyObject *
  __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  {
      PyObject* result = (op->func_code) ? op->func_code : Py_None;
      CYTHON_UNUSED_VAR(context);
      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 = __Pyx_PySequence_ITEM(res, 0);
      if (unlikely(!op->defaults_tuple)) result = -1;
      else {
          op->defaults_kwdict = __Pyx_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, void *context) {
      CYTHON_UNUSED_VAR(context);
      if (!value) {
          value = Py_None;
      } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__defaults__ must be set to a tuple object");
          return -1;
      }
      PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                   "currently affect the values used in function calls", 1);
      Py_INCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  static PyObject *
  __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
      PyObject* result = op->defaults_tuple;
      if (unlikely(!result)) {
          if (op->defaults_getter) {
              if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
              result = op->defaults_tuple;
          } else {
              result = Py_None;
          }
      }
      Py_INCREF(result);
      return result;
  }
  static PyObject *
  __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
      PyObject* result = NULL;
      CYTHON_UNUSED_VAR(context);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      result = __Pyx_CyFunction_get_defaults_locked(op);
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static int
  __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
      CYTHON_UNUSED_VAR(context);
      if (!value) {
          value = Py_None;
      } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__kwdefaults__ must be set to a dict object");
          return -1;
      }
      PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
                   "currently affect the values used in function calls", 1);
      Py_INCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  static PyObject *
  __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
      PyObject* result = op->defaults_kwdict;
      if (unlikely(!result)) {
          if (op->defaults_getter) {
              if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
              result = op->defaults_kwdict;
          } else {
              result = Py_None;
          }
      }
      Py_INCREF(result);
      return result;
  }
  static PyObject *
  __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
      PyObject* result;
      CYTHON_UNUSED_VAR(context);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      result = __Pyx_CyFunction_get_kwdefaults_locked(op);
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static int
  __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
      CYTHON_UNUSED_VAR(context);
      if (!value || value == Py_None) {
          value = NULL;
      } else if (unlikely(!PyDict_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__annotations__ must be set to a dict object");
          return -1;
      }
      Py_XINCREF(value);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      __Pyx_Py_XDECREF_SET(op->func_annotations, value);
      __Pyx_END_CRITICAL_SECTION();
      return 0;
  }
  static PyObject *
  __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
      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 PyObject *
  __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
      PyObject *result;
      CYTHON_UNUSED_VAR(context);
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      result = __Pyx_CyFunction_get_annotations_locked(op);
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static PyObject *
  __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
      int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
      if (is_coroutine) {
          PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
          fromlist = PyList_New(1);
          if (unlikely(!fromlist)) return NULL;
          Py_INCREF(marker);
  #if CYTHON_ASSUME_SAFE_MACROS
          PyList_SET_ITEM(fromlist, 0, marker);
  #else
          if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
              Py_DECREF(marker);
              Py_DECREF(fromlist);
              return NULL;
          }
  #endif
          module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
          Py_DECREF(fromlist);
          if (unlikely(!module)) goto ignore;
          is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
          Py_DECREF(module);
          if (likely(is_coroutine_value)) {
              return is_coroutine_value;
          }
  ignore:
          PyErr_Clear();
      }
      return __Pyx_PyBool_FromLong(is_coroutine);
  }
  static PyObject *
  __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
      PyObject *result;
      CYTHON_UNUSED_VAR(context);
      if (op->func_is_coroutine) {
          return __Pyx_NewRef(op->func_is_coroutine);
      }
      result = __Pyx_CyFunction_get_is_coroutine_value(op);
      if (unlikely(!result))
          return NULL;
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      if (op->func_is_coroutine) {
          Py_DECREF(result);
          result = __Pyx_NewRef(op->func_is_coroutine);
      } else {
          op->func_is_coroutine = __Pyx_NewRef(result);
      }
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
      if (!py_name) return;
      PyErr_Format(PyExc_TypeError,
          "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
          py_name, message, size);
      Py_DECREF(py_name);
  #else
      const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
      PyErr_Format(PyExc_TypeError,
          "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
          name, message, size);
  #endif
  }
  static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
      if (!py_name) return;
      PyErr_Format(PyExc_TypeError,
          "%.200S() %s",
          py_name, message);
      Py_DECREF(py_name);
  #else
      const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
      PyErr_Format(PyExc_TypeError,
          "%.200s() %s",
          name, message);
  #endif
  }
  #if CYTHON_COMPILING_IN_LIMITED_API
  static PyObject *
  __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
      CYTHON_UNUSED_VAR(context);
      return PyObject_GetAttrString(op->func, "__module__");
  }
  static int
  __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
      CYTHON_UNUSED_VAR(context);
      return PyObject_SetAttrString(op->func, "__module__", value);
  }
  #endif
  static PyGetSetDef __pyx_CyFunction_getsets[] = {
      {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
      {"__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
      {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
      {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
      {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
      {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
      {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  #else
      {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
      {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  #endif
      {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
      {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
      {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
      {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
      {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
      {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
      {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
      {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
      {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
      {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
      {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  #if CYTHON_COMPILING_IN_LIMITED_API
      {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  #endif
      {0, 0, 0, 0, 0}
  };
  static PyMemberDef __pyx_CyFunction_members[] = {
  #if !CYTHON_COMPILING_IN_LIMITED_API
      {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  #endif
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  #endif
  #if CYTHON_METH_FASTCALL
  #if CYTHON_COMPILING_IN_LIMITED_API
      {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  #else
      {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  #endif
  #if CYTHON_COMPILING_IN_LIMITED_API
      {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  #else
      {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  #endif
  #endif
      {0, 0, 0,  0, 0}
  };
  static PyObject *
  __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  {
      PyObject *result = NULL;
      CYTHON_UNUSED_VAR(args);
      __Pyx_BEGIN_CRITICAL_SECTION(m);
      Py_INCREF(m->func_qualname);
      result = m->func_qualname;
      __Pyx_END_CRITICAL_SECTION();
      return result;
  }
  static PyMethodDef __pyx_CyFunction_methods[] = {
      {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
      {0, 0, 0, 0}
  };
  #if CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  #else
  #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  #endif
  static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                         PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  #if !CYTHON_COMPILING_IN_LIMITED_API
      PyCFunctionObject *cf = (PyCFunctionObject*) op;
  #endif
      if (unlikely(op == NULL))
          return NULL;
  #if CYTHON_COMPILING_IN_LIMITED_API
      op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
      if (unlikely(!op->func)) return NULL;
  #endif
      op->flags = flags;
      __Pyx_CyFunction_weakreflist(op) = NULL;
  #if !CYTHON_COMPILING_IN_LIMITED_API
      cf->m_ml = ml;
      cf->m_self = (PyObject *) op;
  #endif
      Py_XINCREF(closure);
      op->func_closure = closure;
  #if !CYTHON_COMPILING_IN_LIMITED_API
      Py_XINCREF(module);
      cf->m_module = module;
  #endif
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      op->func_dict = NULL;
  #endif
      op->func_name = NULL;
      Py_INCREF(qualname);
      op->func_qualname = qualname;
      op->func_doc = NULL;
  #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
      op->func_classobj = NULL;
  #else
      ((PyCMethodObject*)op)->mm_class = NULL;
  #endif
      op->func_globals = globals;
      Py_INCREF(op->func_globals);
      Py_XINCREF(code);
      op->func_code = code;
      op->defaults = NULL;
      op->defaults_tuple = NULL;
      op->defaults_kwdict = NULL;
      op->defaults_getter = NULL;
      op->func_annotations = NULL;
      op->func_is_coroutine = NULL;
  #if CYTHON_METH_FASTCALL
      switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
      case METH_NOARGS:
          __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
          break;
      case METH_O:
          __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
          break;
      case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
          __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
          break;
      case METH_FASTCALL | METH_KEYWORDS:
          __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
          break;
      case METH_VARARGS | METH_KEYWORDS:
          __Pyx_CyFunction_func_vectorcall(op) = NULL;
          break;
      default:
          PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
          Py_DECREF(op);
          return NULL;
      }
  #endif
      return (PyObject *) op;
  }
  static int
  __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  {
      Py_CLEAR(m->func_closure);
  #if CYTHON_COMPILING_IN_LIMITED_API
      Py_CLEAR(m->func);
  #else
      Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  #endif
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      Py_CLEAR(m->func_dict);
  #elif PY_VERSION_HEX < 0x030d0000
      _PyObject_ClearManagedDict((PyObject*)m);
  #else
      PyObject_ClearManagedDict((PyObject*)m);
  #endif
      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);
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #if PY_VERSION_HEX < 0x030900B1
      Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  #else
      {
          PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
          ((PyCMethodObject *) (m))->mm_class = NULL;
          Py_XDECREF(cls);
      }
  #endif
  #endif
      Py_CLEAR(m->defaults_tuple);
      Py_CLEAR(m->defaults_kwdict);
      Py_CLEAR(m->func_annotations);
      Py_CLEAR(m->func_is_coroutine);
      Py_CLEAR(m->defaults);
      return 0;
  }
  static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  {
      if (__Pyx_CyFunction_weakreflist(m) != NULL)
          PyObject_ClearWeakRefs((PyObject *) m);
      __Pyx_CyFunction_clear(m);
      __Pyx_PyHeapTypeObject_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)
  {
      {
          int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
          if (e) return e;
      }
      Py_VISIT(m->func_closure);
  #if CYTHON_COMPILING_IN_LIMITED_API
      Py_VISIT(m->func);
  #else
      Py_VISIT(((PyCFunctionObject*)m)->m_module);
  #endif
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      Py_VISIT(m->func_dict);
  #else
      {
          int e =
  #if PY_VERSION_HEX < 0x030d0000
              _PyObject_VisitManagedDict
  #else
              PyObject_VisitManagedDict
  #endif
                  ((PyObject*)m, visit, arg);
          if (e != 0) return e;
      }
  #endif
      __Pyx_VISIT_CONST(m->func_name);
      __Pyx_VISIT_CONST(m->func_qualname);
      Py_VISIT(m->func_doc);
      Py_VISIT(m->func_globals);
      __Pyx_VISIT_CONST(m->func_code);
  #if !CYTHON_COMPILING_IN_LIMITED_API
      Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  #endif
      Py_VISIT(m->defaults_tuple);
      Py_VISIT(m->defaults_kwdict);
      Py_VISIT(m->func_is_coroutine);
      Py_VISIT(m->defaults);
      return 0;
  }
  static PyObject*
  __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  {
      PyObject *repr;
      __Pyx_BEGIN_CRITICAL_SECTION(op);
      repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
                                  op->func_qualname, (void *)op);
      __Pyx_END_CRITICAL_SECTION();
      return repr;
  }
  static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
      PyCFunction meth;
      int flags;
      meth = PyCFunction_GetFunction(f);
      if (unlikely(!meth)) return NULL;
      flags = PyCFunction_GetFlags(f);
      if (unlikely(flags < 0)) return NULL;
  #else
      PyCFunctionObject* f = (PyCFunctionObject*)func;
      PyCFunction meth = f->m_ml->ml_meth;
      int flags = f->m_ml->ml_flags;
  #endif
      Py_ssize_t size;
      switch (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(*)(void))meth)(self, arg, kw);
      case METH_NOARGS:
          if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  #if CYTHON_ASSUME_SAFE_SIZE
              size = PyTuple_GET_SIZE(arg);
  #else
              size = PyTuple_Size(arg);
              if (unlikely(size < 0)) return NULL;
  #endif
              if (likely(size == 0))
                  return (*meth)(self, NULL);
              __Pyx_CyFunction_raise_argument_count_error(
                  (__pyx_CyFunctionObject*)func,
                  "takes no arguments", size);
              return NULL;
          }
          break;
      case METH_O:
          if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  #if CYTHON_ASSUME_SAFE_SIZE
              size = PyTuple_GET_SIZE(arg);
  #else
              size = PyTuple_Size(arg);
              if (unlikely(size < 0)) return NULL;
  #endif
              if (likely(size == 1)) {
                  PyObject *result, *arg0;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  arg0 = PyTuple_GET_ITEM(arg, 0);
                  #else
                  arg0 = __Pyx_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;
              }
              __Pyx_CyFunction_raise_argument_count_error(
                  (__pyx_CyFunctionObject*)func,
                  "takes exactly one argument", size);
              return NULL;
          }
          break;
      default:
          PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
          return NULL;
      }
      __Pyx_CyFunction_raise_type_error(
          (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
      return NULL;
  }
  static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
      PyObject *self, *result;
  #if CYTHON_COMPILING_IN_LIMITED_API
      self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
      if (unlikely(!self) && PyErr_Occurred()) return NULL;
  #else
      self = ((PyCFunctionObject*)func)->m_self;
  #endif
      result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
      return result;
  }
  static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
      PyObject *result;
      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
       __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
      if (vc) {
  #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
          return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  #else
          (void) &__Pyx_PyVectorcall_FastCallDict;
          return PyVectorcall_Call(func, args, kw);
  #endif
      }
  #endif
      if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
          Py_ssize_t argc;
          PyObject *new_args;
          PyObject *self;
  #if CYTHON_ASSUME_SAFE_SIZE
          argc = PyTuple_GET_SIZE(args);
  #else
          argc = PyTuple_Size(args);
          if (unlikely(argc < 0)) return NULL;
  #endif
          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);
              PyErr_Format(PyExc_TypeError,
                           "unbound method %.200S() needs an argument",
                           cyfunc->func_qualname);
              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;
  }
  #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  {
      int ret = 0;
      if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
          if (unlikely(nargs < 1)) {
              __Pyx_CyFunction_raise_type_error(
                  cyfunc, "needs an argument");
              return -1;
          }
          ret = 1;
      }
      if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
          __Pyx_CyFunction_raise_type_error(
              cyfunc, "takes no keyword arguments");
          return -1;
      }
      return ret;
  }
  static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  {
      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
      Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
      PyObject *self;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
      if (unlikely(!meth)) return NULL;
  #else
      PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  #endif
      switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
      case 1:
          self = args[0];
          args += 1;
          nargs -= 1;
          break;
      case 0:
  #if CYTHON_COMPILING_IN_LIMITED_API
          self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
          if (unlikely(!self) && PyErr_Occurred()) return NULL;
  #else
          self = ((PyCFunctionObject*)cyfunc)->m_self;
  #endif
          break;
      default:
          return NULL;
      }
      if (unlikely(nargs != 0)) {
          __Pyx_CyFunction_raise_argument_count_error(
              cyfunc, "takes no arguments", nargs);
          return NULL;
      }
      return meth(self, NULL);
  }
  static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  {
      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
      Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
      PyObject *self;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
      if (unlikely(!meth)) return NULL;
  #else
      PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  #endif
      switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
      case 1:
          self = args[0];
          args += 1;
          nargs -= 1;
          break;
      case 0:
  #if CYTHON_COMPILING_IN_LIMITED_API
          self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
          if (unlikely(!self) && PyErr_Occurred()) return NULL;
  #else
          self = ((PyCFunctionObject*)cyfunc)->m_self;
  #endif
          break;
      default:
          return NULL;
      }
      if (unlikely(nargs != 1)) {
          __Pyx_CyFunction_raise_argument_count_error(
              cyfunc, "takes exactly one argument", nargs);
          return NULL;
      }
      return meth(self, args[0]);
  }
  static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  {
      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
      Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
      PyObject *self;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
      if (unlikely(!meth)) return NULL;
  #else
      PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  #endif
      switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
      case 1:
          self = args[0];
          args += 1;
          nargs -= 1;
          break;
      case 0:
  #if CYTHON_COMPILING_IN_LIMITED_API
          self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
          if (unlikely(!self) && PyErr_Occurred()) return NULL;
  #else
          self = ((PyCFunctionObject*)cyfunc)->m_self;
  #endif
          break;
      default:
          return NULL;
      }
      return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
  }
  static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  {
      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
      PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
      Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
      PyObject *self;
  #if CYTHON_COMPILING_IN_LIMITED_API
      PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
      if (unlikely(!meth)) return NULL;
  #else
      PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  #endif
      switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
      case 1:
          self = args[0];
          args += 1;
          nargs -= 1;
          break;
      case 0:
  #if CYTHON_COMPILING_IN_LIMITED_API
          self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
          if (unlikely(!self) && PyErr_Occurred()) return NULL;
  #else
          self = ((PyCFunctionObject*)cyfunc)->m_self;
  #endif
          break;
      default:
          return NULL;
      }
      #if PY_VERSION_HEX < 0x030e00A6
      size_t nargs_value = (size_t) nargs;
      #else
      Py_ssize_t nargs_value = nargs;
      #endif
      return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
  }
  #endif
  static PyType_Slot __pyx_CyFunctionType_slots[] = {
      {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
      {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
      {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
      {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
      {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
      {Py_tp_methods, (void *)__pyx_CyFunction_methods},
      {Py_tp_members, (void *)__pyx_CyFunction_members},
      {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
      {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
      {0, 0},
  };
  static PyType_Spec __pyx_CyFunctionType_spec = {
      __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
      sizeof(__pyx_CyFunctionObject),
      0,
  #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
      Py_TPFLAGS_METHOD_DESCRIPTOR |
  #endif
  #if CYTHON_METH_FASTCALL
  #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
      Py_TPFLAGS_HAVE_VECTORCALL |
  #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
      _Py_TPFLAGS_HAVE_VECTORCALL |
  #endif
  #endif // CYTHON_METH_FASTCALL
  #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_TPFLAGS_MANAGED_DICT |
  #endif
      Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
      Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
      __pyx_CyFunctionType_slots
  };
  static int __pyx_CyFunction_init(PyObject *module) {
      __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
      mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
          mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
      if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
          return -1;
      }
      return 0;
  }
  static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
      __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
      m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
      if (unlikely(!m->defaults))
          return NULL;
      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);
  }
  
/* CythonFunction */
  static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
      PyObject *op = __Pyx_CyFunction_Init(
          PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
          ml, flags, qualname, closure, module, globals, code
      );
      if (likely(op)) {
          PyObject_GC_Track(op);
      }
      return op;
  }
  
/* PyObjectLookupSpecial (used by Py3ClassCreate) */
  #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
  static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
      PyObject *res;
      PyTypeObject *tp = Py_TYPE(obj);
      res = _PyType_Lookup(tp, attr_name);
      if (likely(res)) {
          descrgetfunc f = Py_TYPE(res)->tp_descr_get;
          if (!f) {
              Py_INCREF(res);
          } else {
              res = f(res, obj, (PyObject *)tp);
          }
      } else if (with_error) {
          PyErr_SetObject(PyExc_AttributeError, attr_name);
      }
      return res;
  }
  #endif
  
/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                             PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
      PyObject *ns;
      if (metaclass) {
          PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare);
          if (prep) {
              PyObject *pargs[3] = {NULL, name, bases};
              ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
              Py_DECREF(prep);
          } else {
              if (unlikely(PyErr_Occurred()))
                  return NULL;
              ns = PyDict_New();
          }
      } else {
          ns = PyDict_New();
      }
      if (unlikely(!ns))
          return NULL;
      if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad;
      if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad;
      if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad;
      return ns;
  bad:
      Py_DECREF(ns);
      return NULL;
  }
  static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                        PyObject *dict, PyObject *mkw,
                                        int calculate_metaclass, int allow_py2_metaclass) {
      PyObject *result;
      PyObject *owned_metaclass = NULL;
      PyObject *margs[4] = {NULL, name, bases, dict};
      if (allow_py2_metaclass) {
          owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass);
          if (owned_metaclass) {
              metaclass = owned_metaclass;
          } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
              PyErr_Clear();
          } else {
              return NULL;
          }
      }
      if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
          metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
          Py_XDECREF(owned_metaclass);
          if (unlikely(!metaclass))
              return NULL;
          owned_metaclass = metaclass;
      }
      result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
      Py_XDECREF(owned_metaclass);
      return result;
  }
  
/* ClassMethod */
  static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
  #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
      if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
          return PyClassMethod_New(method);
      }
  #else
  #if CYTHON_COMPILING_IN_PYPY
      if (PyMethodDescr_Check(method))
  #else
      if (__Pyx_TypeCheck(method, &PyMethodDescr_Type))
  #endif
      {
  #if CYTHON_COMPILING_IN_LIMITED_API
          return PyErr_Format(
              PyExc_SystemError,
              "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. "
              "This is most likely a classmethod in a cdef class method with binding=False. "
              "Try setting 'binding' to True.",
              method);
  #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
          PyTypeObject *d_type = GraalPyDescrObject_GetType(method);
          return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method));
  #elif CYTHON_COMPILING_IN_GRAAL
          PyTypeObject *d_type = PyDescrObject_GetType(method);
          return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method));
  #else
          PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
          PyTypeObject *d_type = descr->d_common.d_type;
          return PyDescr_NewClassMethod(d_type, descr->d_method);
  #endif
      }
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
      else if (PyMethod_Check(method)) {
          return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
      }
      else {
          return PyClassMethod_New(method);
      }
  #else
      {
          PyObject *func=NULL;
          PyObject *builtins, *classmethod, *classmethod_str, *result=NULL;
          if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) {
              func = PyObject_GetAttrString(method, "__func__");
              if (!func) goto bad;
          } else {
              func = method;
              Py_INCREF(func);
          }
          builtins = PyEval_GetBuiltins(); // borrowed
          if (unlikely(!builtins)) goto bad;
          classmethod_str = PyUnicode_FromString("classmethod");
          if (unlikely(!classmethod_str)) goto bad;
          classmethod = PyObject_GetItem(builtins, classmethod_str);
          Py_DECREF(classmethod_str);
          if (unlikely(!classmethod)) goto bad;
          result = PyObject_CallFunctionObjArgs(classmethod, func, NULL);
          Py_DECREF(classmethod);
          bad:
          Py_XDECREF(func);
          return result;
      }
  #endif
  }
  
/* GetNameInClass */
  static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
      PyObject *result;
      PyObject *dict;
      assert(PyType_Check(nmspace));
  #if CYTHON_USE_TYPE_SLOTS
      dict = ((PyTypeObject*)nmspace)->tp_dict;
      Py_XINCREF(dict);
  #else
      dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict);
  #endif
      if (likely(dict)) {
          result = PyObject_GetItem(dict, name);
          Py_DECREF(dict);
          if (result) {
              return result;
          }
      }
      PyErr_Clear();
      __Pyx_GetModuleGlobalNameUncached(result, name);
      return result;
  }
  
/* CLineInTraceback (used by AddTraceback) */
  #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  #else
  PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
      PyObject **dict_ptr = _PyObject_GetDictPtr(o);
      return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  }
  #endif
  static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
      PyObject *use_cline = NULL;
      PyObject *ptype, *pvalue, *ptraceback;
      PyObject *cython_runtime_dict;
      CYTHON_MAYBE_UNUSED_VAR(tstate);
      if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
          return c_line;
      }
      __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
      cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
      if (likely(cython_runtime_dict)) {
          __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
              use_cline, cython_runtime_dict,
              __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
      }
      if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
          c_line = 0;
      }
      Py_XDECREF(use_cline);
      Py_XDECREF(cython_runtime_dict);
      __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
      return c_line;
  }
  #endif
  
/* CodeObjectCache (used by AddTraceback) */
  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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
      __Pyx_CachedCodeObjectType* code_object;
      int pos;
      if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
          return NULL;
      }
      pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
      if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
          return NULL;
      }
      code_object = code_cache->entries[pos].code_object;
      Py_INCREF(code_object);
      return code_object;
  }
  static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
      (void)__pyx__find_code_object;
      return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  #else
      struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
      if (old_count < 0) {
          __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
          return NULL;
      }
  #endif
      __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  #endif
      return result;
  #endif
  }
  static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  {
      int pos, i;
      __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
      if (unlikely(!code_line)) {
          return;
      }
      if (unlikely(!entries)) {
          entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
          if (likely(entries)) {
              code_cache->entries = entries;
              code_cache->max_count = 64;
              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(code_cache->entries, code_cache->count, code_line);
      if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
          __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
          entries[pos].code_object = code_object;
          Py_INCREF(code_object);
          Py_DECREF(tmp);
          return;
      }
      if (code_cache->count == code_cache->max_count) {
          int new_max = code_cache->max_count + 64;
          entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
              code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
          if (unlikely(!entries)) {
              return;
          }
          code_cache->entries = entries;
          code_cache->max_count = new_max;
      }
      for (i=code_cache->count; i>pos; i--) {
          entries[i] = entries[i-1];
      }
      entries[pos].code_line = code_line;
      entries[pos].code_object = code_object;
      code_cache->count++;
      Py_INCREF(code_object);
  }
  static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
      (void)__pyx__insert_code_object;
      return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  #else
      struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_nonatomic_int_type expected = 0;
      if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
          return;
      }
  #endif
      __pyx__insert_code_object(code_cache, code_line, code_object);
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
      __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  #endif
  #endif
  }
  
/* AddTraceback */
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
  #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
    #ifndef Py_BUILD_CORE
      #define Py_BUILD_CORE 1
    #endif
    #include "internal/pycore_frame.h"
  #endif
  #if CYTHON_COMPILING_IN_LIMITED_API
  static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
                                                         PyObject *firstlineno, PyObject *name) {
      PyObject *replace = NULL;
      if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
      if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
      replace = PyObject_GetAttrString(code, "replace");
      if (likely(replace)) {
          PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
          Py_DECREF(replace);
          return result;
      }
      PyErr_Clear();
      return NULL;
  }
  static void __Pyx_AddTraceback(const char *funcname, int c_line,
                                 int py_line, const char *filename) {
      PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
      PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
      PyObject *exc_type, *exc_value, *exc_traceback;
      int success = 0;
      if (c_line) {
          c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
      }
      PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
      code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
      if (!code_object) {
          code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
          if (unlikely(!code_object)) goto bad;
          py_py_line = PyLong_FromLong(py_line);
          if (unlikely(!py_py_line)) goto bad;
          if (c_line) {
              py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
          } else {
              py_funcname = PyUnicode_FromString(funcname);
          }
          if (unlikely(!py_funcname)) goto bad;
          dict = PyDict_New();
          if (unlikely(!dict)) goto bad;
          {
              PyObject *old_code_object = code_object;
              code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
              Py_DECREF(old_code_object);
          }
          if (unlikely(!code_object)) goto bad;
          __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
      } else {
          dict = PyDict_New();
      }
      getframe = PySys_GetObject("_getframe");
      if (unlikely(!getframe)) goto bad;
      if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
      frame = PyEval_EvalCode(code_object, dict, dict);
      if (unlikely(!frame) || frame == Py_None) goto bad;
      success = 1;
    bad:
      PyErr_Restore(exc_type, exc_value, exc_traceback);
      Py_XDECREF(code_object);
      Py_XDECREF(py_py_line);
      Py_XDECREF(py_funcname);
      Py_XDECREF(dict);
      Py_XDECREF(replace);
      if (success) {
          PyTraceBack_Here(
              (struct _frame*)frame);
      }
      Py_XDECREF(frame);
  }
  #else
  static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
              const char *funcname, int c_line,
              int py_line, const char *filename) {
      PyCodeObject *py_code = NULL;
      PyObject *py_funcname = NULL;
      if (c_line) {
          py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
          if (!py_funcname) goto bad;
          funcname = PyUnicode_AsUTF8(py_funcname);
          if (!funcname) goto bad;
      }
      py_code = PyCode_NewEmpty(filename, funcname, py_line);
      Py_XDECREF(py_funcname);
      return py_code;
  bad:
      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;
      PyObject *ptype, *pvalue, *ptraceback;
      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) {
          __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
          py_code = __Pyx_CreateCodeObjectForTraceback(
              funcname, c_line, py_line, filename);
          if (!py_code) {
              /* If the code object creation fails, then we should clear the
                 fetched exception references and propagate the new exception */
              Py_XDECREF(ptype);
              Py_XDECREF(pvalue);
              Py_XDECREF(ptraceback);
              goto bad;
          }
          __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
          __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
      }
      py_frame = PyFrame_New(
          tstate,            /*PyThreadState *tstate,*/
          py_code,           /*PyCodeObject *code,*/
          __pyx_mstate_global->__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);
  }
  #endif
  
/* CheckUnpickleChecksum */
  static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
      PyObject *pickle_module = PyImport_ImportModule("pickle");
      if (unlikely(!pickle_module)) return;
      PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError");
      Py_DECREF(pickle_module);
      if (unlikely(!pickle_error)) return;
      if (checksum2 == checksum1) {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))",
              checksum, checksum1, members);
      } else if (checksum3 == checksum2) {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))",
              checksum, checksum1, checksum2, members);
      } else {
          PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))",
              checksum, checksum1, checksum2, checksum3, members);
      }
      Py_DECREF(pickle_error);
  }
  static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) {
      int found = 0;
      found |= checksum1 == checksum;
      found |= checksum2 == checksum;
      found |= checksum3 == checksum;
      if (likely(found))
          return 0;
      __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members);
      return -1;
  }
  
/* 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;\
      }
  
/* IntPow */
  static CYTHON_INLINE int64_t __Pyx_pow_int64_t(int64_t b, int64_t e) {
      int64_t t = b;
      switch (e) {
          case 3:
              t *= b;
          CYTHON_FALLTHROUGH;
          case 2:
              t *= b;
          CYTHON_FALLTHROUGH;
          case 1:
              return t;
          case 0:
              return 1;
      }
      #if 1
      if (unlikely(e<0)) return 0;
      #endif
      t = 1;
      while (likely(e)) {
          t *= (b * (e&1)) | ((~e)&1);
          b *= b;
          e >>= 1;
      }
      return t;
  }
  
/* MemviewDtypeToObject */
  static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
      return (PyObject *) PyFloat_FromDouble(*(double const *) itemp);
  }
  static CYTHON_INLINE int __pyx_memview_set_double(char *itemp, PyObject *obj) {
      double value = __Pyx_PyFloat_AsDouble(obj);
      if (unlikely((value == (double)-1) && PyErr_Occurred()))
          return 0;
      *(double *) itemp = value;
      return 1;
  }
  
/* Declarations */
  #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #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 && (1) && (!0 || __cplusplus)
  #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:
                          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) && (a.real >= 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 && (1) && (!0 || __cplusplus)
    #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 && (1) && (!0 || __cplusplus)
  #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:
                          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) && (a.real >= 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
  
/* Declarations */
  #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
    #ifdef __cplusplus
      static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
        return ::std::complex< long double >(x, y);
      }
    #else
      static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
        return x + y*(__pyx_t_long_double_complex)_Complex_I;
      }
    #endif
  #else
      static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) {
        __pyx_t_long_double_complex z;
        z.real = x;
        z.imag = y;
        return z;
      }
  #endif
  
/* Arithmetic */
  #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  #else
      static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
         return (a.real == b.real) && (a.imag == b.imag);
      }
      static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
          __pyx_t_long_double_complex z;
          z.real = a.real + b.real;
          z.imag = a.imag + b.imag;
          return z;
      }
      static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
          __pyx_t_long_double_complex z;
          z.real = a.real - b.real;
          z.imag = a.imag - b.imag;
          return z;
      }
      static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
          __pyx_t_long_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_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
          if (b.imag == 0) {
              return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real);
          } else if (fabsl(b.real) >= fabsl(b.imag)) {
              if (b.real == 0 && b.imag == 0) {
                  return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
              } else {
                  long double r = b.imag / b.real;
                  long double s = (long double)(1.0) / (b.real + b.imag * r);
                  return __pyx_t_long_double_complex_from_parts(
                      (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
              }
          } else {
              long double r = b.real / b.imag;
              long double s = (long double)(1.0) / (b.imag + b.real * r);
              return __pyx_t_long_double_complex_from_parts(
                  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
          }
      }
      #else
      static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
          if (b.imag == 0) {
              return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real);
          } else {
              long double denom = b.real * b.real + b.imag * b.imag;
              return __pyx_t_long_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_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) {
          __pyx_t_long_double_complex z;
          z.real = -a.real;
          z.imag = -a.imag;
          return z;
      }
      static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) {
         return (a.real == 0) && (a.imag == 0);
      }
      static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) {
          __pyx_t_long_double_complex z;
          z.real =  a.real;
          z.imag = -a.imag;
          return z;
      }
      #if 1
          static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) {
            #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
              return sqrtl(z.real*z.real + z.imag*z.imag);
            #else
              return hypotl(z.real, z.imag);
            #endif
          }
          static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) {
              __pyx_t_long_double_complex z;
              long double r, lnr, theta, z_r, z_theta;
              if (b.imag == 0 && b.real == (int)b.real) {
                  if (b.real < 0) {
                      long 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:
                          return __Pyx_c_prod_long__double(a, a);
                      case 3:
                          z = __Pyx_c_prod_long__double(a, a);
                          return __Pyx_c_prod_long__double(z, a);
                      case 4:
                          z = __Pyx_c_prod_long__double(a, a);
                          return __Pyx_c_prod_long__double(z, z);
                  }
              }
              if (a.imag == 0) {
                  if (a.real == 0) {
                      return a;
                  } else if ((b.imag == 0) && (a.real >= 0)) {
                      z.real = powl(a.real, b.real);
                      z.imag = 0;
                      return z;
                  } else if (a.real > 0) {
                      r = a.real;
                      theta = 0;
                  } else {
                      r = -a.real;
                      theta = atan2l(0.0, -1.0);
                  }
              } else {
                  r = __Pyx_c_abs_long__double(a);
                  theta = atan2l(a.imag, a.real);
              }
              lnr = logl(r);
              z_r = expl(lnr * b.real - theta * b.imag);
              z_theta = theta * b.real + lnr * b.imag;
              z.real = z_r * cosl(z_theta);
              z.imag = z_r * sinl(z_theta);
              return z;
          }
      #endif
  #endif
  
/* MemviewRefcount */
  #include <stdio.h>
  #ifndef _Py_NO_RETURN
  #define _Py_NO_RETURN
  #endif
  _Py_NO_RETURN
  static void __pyx_fatalerror(const char *fmt, ...) {
      va_list vargs;
      char msg[200];
  #if PY_VERSION_HEX >= 0x030A0000 || defined(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_type *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_type *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)
  {
      __pyx_nonatomic_int_type old_acquisition_count;
      struct __pyx_memoryview_obj *memview = memslice->memview;
      if (unlikely(!memview || (PyObject *) memview == Py_None)) {
          return;
      }
      old_acquisition_count = __pyx_add_acquisition_count(memview);
      if (unlikely(old_acquisition_count <= 0)) {
          if (likely(old_acquisition_count == 0)) {
              if (have_gil) {
                  Py_INCREF((PyObject *) memview);
              } else {
                  PyGILState_STATE _gilstate = PyGILState_Ensure();
                  Py_INCREF((PyObject *) memview);
                  PyGILState_Release(_gilstate);
              }
          } else {
              __pyx_fatalerror("Acquisition count is %d (line %d)",
                               old_acquisition_count+1, lineno);
          }
      }
  }
  static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice,
                                               int have_gil, int lineno) {
      __pyx_nonatomic_int_type old_acquisition_count;
      struct __pyx_memoryview_obj *memview = memslice->memview;
      if (unlikely(!memview || (PyObject *) memview == Py_None)) {
          memslice->memview = NULL;
          return;
      }
      old_acquisition_count = __pyx_sub_acquisition_count(memview);
      memslice->data = NULL;
      if (likely(old_acquisition_count > 1)) {
          memslice->memview = NULL;
      } else if (likely(old_acquisition_count == 1)) {
          if (have_gil) {
              Py_CLEAR(memslice->memview);
          } else {
              PyGILState_STATE _gilstate = PyGILState_Ensure();
              Py_CLEAR(memslice->memview);
              PyGILState_Release(_gilstate);
          }
      } else {
          __pyx_fatalerror("Acquisition count is %d (line %d)",
                           old_acquisition_count-1, lineno);
      }
  }
  
/* 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);
  }
  
/* 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 (unlikely(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((PyObject*)memview);
      }
      retval = 0;
      goto no_fail;
  fail:
      memviewslice->memview = 0;
      memviewslice->data = 0;
      retval = -1;
  no_fail:
      __Pyx_RefNannyFinishContext();
      return retval;
  }
  
/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int neg_one = (int) -1, const_zero = (int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          int val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (int) -1;
          val = __Pyx_PyLong_As_int(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  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 && PY_VERSION_HEX < 0x030C00A7
          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))
          } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  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))
          } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          int val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (int) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (int) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (int) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (int) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((int) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((int) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (int) -1;
          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 long __Pyx_PyLong_As_long(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const long neg_one = (long) -1, const_zero = (long) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          long val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (long) -1;
          val = __Pyx_PyLong_As_long(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  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 && PY_VERSION_HEX < 0x030C00A7
          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))
          } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  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))
          } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          long val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (long) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (long) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (long) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (long) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((long) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((long) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (long) -1;
          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;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const long neg_one = (long) -1, const_zero = (long) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(long) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(long) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } 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 PyLong_FromLong((long) value);
          } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(long),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE int64_t __Pyx_PyLong_As_int64_t(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          int64_t val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (int64_t) -1;
          val = __Pyx_PyLong_As_int64_t(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) >= 2 * PyLong_SHIFT)) {
                              return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) >= 3 * PyLong_SHIFT)) {
                              return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) >= 4 * PyLong_SHIFT)) {
                              return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          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 (int64_t) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(int64_t) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                              return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                              return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                              return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                              return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                              return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                              return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(int64_t) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
          } else if ((sizeof(int64_t) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          int64_t val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (int64_t) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (int64_t) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (int64_t) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (int64_t) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(int64_t) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((int64_t) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(int64_t) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((int64_t) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((int64_t) 1) << (sizeof(int64_t) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (int64_t) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to int64_t");
      return (int64_t) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to int64_t");
      return (int64_t) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int64_t(int64_t value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(int64_t) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(int64_t) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int64_t));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_npy_intp(npy_intp value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const npy_intp neg_one = (npy_intp) -1, const_zero = (npy_intp) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(npy_intp) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(npy_intp) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } else if (sizeof(npy_intp) <= sizeof(unsigned PY_LONG_LONG)) {
              return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  #endif
          }
      } else {
          if (sizeof(npy_intp) <= sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(npy_intp) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(npy_intp),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(npy_intp));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* CIntFromPy */
  static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          unsigned int val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (unsigned int) -1;
          val = __Pyx_PyLong_As_unsigned_int(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  case 2:
                      if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) {
                              return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) {
                              return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) >= 4 * PyLong_SHIFT)) {
                              return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                          }
                      }
                      break;
              }
          }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
          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 (unsigned int) -1;
              if (unlikely(result == 1))
                  goto raise_neg_overflow;
          }
  #endif
          if ((sizeof(unsigned int) <= sizeof(unsigned long))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
          } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  case -2:
                      if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 2:
                      if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case -3:
                      if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 3:
                      if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                          } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case -4:
                      if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                              return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
                  case 4:
                      if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) {
                          if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                              __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT)) {
                              return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                          }
                      }
                      break;
              }
          }
  #endif
          if ((sizeof(unsigned int) <= sizeof(long))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
          } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          unsigned int val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (unsigned int) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (unsigned int) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (unsigned int) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (unsigned int) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((unsigned int) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((unsigned int) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (unsigned int) -1;
          return val;
      }
  raise_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "value too large to convert to unsigned int");
      return (unsigned int) -1;
  raise_neg_overflow:
      PyErr_SetString(PyExc_OverflowError,
          "can't convert negative value to unsigned int");
      return (unsigned int) -1;
  }
  
/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const int neg_one = (int) -1, const_zero = (int) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (is_unsigned) {
          if (sizeof(int) < sizeof(long)) {
              return PyLong_FromLong((long) value);
          } else if (sizeof(int) <= sizeof(unsigned long)) {
              return PyLong_FromUnsignedLong((unsigned long) value);
  #if !CYTHON_COMPILING_IN_PYPY
          } 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 PyLong_FromLong((long) value);
          } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
              return PyLong_FromLongLong((PY_LONG_LONG) value);
          }
      }
      {
          unsigned char *bytes = (unsigned char *)&value;
  #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
          if (is_unsigned) {
              return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
          } else {
              return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
          }
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
          int one = 1; int little = (int)*(unsigned char *)&one;
          return _PyLong_FromByteArray(bytes, sizeof(int),
                                       little, !is_unsigned);
  #else
          int one = 1; int little = (int)*(unsigned char *)&one;
          PyObject *from_bytes, *result = NULL, *kwds = NULL;
          PyObject *py_bytes = NULL, *order_str = NULL;
          from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
          if (!from_bytes) return NULL;
          py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
          if (!py_bytes) goto limited_bad;
          order_str = PyUnicode_FromString(little ? "little" : "big");
          if (!order_str) goto limited_bad;
          {
              PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
              if (!is_unsigned) {
                  kwds = __Pyx_MakeVectorcallBuilderKwds(1);
                  if (!kwds) goto limited_bad;
                  if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
              }
              result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
          }
          limited_bad:
          Py_XDECREF(kwds);
          Py_XDECREF(order_str);
          Py_XDECREF(py_bytes);
          Py_XDECREF(from_bytes);
          return result;
  #endif
      }
  }
  
/* TypeInfoToFormat */
  static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(const __Pyx_TypeInfo *type) {
      struct __pyx_typeinfo_string result = { {0} };
      char *buf = (char *) result.string;
      size_t size = type->size;
      switch (type->typegroup) {
          case 'H':
              *buf = 'c';
              break;
          case 'I':
          case 'U':
              if (size == 1)
                  *buf = (type->is_unsigned) ? 'B' : 'b';
              else if (size == 2)
                  *buf = (type->is_unsigned) ? 'H' : 'h';
              else if (size == 4)
                  *buf = (type->is_unsigned) ? 'I' : 'i';
              else if (size == 8)
                  *buf = (type->is_unsigned) ? 'Q' : 'q';
              break;
          case 'P':
              *buf = 'P';
              break;
          case 'C':
           {
              __Pyx_TypeInfo complex_type = *type;
              complex_type.typegroup = 'R';
              complex_type.size /= 2;
              *buf++ = 'Z';
              *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
              break;
           }
          case 'R':
              if (size == 4)
                  *buf = 'f';
              else if (size == 8)
                  *buf = 'd';
              else
                  *buf = 'g';
              break;
      }
      return result;
  }
  
/* MemviewSliceCopy */
  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 = __Pyx_MEMSLICE_INIT;
      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 (unlikely(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 = PyLong_FromSsize_t(from_mvs->shape[i]);
          if(unlikely(!temp_int)) {
              goto fail;
          } else {
  #if CYTHON_ASSUME_SAFE_MACROS
              PyTuple_SET_ITEM(shape_tuple, i, temp_int);
  #else
              if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) {
                  goto fail;
              }
  #endif
              temp_int = NULL;
          }
      }
      array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, 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((PyObject *) new_mvs.memview);
      new_mvs.memview = NULL;
      new_mvs.data = NULL;
  no_fail:
      __Pyx_XDECREF(shape_tuple);
      __Pyx_XDECREF(temp_int);
      __Pyx_XDECREF((PyObject *) array_obj);
      __Pyx_RefNannyFinishContext();
      return new_mvs;
  }
  
/* UpdateUnpickledDict */
  static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
      PyObject *state_dict = __Pyx_PySequence_ITEM(state, index);
      if (unlikely(!state_dict)) {
          return -1;
      }
      int non_empty = PyObject_IsTrue(state_dict);
      if (non_empty == 0) {
          Py_DECREF(state_dict);
          return 0;
      } else if (unlikely(non_empty == -1)) {
          return -1;
      }
      PyObject *dict;
      #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
      dict = PyObject_GetAttrString(obj, "__dict__");
      #else
      dict = PyObject_GenericGetDict(obj, NULL);
      #endif
      if (unlikely(!dict)) {
          Py_DECREF(state_dict);
          return -1;
      }
      int result;
      if (likely(PyDict_CheckExact(dict))) {
          result = PyDict_Update(dict, state_dict);
      } else {
          PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict);
          if (likely(obj_result)) {
              Py_DECREF(obj_result);
              result = 0;
          } else {
              result = -1;
          }
      }
      Py_DECREF(state_dict);
      Py_DECREF(dict);
      return result;
  }
  static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) {
      Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely(state_size == -1)) return -1;
      #endif
      if (state_size <= index) {
          return 0;
      }
      return __Pyx__UpdateUnpickledDict(obj, state, index);
  }
  
/* CIntFromPy */
  static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) {
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wconversion"
  #endif
      const char neg_one = (char) -1, const_zero = (char) 0;
  #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  #pragma GCC diagnostic pop
  #endif
      const int is_unsigned = neg_one > const_zero;
      if (unlikely(!PyLong_Check(x))) {
          char val;
          PyObject *tmp = __Pyx_PyNumber_Long(x);
          if (!tmp) return (char) -1;
          val = __Pyx_PyLong_As_char(tmp);
          Py_DECREF(tmp);
          return val;
      }
      if (is_unsigned) {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (unlikely(__Pyx_PyLong_IsNeg(x))) {
              goto raise_neg_overflow;
          } else if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_DigitCount(x)) {
                  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 && PY_VERSION_HEX < 0x030C00A7
          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))
          } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
          }
      } else {
  #if CYTHON_USE_PYLONG_INTERNALS
          if (__Pyx_PyLong_IsCompact(x)) {
              __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
          } else {
              const digit* digits = __Pyx_PyLong_Digits(x);
              assert(__Pyx_PyLong_DigitCount(x) > 1);
              switch (__Pyx_PyLong_SignedDigitCount(x)) {
                  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))
          } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) {
              __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
          }
      }
      {
          char val;
          int ret = -1;
  #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
          Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
              x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
          if (unlikely(bytes_copied == -1)) {
          } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
              goto raise_overflow;
          } else {
              ret = 0;
          }
  #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
          int one = 1; int is_little = (int)*(unsigned char *)&one;
          unsigned char *bytes = (unsigned char *)&val;
          ret = _PyLong_AsByteArray((PyLongObject *)x,
                                      bytes, sizeof(val),
                                      is_little, !is_unsigned);
  #else
          PyObject *v;
          PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
          int bits, remaining_bits, is_negative = 0;
          int chunk_size = (sizeof(long) < 8) ? 30 : 62;
          if (likely(PyLong_CheckExact(x))) {
              v = __Pyx_NewRef(x);
          } else {
              v = PyNumber_Long(x);
              if (unlikely(!v)) return (char) -1;
              assert(PyLong_CheckExact(v));
          }
          {
              int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
              if (unlikely(result < 0)) {
                  Py_DECREF(v);
                  return (char) -1;
              }
              is_negative = result == 1;
          }
          if (is_unsigned && unlikely(is_negative)) {
              Py_DECREF(v);
              goto raise_neg_overflow;
          } else if (is_negative) {
              stepval = PyNumber_Invert(v);
              Py_DECREF(v);
              if (unlikely(!stepval))
                  return (char) -1;
          } else {
              stepval = v;
          }
          v = NULL;
          val = (char) 0;
          mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
          shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
          for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) {
              PyObject *tmp, *digit;
              long idigit;
              digit = PyNumber_And(stepval, mask);
              if (unlikely(!digit)) goto done;
              idigit = PyLong_AsLong(digit);
              Py_DECREF(digit);
              if (unlikely(idigit < 0)) goto done;
              val |= ((char) idigit) << bits;
              tmp = PyNumber_Rshift(stepval, shift);
              if (unlikely(!tmp)) goto done;
              Py_DECREF(stepval); stepval = tmp;
          }
          Py_DECREF(shift); shift = NULL;
          Py_DECREF(mask); mask = NULL;
          {
              long idigit = PyLong_AsLong(stepval);
              if (unlikely(idigit < 0)) goto done;
              remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1);
              if (unlikely(idigit >= (1L << remaining_bits)))
                  goto raise_overflow;
              val |= ((char) idigit) << bits;
          }
          if (!is_unsigned) {
              if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1))))
                  goto raise_overflow;
              if (is_negative)
                  val = ~val;
          }
          ret = 0;
      done:
          Py_XDECREF(shift);
          Py_XDECREF(mask);
          Py_XDECREF(stepval);
  #endif
          if (unlikely(ret))
              return (char) -1;
          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;
  }
  
/* FormatTypeName */
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  static __Pyx_TypeName
  __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  {
      PyObject *module = NULL, *name = NULL, *result = NULL;
      #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
      name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_qualname);
      #else
      name = PyType_GetQualName(tp);
      #endif
      if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
      module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
                                                 __pyx_mstate_global->__pyx_n_u_module);
      if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
      if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
          result = name;
          name = NULL;
          goto done;
      }
      result = PyUnicode_FromFormat("%U.%U", module, name);
      if (unlikely(result == NULL)) goto bad;
    done:
      Py_XDECREF(name);
      Py_XDECREF(module);
      return result;
    bad:
      PyErr_Clear();
      if (name) {
          result = name;
          name = NULL;
      } else {
          result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__23);
      }
      goto done;
  }
  #endif
  
/* GetRuntimeVersion */
  #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  void __Pyx_init_runtime_version(void) {
      if (__Pyx_cached_runtime_version == 0) {
          const char* rt_version = Py_GetVersion();
          unsigned long version = 0;
          unsigned long factor = 0x01000000UL;
          unsigned int digit = 0;
          int i = 0;
          while (factor) {
              while ('0' <= rt_version[i] && rt_version[i] <= '9') {
                  digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
                  ++i;
              }
              version += factor * digit;
              if (rt_version[i] != '.')
                  break;
              digit = 0;
              factor >>= 8;
              ++i;
          }
          __Pyx_cached_runtime_version = version;
      }
  }
  #endif
  static unsigned long __Pyx_get_runtime_version(void) {
  #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
      return Py_Version & ~0xFFUL;
  #else
      return __Pyx_cached_runtime_version;
  #endif
  }
  
/* IterNextPlain (used by CoroutineBase) */
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
      if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
          __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
      return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
  }
  #endif
  static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
  #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
      PyObject *result;
      PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
      if (unlikely(!next)) return NULL;
      result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
      return result;
  #else
      (void)__Pyx_GetBuiltinName; // only for early limited API
      iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
      assert(iternext);
      return iternext(iterator);
  #endif
  }
  
/* ReturnWithStopIteration (used by CoroutineBase) */
  static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
  static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
      if (value == Py_None) {
          if (async || !iternext)
              PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
          return;
      }
      __Pyx__ReturnWithStopIteration(value, async);
  }
  static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
  #if CYTHON_COMPILING_IN_CPYTHON
      __Pyx_PyThreadState_declare
  #endif
      PyObject *exc;
      PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
  #if CYTHON_COMPILING_IN_CPYTHON
      if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
          if (PY_VERSION_HEX >= (0x030e00A1)) {
              exc = __Pyx_PyObject_CallOneArg(exc_type, value);
          } else {
              PyObject *args_tuple = PyTuple_New(1);
              if (unlikely(!args_tuple)) return;
              Py_INCREF(value);
              PyTuple_SET_ITEM(args_tuple, 0, value);
              exc = PyObject_Call(exc_type, args_tuple, NULL);
              Py_DECREF(args_tuple);
          }
          if (unlikely(!exc)) return;
      } else {
          Py_INCREF(value);
          exc = value;
      }
      #if CYTHON_FAST_THREAD_STATE
      __Pyx_PyThreadState_assign
      #if CYTHON_USE_EXC_INFO_STACK
      if (!__pyx_tstate->exc_info->exc_value)
      #else
      if (!__pyx_tstate->exc_type)
      #endif
      {
          Py_INCREF(exc_type);
          __Pyx_ErrRestore(exc_type, exc, NULL);
          return;
      }
      #endif
  #else
      exc = __Pyx_PyObject_CallOneArg(exc_type, value);
      if (unlikely(!exc)) return;
  #endif
      PyErr_SetObject(exc_type, exc);
      Py_DECREF(exc);
  }
  
/* CoroutineBase (used by Generator) */
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #include <frameobject.h>
  #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
    #ifndef Py_BUILD_CORE
      #define Py_BUILD_CORE 1
    #endif
    #include "internal/pycore_frame.h"
  #endif
  #endif // CYTHON_COMPILING_IN_LIMITED_API
  static CYTHON_INLINE void
  __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
  #if CYTHON_USE_AM_SEND
      gen->yieldfrom_am_send = NULL;
  #endif
      Py_CLEAR(gen->yieldfrom);
  }
  static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
      PyObject *et, *ev, *tb;
      PyObject *value = NULL;
      CYTHON_UNUSED_VAR(__pyx_tstate);
      __Pyx_ErrFetch(&et, &ev, &tb);
      if (!et) {
          Py_XDECREF(tb);
          Py_XDECREF(ev);
          Py_INCREF(Py_None);
          *pvalue = Py_None;
          return 0;
      }
      if (likely(et == PyExc_StopIteration)) {
          if (!ev) {
              Py_INCREF(Py_None);
              value = Py_None;
          }
          else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
              #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
              value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
              if (unlikely(!value)) goto limited_api_failure;
              #else
              value = ((PyStopIterationObject *)ev)->value;
              Py_INCREF(value);
              #endif
              Py_DECREF(ev);
          }
          else if (unlikely(PyTuple_Check(ev))) {
              Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely(tuple_size < 0)) {
                  Py_XDECREF(tb);
                  Py_DECREF(ev);
                  Py_DECREF(et);
                  return -1;
              }
              #endif
              if (tuple_size >= 1) {
  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  value = PyTuple_GET_ITEM(ev, 0);
                  Py_INCREF(value);
  #elif CYTHON_ASSUME_SAFE_MACROS
                  value = PySequence_ITEM(ev, 0);
  #else
                  value = PySequence_GetItem(ev, 0);
                  if (!value) goto limited_api_failure;
  #endif
              } else {
                  Py_INCREF(Py_None);
                  value = Py_None;
              }
              Py_DECREF(ev);
          }
          else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
              value = ev;
          }
          if (likely(value)) {
              Py_XDECREF(tb);
              Py_DECREF(et);
              *pvalue = value;
              return 0;
          }
      } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
          __Pyx_ErrRestore(et, ev, tb);
          return -1;
      }
      PyErr_NormalizeException(&et, &ev, &tb);
      if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
          __Pyx_ErrRestore(et, ev, tb);
          return -1;
      }
      Py_XDECREF(tb);
      Py_DECREF(et);
  #if CYTHON_COMPILING_IN_LIMITED_API
      value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  #else
      value = ((PyStopIterationObject *)ev)->value;
      Py_INCREF(value);
  #endif
      Py_DECREF(ev);
  #if CYTHON_COMPILING_IN_LIMITED_API
      if (unlikely(!value)) return -1;
  #endif
      *pvalue = value;
      return 0;
  #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
    limited_api_failure:
      Py_XDECREF(et);
      Py_XDECREF(tb);
      Py_XDECREF(ev);
      return -1;
  #endif
  }
  static CYTHON_INLINE
  __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
      if (*retval) {
          return PYGEN_NEXT;
      } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
          return PYGEN_RETURN;
      } else {
          return PYGEN_ERROR;
      }
  }
  static CYTHON_INLINE
  void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  #if PY_VERSION_HEX >= 0x030B00a4
      Py_CLEAR(exc_state->exc_value);
  #else
      PyObject *t, *v, *tb;
      t = exc_state->exc_type;
      v = exc_state->exc_value;
      tb = exc_state->exc_traceback;
      exc_state->exc_type = NULL;
      exc_state->exc_value = NULL;
      exc_state->exc_traceback = NULL;
      Py_XDECREF(t);
      Py_XDECREF(v);
      Py_XDECREF(tb);
  #endif
  }
  #define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
      const char *msg;
      CYTHON_MAYBE_UNUSED_VAR(gen);
      if ((0)) {
      #ifdef __Pyx_Coroutine_USED
      } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
          msg = "coroutine already executing";
      #endif
      #ifdef __Pyx_AsyncGen_USED
      } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
          msg = "async generator already executing";
      #endif
      } else {
          msg = "generator already executing";
      }
      PyErr_SetString(PyExc_ValueError, msg);
  }
  static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
      CYTHON_MAYBE_UNUSED_VAR(gen);
      CYTHON_MAYBE_UNUSED_VAR(closing);
      #ifdef __Pyx_Coroutine_USED
      if (!closing && __Pyx_Coroutine_Check(gen)) {
          PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
      } else
      #endif
      if (value) {
          #ifdef __Pyx_AsyncGen_USED
          if (__Pyx_AsyncGen_CheckExact(gen))
              PyErr_SetNone(PyExc_StopAsyncIteration);
          else
          #endif
          PyErr_SetNone(PyExc_StopIteration);
      }
  }
  static
  __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
      __Pyx_PyThreadState_declare
      PyThreadState *tstate;
      __Pyx_ExcInfoStruct *exc_state;
      PyObject *retval;
      assert(__Pyx_Coroutine_get_is_running(self));  // Callers should ensure is_running
      if (unlikely(self->resume_label == -1)) {
          __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
          return PYGEN_ERROR;
      }
  #if CYTHON_FAST_THREAD_STATE
      __Pyx_PyThreadState_assign
      tstate = __pyx_tstate;
  #else
      tstate = __Pyx_PyThreadState_Current;
  #endif
      exc_state = &self->gi_exc_state;
      if (exc_state->exc_value) {
          #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
          #else
          PyObject *exc_tb;
          #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
          exc_tb = PyException_GetTraceback(exc_state->exc_value);
          #elif PY_VERSION_HEX >= 0x030B00a4
          exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
          #else
          exc_tb = exc_state->exc_traceback;
          #endif
          if (exc_tb) {
              PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
              PyFrameObject *f = tb->tb_frame;
              assert(f->f_back == NULL);
              #if PY_VERSION_HEX >= 0x030B00A1
              f->f_back = PyThreadState_GetFrame(tstate);
              #else
              Py_XINCREF(tstate->frame);
              f->f_back = tstate->frame;
              #endif
              #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
              Py_DECREF(exc_tb);
              #endif
          }
          #endif
      }
  #if CYTHON_USE_EXC_INFO_STACK
      exc_state->previous_item = tstate->exc_info;
      tstate->exc_info = exc_state;
  #else
      if (exc_state->exc_type) {
          __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
      } else {
          __Pyx_Coroutine_ExceptionClear(exc_state);
          __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
      }
  #endif
      retval = self->body(self, tstate, value);
  #if CYTHON_USE_EXC_INFO_STACK
      exc_state = &self->gi_exc_state;
      tstate->exc_info = exc_state->previous_item;
      exc_state->previous_item = NULL;
      __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  #endif
      *result = retval;
      if (self->resume_label == -1) {
          return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
      }
      return PYGEN_NEXT;
  }
  static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
      CYTHON_UNUSED_VAR(exc_state);
  #else
      PyObject *exc_tb;
      #if PY_VERSION_HEX >= 0x030B00a4
      if (!exc_state->exc_value) return;
      exc_tb = PyException_GetTraceback(exc_state->exc_value);
      #else
      exc_tb = exc_state->exc_traceback;
      #endif
      if (likely(exc_tb)) {
          PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
          PyFrameObject *f = tb->tb_frame;
          Py_CLEAR(f->f_back);
          #if PY_VERSION_HEX >= 0x030B00a4
          Py_DECREF(exc_tb);
          #endif
      }
  #endif
  }
  #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
      ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
  static PyObject *
  __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
      CYTHON_MAYBE_UNUSED_VAR(gen);
      if (likely(result == PYGEN_RETURN)) {
          int is_async = 0;
          #ifdef __Pyx_AsyncGen_USED
          is_async = __Pyx_AsyncGen_CheckExact(gen);
          #endif
          __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
          Py_XDECREF(retval);
      }
      return NULL;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  static CYTHON_INLINE
  PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  #if PY_VERSION_HEX <= 0x030A00A1
      return _PyGen_Send(gen, arg);
  #else
      PyObject *result;
      if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
          if (PyAsyncGen_CheckExact(gen)) {
              assert(result == Py_None);
              PyErr_SetNone(PyExc_StopAsyncIteration);
          }
          else if (result == Py_None) {
              PyErr_SetNone(PyExc_StopIteration);
          }
          else {
  #if PY_VERSION_HEX < 0x030d00A1
              _PyGen_SetStopIterationValue(result);
  #else
              if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
                  PyErr_SetObject(PyExc_StopIteration, result);
              } else {
                  PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
                  if (likely(exc != NULL)) {
                      PyErr_SetObject(PyExc_StopIteration, exc);
                      Py_DECREF(exc);
                  }
              }
  #endif
          }
          Py_DECREF(result);
          result = NULL;
      }
      return result;
  #endif
  }
  #endif
  static CYTHON_INLINE __Pyx_PySendResult
  __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
      __Pyx_PySendResult result;
      PyObject *val = NULL;
      assert(__Pyx_Coroutine_get_is_running(gen));
      __Pyx_Coroutine_Undelegate(gen);
      __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
      result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
      Py_XDECREF(val);
      return result;
  }
  #if CYTHON_USE_AM_SEND
  static __Pyx_PySendResult
  __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
      PyObject *ret = NULL;
      __Pyx_PySendResult delegate_result, result;
      assert(__Pyx_Coroutine_get_is_running(gen));
      delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
      if (delegate_result == PYGEN_NEXT) {
          assert (ret != NULL);
          *retval = ret;
          return PYGEN_NEXT;
      }
      assert (delegate_result != PYGEN_ERROR || ret == NULL);
      __Pyx_Coroutine_Undelegate(gen);
      result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
      Py_XDECREF(ret);
      return result;
  }
  #endif
  static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
      PyObject *retval = NULL;
      __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
      return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  }
  static __Pyx_PySendResult
  __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
      __Pyx_PySendResult result;
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
      if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
          *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
          return PYGEN_ERROR;
      }
      #if CYTHON_USE_AM_SEND
      if (gen->yieldfrom_am_send) {
          result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
      } else
      #endif
      if (gen->yieldfrom) {
          PyObject *yf = gen->yieldfrom;
          PyObject *ret;
        #if !CYTHON_USE_AM_SEND
          #ifdef __Pyx_Generator_USED
          if (__Pyx_Generator_CheckExact(yf)) {
              ret = __Pyx_Coroutine_Send(yf, value);
          } else
          #endif
          #ifdef __Pyx_Coroutine_USED
          if (__Pyx_Coroutine_Check(yf)) {
              ret = __Pyx_Coroutine_Send(yf, value);
          } else
          #endif
          #ifdef __Pyx_AsyncGen_USED
          if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
              ret = __Pyx_async_gen_asend_send(yf, value);
          } else
          #endif
          #if CYTHON_COMPILING_IN_CPYTHON
          if (PyGen_CheckExact(yf)) {
              ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
          } else
          if (PyCoro_CheckExact(yf)) {
              ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
          } else
          #endif
        #endif
          {
              #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
              if (value == Py_None && PyIter_Check(yf))
                  ret = __Pyx_PyIter_Next_Plain(yf);
              else
              #endif
                  ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
          }
          if (likely(ret)) {
              __Pyx_Coroutine_unset_is_running(gen);
              *retval = ret;
              return PYGEN_NEXT;
          }
          result = __Pyx_Coroutine_FinishDelegation(gen, retval);
      } else {
          result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
      }
      __Pyx_Coroutine_unset_is_running(gen);
      return result;
  }
  static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
      __Pyx_PySendResult result;
      PyObject *retval = NULL;
      CYTHON_UNUSED_VAR(gen);
      assert(__Pyx_Coroutine_get_is_running(gen));
      #ifdef __Pyx_Generator_USED
      if (__Pyx_Generator_CheckExact(yf)) {
          result = __Pyx_Coroutine_Close(yf, &retval);
      } else
      #endif
      #ifdef __Pyx_Coroutine_USED
      if (__Pyx_Coroutine_Check(yf)) {
          result = __Pyx_Coroutine_Close(yf, &retval);
      } else
      if (__Pyx_CoroutineAwait_CheckExact(yf)) {
          result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
      } else
      #endif
      #ifdef __Pyx_AsyncGen_USED
      if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
          retval = __Pyx_async_gen_asend_close(yf, NULL);
          result = PYGEN_RETURN;
      } else
      if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
          retval = __Pyx_async_gen_athrow_close(yf, NULL);
          result = PYGEN_RETURN;
      } else
      #endif
      {
          PyObject *meth;
          result = PYGEN_RETURN;
          meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
          if (unlikely(!meth)) {
              if (unlikely(PyErr_Occurred())) {
                  PyErr_WriteUnraisable(yf);
              }
          } else {
              retval = __Pyx_PyObject_CallNoArg(meth);
              Py_DECREF(meth);
              if (unlikely(!retval)) {
                  result = PYGEN_ERROR;
              }
          }
      }
      Py_XDECREF(retval);
      return result == PYGEN_ERROR ? -1 : 0;
  }
  static PyObject *__Pyx_Generator_Next(PyObject *self) {
      __Pyx_PySendResult result;
      PyObject *retval = NULL;
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
      if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
          return __Pyx_Coroutine_AlreadyRunningError(gen);
      }
      #if CYTHON_USE_AM_SEND
      if (gen->yieldfrom_am_send) {
          result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
      } else
      #endif
      if (gen->yieldfrom) {
          PyObject *yf = gen->yieldfrom;
          PyObject *ret;
          #ifdef __Pyx_Generator_USED
          if (__Pyx_Generator_CheckExact(yf)) {
              ret = __Pyx_Generator_Next(yf);
          } else
          #endif
          #ifdef __Pyx_Coroutine_USED
          if (__Pyx_Coroutine_CheckExact(yf)) {
              ret = __Pyx_Coroutine_Send(yf, Py_None);
          } else
          #endif
          #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
          if (PyGen_CheckExact(yf)) {
              ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
          } else
          #endif
              ret = __Pyx_PyIter_Next_Plain(yf);
          if (likely(ret)) {
              __Pyx_Coroutine_unset_is_running(gen);
              return ret;
          }
          result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
      } else {
          result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
      }
      __Pyx_Coroutine_unset_is_running(gen);
      return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
  }
  static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
      PyObject *retval = NULL;
      __Pyx_PySendResult result;
      CYTHON_UNUSED_VAR(arg);
      result = __Pyx_Coroutine_Close(self, &retval);
      if (unlikely(result == PYGEN_ERROR))
          return NULL;
      Py_XDECREF(retval);
      Py_RETURN_NONE;
  }
  static __Pyx_PySendResult
  __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
      __Pyx_PySendResult result;
      PyObject *yf;
      int err = 0;
      if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
          *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
          return PYGEN_ERROR;
      }
      yf = gen->yieldfrom;
      if (yf) {
          Py_INCREF(yf);
          err = __Pyx_Coroutine_CloseIter(gen, yf);
          __Pyx_Coroutine_Undelegate(gen);
          Py_DECREF(yf);
      }
      if (err == 0)
          PyErr_SetNone(PyExc_GeneratorExit);
      result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
      if (result == PYGEN_ERROR) {
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __Pyx_Coroutine_unset_is_running(gen);
          if (!__Pyx_PyErr_Occurred()) {
              return PYGEN_RETURN;
          } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
              __Pyx_PyErr_Clear();
              return PYGEN_RETURN;
          }
          return PYGEN_ERROR;
      } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
          __Pyx_Coroutine_unset_is_running(gen);
          return PYGEN_RETURN;
      } else {
          const char *msg;
          Py_DECREF(*retval);
          *retval = NULL;
          if ((0)) {
          #ifdef __Pyx_Coroutine_USED
          } else if (__Pyx_Coroutine_Check(self)) {
              msg = "coroutine ignored GeneratorExit";
          #endif
          #ifdef __Pyx_AsyncGen_USED
          } else if (__Pyx_AsyncGen_CheckExact(self)) {
              msg = "async generator ignored GeneratorExit";
          #endif
          } else {
              msg = "generator ignored GeneratorExit";
          }
          PyErr_SetString(PyExc_RuntimeError, msg);
          __Pyx_Coroutine_unset_is_running(gen);
          return PYGEN_ERROR;
      }
  }
  static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                          PyObject *args, int close_on_genexit) {
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
      PyObject *yf;
      if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
          return __Pyx_Coroutine_AlreadyRunningError(gen);
      yf = gen->yieldfrom;
      if (yf) {
          __Pyx_PySendResult result;
          PyObject *ret;
          Py_INCREF(yf);
          if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
              int err = __Pyx_Coroutine_CloseIter(gen, yf);
              Py_DECREF(yf);
              __Pyx_Coroutine_Undelegate(gen);
              if (err < 0)
                  goto propagate_exception;
              goto throw_here;
          }
          if (0
          #ifdef __Pyx_Generator_USED
              || __Pyx_Generator_CheckExact(yf)
          #endif
          #ifdef __Pyx_Coroutine_USED
              || __Pyx_Coroutine_Check(yf)
          #endif
              ) {
              ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
          #ifdef __Pyx_Coroutine_USED
          } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
              ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
          #endif
          } else {
              PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
              if (unlikely(!meth)) {
                  Py_DECREF(yf);
                  if (unlikely(PyErr_Occurred())) {
                      __Pyx_Coroutine_unset_is_running(gen);
                      return NULL;
                  }
                  __Pyx_Coroutine_Undelegate(gen);
                  goto throw_here;
              }
              if (likely(args)) {
                  ret = __Pyx_PyObject_Call(meth, args, NULL);
              } else {
                  PyObject *cargs[4] = {NULL, typ, val, tb};
                  ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
              }
              Py_DECREF(meth);
          }
          Py_DECREF(yf);
          if (ret) {
              __Pyx_Coroutine_unset_is_running(gen);
              return ret;
          }
          result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
          __Pyx_Coroutine_unset_is_running(gen);
          return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
      }
  throw_here:
      __Pyx_Raise(typ, val, tb, NULL);
  propagate_exception:
      {
          PyObject *retval = NULL;
          __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
          __Pyx_Coroutine_unset_is_running(gen);
          return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
      }
  }
  static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
      PyObject *typ;
      PyObject *val = NULL;
      PyObject *tb = NULL;
      if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
          return NULL;
      return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  }
  static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  #if PY_VERSION_HEX >= 0x030B00a4
      Py_VISIT(exc_state->exc_value);
  #else
      Py_VISIT(exc_state->exc_type);
      Py_VISIT(exc_state->exc_value);
      Py_VISIT(exc_state->exc_traceback);
  #endif
      return 0;
  }
  static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
      {
          int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
          if (e) return e;
      }
      Py_VISIT(gen->closure);
      Py_VISIT(gen->classobj);
      Py_VISIT(gen->yieldfrom);
      return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  }
  static int __Pyx_Coroutine_clear(PyObject *self) {
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
      Py_CLEAR(gen->closure);
      Py_CLEAR(gen->classobj);
      __Pyx_Coroutine_Undelegate(gen);
      __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  #ifdef __Pyx_AsyncGen_USED
      if (__Pyx_AsyncGen_CheckExact(self)) {
          Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
      }
  #endif
      Py_CLEAR(gen->gi_code);
      Py_CLEAR(gen->gi_frame);
      Py_CLEAR(gen->gi_name);
      Py_CLEAR(gen->gi_qualname);
      Py_CLEAR(gen->gi_modulename);
      return 0;
  }
  static void __Pyx_Coroutine_dealloc(PyObject *self) {
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
      PyObject_GC_UnTrack(gen);
      #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      if (gen->gi_weakreflist != NULL)
      #endif
          PyObject_ClearWeakRefs(self);
      if (gen->resume_label >= 0) {
          PyObject_GC_Track(self);
  #if CYTHON_USE_TP_FINALIZE
          if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  #else
          {
              destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
              if (del) del(self);
          }
          if (unlikely(Py_REFCNT(self) > 0))
  #endif
          {
              return;
          }
          PyObject_GC_UnTrack(self);
      }
  #ifdef __Pyx_AsyncGen_USED
      if (__Pyx_AsyncGen_CheckExact(self)) {
          /* We have to handle this case for asynchronous generators
             right here, because this code has to be between UNTRACK
             and GC_Del. */
          Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
      }
  #endif
      __Pyx_Coroutine_clear(self);
      __Pyx_PyHeapTypeObject_GC_Del(gen);
  }
  #if CYTHON_USE_TP_FINALIZE
  static void __Pyx_Coroutine_del(PyObject *self) {
      PyObject *error_type, *error_value, *error_traceback;
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
      __Pyx_PyThreadState_declare
      if (gen->resume_label < 0) {
          return;
      }
      __Pyx_PyThreadState_assign
      __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  #ifdef __Pyx_AsyncGen_USED
      if (__Pyx_AsyncGen_CheckExact(self)) {
          __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
          PyObject *finalizer = agen->ag_finalizer;
          if (finalizer && !agen->ag_closed) {
              PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
              if (unlikely(!res)) {
                  PyErr_WriteUnraisable(self);
              } else {
                  Py_DECREF(res);
              }
              __Pyx_ErrRestore(error_type, error_value, error_traceback);
              return;
          }
      }
  #endif
      if (unlikely(gen->resume_label == 0 && !error_value)) {
  #ifdef __Pyx_Coroutine_USED
  #ifdef __Pyx_Generator_USED
      if (!__Pyx_Generator_CheckExact(self))
  #endif
          {
          PyObject_GC_UnTrack(self);
          if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
              PyErr_WriteUnraisable(self);
          PyObject_GC_Track(self);
          }
  #endif
      } else {
          PyObject *retval = NULL;
          __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
          if (result == PYGEN_ERROR) {
              PyErr_WriteUnraisable(self);
          } else {
              Py_XDECREF(retval);
          }
      }
      __Pyx_ErrRestore(error_type, error_value, error_traceback);
  }
  #endif
  static PyObject *
  __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  {
      PyObject *name = self->gi_name;
      CYTHON_UNUSED_VAR(context);
      if (unlikely(!name)) name = Py_None;
      Py_INCREF(name);
      return name;
  }
  static int
  __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      if (unlikely(value == NULL || !PyUnicode_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__name__ must be set to a string object");
          return -1;
      }
      Py_INCREF(value);
      __Pyx_Py_XDECREF_SET(self->gi_name, value);
      return 0;
  }
  static PyObject *
  __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  {
      PyObject *name = self->gi_qualname;
      CYTHON_UNUSED_VAR(context);
      if (unlikely(!name)) name = Py_None;
      Py_INCREF(name);
      return name;
  }
  static int
  __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  {
      CYTHON_UNUSED_VAR(context);
      if (unlikely(value == NULL || !PyUnicode_Check(value))) {
          PyErr_SetString(PyExc_TypeError,
                          "__qualname__ must be set to a string object");
          return -1;
      }
      Py_INCREF(value);
      __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
      return 0;
  }
  static PyObject *
  __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
  {
  #if !CYTHON_COMPILING_IN_LIMITED_API
      PyObject *frame;
      #if PY_VERSION_HEX >= 0x030d0000
      Py_BEGIN_CRITICAL_SECTION(self);
      #endif
      frame = self->gi_frame;
      if (!frame) {
          if (unlikely(!self->gi_code)) {
              Py_RETURN_NONE;
          }
          PyObject *globals = PyDict_New();
          if (unlikely(!globals)) return NULL;
          frame = (PyObject *) PyFrame_New(
              PyThreadState_Get(),            /*PyThreadState *tstate,*/
              (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
              globals,                        /*PyObject *globals,*/
              0                               /*PyObject *locals*/
          );
          Py_DECREF(globals);
          if (unlikely(!frame))
              return NULL;
          if (unlikely(self->gi_frame)) {
              Py_DECREF(frame);
              frame = self->gi_frame;
          } else {
              self->gi_frame = frame;
          }
      }
      Py_INCREF(frame);
      #if PY_VERSION_HEX >= 0x030d0000
      Py_END_CRITICAL_SECTION();
      #endif
      return frame;
  #else
      CYTHON_UNUSED_VAR(self);
      Py_RETURN_NONE;
  #endif
  }
  static PyObject *
  __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
      CYTHON_UNUSED_VAR(context);
      PyObject *frame = self->gi_frame;
      if (frame)
          return __Pyx_NewRef(frame);
      return __Pyx__Coroutine_get_frame(self);
  }
  static __pyx_CoroutineObject *__Pyx__Coroutine_New(
              PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
              PyObject *name, PyObject *qualname, PyObject *module_name) {
      __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
      if (unlikely(!gen))
          return NULL;
      return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  }
  static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
              __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
              PyObject *name, PyObject *qualname, PyObject *module_name) {
      gen->body = body;
      gen->closure = closure;
      Py_XINCREF(closure);
      gen->is_running = 0;
      gen->resume_label = 0;
      gen->classobj = NULL;
      gen->yieldfrom = NULL;
      gen->yieldfrom_am_send = NULL;
      #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
      gen->gi_exc_state.exc_value = NULL;
      #else
      gen->gi_exc_state.exc_type = NULL;
      gen->gi_exc_state.exc_value = NULL;
      gen->gi_exc_state.exc_traceback = NULL;
      #endif
  #if CYTHON_USE_EXC_INFO_STACK
      gen->gi_exc_state.previous_item = NULL;
  #endif
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      gen->gi_weakreflist = NULL;
  #endif
      Py_XINCREF(qualname);
      gen->gi_qualname = qualname;
      Py_XINCREF(name);
      gen->gi_name = name;
      Py_XINCREF(module_name);
      gen->gi_modulename = module_name;
      Py_XINCREF(code);
      gen->gi_code = code;
      gen->gi_frame = NULL;
      PyObject_GC_Track(gen);
      return gen;
  }
  static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
      char result;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_BEGIN_CRITICAL_SECTION(gen);
      #endif
      result = gen->is_running;
      gen->is_running = 1;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_END_CRITICAL_SECTION();
      #endif
      return result;
  }
  static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_BEGIN_CRITICAL_SECTION(gen);
      #endif
      assert(gen->is_running);
      gen->is_running = 0;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_END_CRITICAL_SECTION();
      #endif
  }
  static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
      char result;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_BEGIN_CRITICAL_SECTION(gen);
      #endif
      result = gen->is_running;
      #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_END_CRITICAL_SECTION();
      #endif
      return result;
  }
  static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
      CYTHON_UNUSED_VAR(closure);
      char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
      if (result) Py_RETURN_TRUE;
      else Py_RETURN_FALSE;
  }
  #if __PYX_HAS_PY_AM_SEND == 2
  static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
      Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
      if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
          return;
      }
      memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
      static_amsend_methods->am_send = am_send;
      type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
  }
  #endif
  static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
      CYTHON_UNUSED_VAR(arg);
      __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
      PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
                           self_type_name);
      __Pyx_DECREF_TypeName(self_type_name);
      return NULL;
  }
  
/* Generator */
  static PyMethodDef __pyx_Generator_methods[] = {
      {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
       PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
      {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
       PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
      {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
       PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
      {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
      {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
      {0, 0, 0, 0}
  };
  static PyMemberDef __pyx_Generator_memberlist[] = {
      {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
       PyDoc_STR("object being iterated by 'yield from', or None")},
      {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
      {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
      {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  #endif
      {0, 0, 0, 0, 0}
  };
  static PyGetSetDef __pyx_Generator_getsets[] = {
      {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
       PyDoc_STR("name of the generator"), 0},
      {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
       PyDoc_STR("qualified name of the generator"), 0},
      {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
       PyDoc_STR("Frame of the generator"), 0},
      {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
      {0, 0, 0, 0, 0}
  };
  static PyType_Slot __pyx_GeneratorType_slots[] = {
      {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
      {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
      {Py_tp_iter, (void *)PyObject_SelfIter},
      {Py_tp_iternext, (void *)__Pyx_Generator_Next},
      {Py_tp_methods, (void *)__pyx_Generator_methods},
      {Py_tp_members, (void *)__pyx_Generator_memberlist},
      {Py_tp_getset, (void *)__pyx_Generator_getsets},
      {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
  #if CYTHON_USE_TP_FINALIZE
      {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  #endif
  #if __PYX_HAS_PY_AM_SEND == 1
      {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
  #endif
      {0, 0},
  };
  static PyType_Spec __pyx_GeneratorType_spec = {
      __PYX_TYPE_MODULE_PREFIX "generator",
      sizeof(__pyx_CoroutineObject),
      0,
  #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
      Py_TPFLAGS_MANAGED_WEAKREF |
  #endif
      Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
      Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
      __pyx_GeneratorType_slots
  };
  #if __PYX_HAS_PY_AM_SEND == 2
  static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
  #endif
  static int __pyx_Generator_init(PyObject *module) {
      __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
      mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
          mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
      if (unlikely(!mstate->__pyx_GeneratorType)) {
          return -1;
      }
  #if __PYX_HAS_PY_AM_SEND == 2
      __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
  #endif
      return 0;
  }
  static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
      __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
      PyObject *retval = NULL;
      if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
          return __Pyx_Coroutine_AlreadyRunningError(gen);
      }
      __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
      __Pyx_Coroutine_unset_is_running(gen);
      (void) result;
      assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
      assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
      return retval;
  }
  
/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
      const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
      if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
          return 0;
      if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
          return 1;
      {
          char message[200];
          PyOS_snprintf(message, sizeof(message),
                        "compile time Python version %d.%d "
                        "of module '%.100s' "
                        "%s "
                        "runtime version %d.%d",
                         (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
                         __Pyx_MODULE_NAME,
                         (allow_newer) ? "was newer than" : "does not match",
                         (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
         );
          return PyErr_WarnEx(NULL, message, 1);
      }
  }
  
/* NewCodeObj */
  #if CYTHON_COMPILING_IN_LIMITED_API
      static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                         PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                         PyObject *fv, PyObject *cell, PyObject* fn,
                                         PyObject *name, int fline, PyObject *lnos) {
          PyObject *exception_table = NULL;
          PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
          #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
          PyObject *version_info;
          PyObject *py_minor_version = NULL;
          #endif
          long minor_version = 0;
          PyObject *type, *value, *traceback;
          PyErr_Fetch(&type, &value, &traceback);
          #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
          minor_version = 11;
          #else
          if (!(version_info = PySys_GetObject("version_info"))) goto end;
          if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
          minor_version = PyLong_AsLong(py_minor_version);
          Py_DECREF(py_minor_version);
          if (minor_version == -1 && PyErr_Occurred()) goto end;
          #endif
          if (!(types_module = PyImport_ImportModule("types"))) goto end;
          if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
          if (minor_version <= 7) {
              (void)p;
              result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
                            c, n, v, fn, name, fline, lnos, fv, cell);
          } else if (minor_version <= 10) {
              result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
                            c, n, v, fn, name, fline, lnos, fv, cell);
          } else {
              if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
              result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
                            c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
          }
      end:
          Py_XDECREF(code_type);
          Py_XDECREF(exception_table);
          Py_XDECREF(types_module);
          if (type) {
              PyErr_Restore(type, value, traceback);
          }
          return result;
      }
  #elif PY_VERSION_HEX >= 0x030B0000
    static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
                                           PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                           PyObject *fv, PyObject *cell, PyObject* fn,
                                           PyObject *name, int fline, PyObject *lnos) {
      PyCodeObject *result;
      result =
        #if PY_VERSION_HEX >= 0x030C0000
          PyUnstable_Code_NewWithPosOnlyArgs
        #else
          PyCode_NewWithPosOnlyArgs
        #endif
          (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
      #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
      if (likely(result))
          result->_co_firsttraceable = 0;
      #endif
      return result;
    }
  #elif !CYTHON_COMPILING_IN_PYPY
    #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
            PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #else
    #define __Pyx__PyCode_New(a, p, 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
  static PyObject* __Pyx_PyCode_New(
          const __Pyx_PyCode_New_function_description descr,
          PyObject * const *varnames,
          PyObject *filename,
          PyObject *funcname,
          PyObject *line_table,
          PyObject *tuple_dedup_map
  ) {
      PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
      Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
      PyObject *varnames_tuple = PyTuple_New(var_count);
      if (unlikely(!varnames_tuple)) return NULL;
      for (Py_ssize_t i=0; i < var_count; i++) {
          Py_INCREF(varnames[i]);
          if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
      }
      #if CYTHON_COMPILING_IN_LIMITED_API
      varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
      if (!varnames_tuple_dedup) {
          if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
          varnames_tuple_dedup = varnames_tuple;
      }
      #else
      varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
      if (unlikely(!varnames_tuple_dedup)) goto done;
      #endif
      #if CYTHON_AVOID_BORROWED_REFS
      Py_INCREF(varnames_tuple_dedup);
      #endif
      if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
          Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely(line_table_length == -1)) goto done;
          #endif
          Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
          code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
          if (unlikely(!code_bytes)) goto done;
          char* c_code_bytes = PyBytes_AsString(code_bytes);
          if (unlikely(!c_code_bytes)) goto done;
          memset(c_code_bytes, 0, (size_t) code_len);
      }
      code_obj = (PyObject*) __Pyx__PyCode_New(
          (int) descr.argcount,
          (int) descr.num_posonly_args,
          (int) descr.num_kwonly_args,
          (int) descr.nlocals,
          0,
          (int) descr.flags,
          code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
          __pyx_mstate_global->__pyx_empty_tuple,
          __pyx_mstate_global->__pyx_empty_tuple,
          varnames_tuple_dedup,
          __pyx_mstate_global->__pyx_empty_tuple,
          __pyx_mstate_global->__pyx_empty_tuple,
          filename,
          funcname,
          (int) descr.first_line,
          (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
      );
  done:
      Py_XDECREF(code_bytes);
      #if CYTHON_AVOID_BORROWED_REFS
      Py_XDECREF(varnames_tuple_dedup);
      #endif
      Py_DECREF(varnames_tuple);
      return code_obj;
  }
  
/* DecompressString */
  static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
      PyObject *module, *decompress, *compressed_bytes, *decompressed;
      const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
      PyObject *methodname = PyUnicode_FromString("decompress");
      if (unlikely(!methodname)) return NULL;
      #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
      if (algo == 3) {
          PyObject *fromlist = Py_BuildValue("[O]", methodname);
          if (unlikely(!fromlist)) return NULL;
          module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
          Py_DECREF(fromlist);
      } else
      #endif
          module = PyImport_ImportModule(module_name);
      if (unlikely(!module)) goto import_failed;
      decompress = PyObject_GetAttr(module, methodname);
      if (unlikely(!decompress)) goto import_failed;
      {
          #ifdef __cplusplus
              char *memview_bytes = const_cast<char*>(s);
          #else
              #if defined(__clang__)
                #pragma clang diagnostic push
                #pragma clang diagnostic ignored "-Wcast-qual"
              #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                #pragma GCC diagnostic push
                #pragma GCC diagnostic ignored "-Wcast-qual"
              #endif
              char *memview_bytes = (char*) s;
              #if defined(__clang__)
                #pragma clang diagnostic pop
              #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
                #pragma GCC diagnostic pop
              #endif
          #endif
          #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
          int memview_flags = 0x100;
          #else
          int memview_flags = PyBUF_READ;
          #endif
          compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
      }
      if (unlikely(!compressed_bytes)) {
          Py_DECREF(decompress);
          goto bad;
      }
      decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
      Py_DECREF(compressed_bytes);
      Py_DECREF(decompress);
      Py_DECREF(module);
      Py_DECREF(methodname);
      return decompressed;
  import_failed:
      PyErr_Format(PyExc_ImportError,
          "Failed to import '%.20s.decompress' - cannot initialise module strings. "
          "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
          module_name, algo);
  bad:
      Py_XDECREF(module);
      Py_DECREF(methodname);
      return NULL;
  }
  
#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
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_UTF8
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if CYTHON_COMPILING_IN_LIMITED_API
    {
        const char* result;
        Py_ssize_t unicode_length;
        CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
        if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
        #else
        result = PyUnicode_AsUTF8AndSize(o, length);
        #endif
        #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        unicode_length = PyUnicode_GetLength(o);
        if (unlikely(unicode_length < 0)) return NULL;
        if (unlikely(unicode_length != *length)) {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
        #endif
        return result;
    }
#else
#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_UTF8
    if (PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
    if (PyByteArray_Check(o)) {
#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
#else
        *length = PyByteArray_Size(o);
        if (*length == -1) return NULL;
        return PyByteArray_AsString(o);
#endif
    } else
    {
        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_LongWrongResultType(PyObject* result) {
    __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ").  "
                "The ability to return an instance of a strict subclass of int is deprecated, "
                "and may be removed in a future version of Python.",
                result_type_name)) {
            __Pyx_DECREF_TypeName(result_type_name);
            Py_DECREF(result);
            return NULL;
        }
        __Pyx_DECREF_TypeName(result_type_name);
        return result;
    }
    PyErr_Format(PyExc_TypeError,
                 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
                 result_type_name);
    __Pyx_DECREF_TypeName(result_type_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  PyObject *res = NULL;
  if (likely(PyLong_Check(x)))
      return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  if (likely(m && m->nb_int)) {
      res = m->nb_int(x);
  }
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
      res = PyNumber_Long(x);
  }
#endif
  if (likely(res)) {
      if (unlikely(!PyLong_CheckExact(res))) {
          return __Pyx_PyNumber_LongWrongResultType(res);
      }
  }
  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 (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(__Pyx_PyLong_IsCompact(b))) {
        return __Pyx_PyLong_CompactValue(b);
    } else {
      const digit* digits = __Pyx_PyLong_Digits(b);
      const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
      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 = PyLong_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyLong_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
    CYTHON_UNUSED_VAR(b);
    return __Pyx_NewRef(Py_None);
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return __Pyx_NewRef(b ? Py_True: Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
    return PyLong_FromSize_t(ival);
}


  /* MultiPhaseInitModuleState */
  #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
    #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  #else
    #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  #endif
  #endif
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  #error "Module state with PEP489 requires atomics. Currently that's one of\
   C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  #endif
  #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  #define __Pyx_ModuleStateLookup_Lock()
  #define __Pyx_ModuleStateLookup_Unlock()
  #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(__cplusplus) && __cplusplus >= 201103L
  #include <mutex>
  static std::mutex __Pyx_ModuleStateLookup_mutex;
  #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  #include <threads.h>
  static mtx_t __Pyx_ModuleStateLookup_mutex;
  static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
      mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  }
  #define __Pyx_ModuleStateLookup_Lock()\
    call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
    mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(HAVE_PTHREAD_H)
  #include <pthread.h>
  static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  #elif defined(_WIN32)
  #include <Windows.h>  // synchapi.h on its own doesn't work
  static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  #else
  #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
   Requires C standard >= C11, or C++ standard >= C++11,\
   or pthreads, or the Windows 32 API, or Python >= 3.13."
  #endif
  typedef struct {
      int64_t id;
      PyObject *module;
  } __Pyx_InterpreterIdAndModule;
  typedef struct {
      char interpreter_id_as_index;
      Py_ssize_t count;
      Py_ssize_t allocated;
      __Pyx_InterpreterIdAndModule table[1];
  } __Pyx_ModuleStateLookupData;
  #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  #endif
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  #else
  static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  #endif
  static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
          __Pyx_InterpreterIdAndModule* table,
          Py_ssize_t count,
          int64_t interpreterId) {
      __Pyx_InterpreterIdAndModule* begin = table;
      __Pyx_InterpreterIdAndModule* end = begin + count;
      if (begin->id == interpreterId) {
          return begin;
      }
      while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
          __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
          if (halfway->id == interpreterId) {
              return halfway;
          }
          if (halfway->id < interpreterId) {
              begin = halfway;
          } else {
              end = halfway;
          }
      }
      for (; begin < end; ++begin) {
          if (begin->id >= interpreterId) return begin;
      }
      return begin;
  }
  static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return NULL;
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
      {
          __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
          if (likely(data)) {
              __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
              if (likely(data == new_data)) {
                  goto read_finished;
              }
          }
          __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
          __Pyx_ModuleStateLookup_Lock();
          __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
          data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
          __Pyx_ModuleStateLookup_Unlock();
      }
    read_finished:;
  #else
      __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  #endif
      __Pyx_InterpreterIdAndModule* found = NULL;
      if (unlikely(!data)) goto end;
      if (data->interpreter_id_as_index) {
          if (interpreter_id < data->count) {
              found = data->table+interpreter_id;
          }
      } else {
          found = __Pyx_State_FindModuleStateLookupTableLowerBound(
              data->table, data->count, interpreter_id);
      }
    end:
      {
          PyObject *result=NULL;
          if (found && found->id == interpreter_id) {
              result = found->module;
          }
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
          __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  #endif
          return result;
      }
  }
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
      while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  }
  #else
  #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  #endif
  static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
      Py_ssize_t to_allocate = (*old_data)->allocated;
      while (to_allocate <= interpreter_id) {
          if (to_allocate == 0) to_allocate = 1;
          else to_allocate *= 2;
      }
      __Pyx_ModuleStateLookupData *new_data = *old_data;
      if (to_allocate != (*old_data)->allocated) {
           new_data = (__Pyx_ModuleStateLookupData *)realloc(
              *old_data,
              sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
          if (!new_data) {
              PyErr_NoMemory();
              return -1;
          }
          for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
              new_data->table[i].id = i;
              new_data->table[i].module = NULL;
          }
          new_data->allocated = to_allocate;
      }
      new_data->table[interpreter_id].module = module;
      if (new_data->count < interpreter_id+1) {
          new_data->count = interpreter_id+1;
      }
      *old_data = new_data;
      return 0;
  }
  static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
      __Pyx_InterpreterIdAndModule *read = data->table;
      __Pyx_InterpreterIdAndModule *write = data->table;
      __Pyx_InterpreterIdAndModule *end = read + data->count;
      for (; read<end; ++read) {
          if (read->module) {
              write->id = read->id;
              write->module = read->module;
              ++write;
          }
      }
      data->count = write - data->table;
      for (; write<end; ++write) {
          write->id = 0;
          write->module = NULL;
      }
      data->interpreter_id_as_index = 0;
  }
  static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return -1;
      int result = 0;
      __Pyx_ModuleStateLookup_Lock();
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
              __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  #else
      __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  #endif
      __Pyx_ModuleStateLookupData *new_data = old_data;
      if (!new_data) {
          new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
          if (!new_data) {
              result = -1;
              PyErr_NoMemory();
              goto end;
          }
          new_data->allocated = 1;
          new_data->interpreter_id_as_index = 1;
      }
      __Pyx_ModuleStateLookup_wait_until_no_readers();
      if (new_data->interpreter_id_as_index) {
          if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
              result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
              goto end;
          }
          __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
      }
      {
          Py_ssize_t insert_at = 0;
          {
              __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
                  new_data->table, new_data->count, interpreter_id);
              assert(lower_bound);
              insert_at = lower_bound - new_data->table;
              if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
                  lower_bound->module = module;
                  goto end;  // already in table, nothing more to do
              }
          }
          if (new_data->count+1 >= new_data->allocated) {
              Py_ssize_t to_allocate = (new_data->count+1)*2;
              new_data =
                  (__Pyx_ModuleStateLookupData*)realloc(
                      new_data,
                      sizeof(__Pyx_ModuleStateLookupData) +
                      (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
              if (!new_data) {
                  result = -1;
                  new_data = old_data;
                  PyErr_NoMemory();
                  goto end;
              }
              new_data->allocated = to_allocate;
          }
          ++new_data->count;
          int64_t last_id = interpreter_id;
          PyObject *last_module = module;
          for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
              int64_t current_id = new_data->table[i].id;
              new_data->table[i].id = last_id;
              last_id = current_id;
              PyObject *current_module = new_data->table[i].module;
              new_data->table[i].module = last_module;
              last_module = current_module;
          }
      }
    end:
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  #else
      __Pyx_ModuleStateLookup_data = new_data;
  #endif
      __Pyx_ModuleStateLookup_Unlock();
      return result;
  }
  static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
      int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
      if (interpreter_id == -1) return -1;
      __Pyx_ModuleStateLookup_Lock();
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
              __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  #else
      __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  #endif
      if (data->interpreter_id_as_index) {
          if (interpreter_id < data->count) {
              data->table[interpreter_id].module = NULL;
          }
          goto done;
      }
      {
          __Pyx_ModuleStateLookup_wait_until_no_readers();
          __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
              data->table, data->count, interpreter_id);
          if (!lower_bound) goto done;
          if (lower_bound->id != interpreter_id) goto done;
          __Pyx_InterpreterIdAndModule *end = data->table+data->count;
          for (;lower_bound<end-1; ++lower_bound) {
              lower_bound->id = (lower_bound+1)->id;
              lower_bound->module = (lower_bound+1)->module;
          }
      }
      --data->count;
      if (data->count == 0) {
          free(data);
          data = NULL;
      }
    done:
  #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
      __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  #else
      __Pyx_ModuleStateLookup_data = data;
  #endif
      __Pyx_ModuleStateLookup_Unlock();
      return 0;
  }
  #endif
  
/* #### Code section: utility_code_pragmas_end ### */
#ifdef _MSC_VER
#pragma warning( pop )
#endif



/* #### Code section: end ### */
#endif /* Py_PYTHON_H */
