/* Generated by Cython 0.29.33 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "extra_compile_args": [
            "-std=c++11",
            "-fopenmp",
            "-msse3"
        ],
        "extra_link_args": [
            "-lgomp",
            "-fopenmp"
        ],
        "include_dirs": [
            "/tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/core/include",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp",
            "NonlinearTMM/src/eigen-3.4.0",
            "/tmp/build-env-x9vuoiup/lib/python3.10/site-packages/eigency",
            "/tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/core/include"
        ],
        "language": "c++",
        "name": "NonlinearTMM._SecondOrderNLTMMCython",
        "sources": [
            "NonlinearTMM/src/SecondOrderNLTMM.pyx",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/SecondOrderNLTMM.cpp",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/Common.cpp",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/Material.cpp",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/NonlinearLayer.cpp",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/Waves.cpp",
            "NonlinearTMM/src/NonlinearTMMCpp/NonlinearTMMCpp/NonlinearTMM.cpp"
        ]
    },
    "module_name": "NonlinearTMM._SecondOrderNLTMMCython"
}
END: Cython Metadata */

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

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

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

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

#define __PYX_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; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__NonlinearTMM___SecondOrderNLTMMCython
#define __PYX_HAVE_API__NonlinearTMM___SecondOrderNLTMMCython
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ndarrayobject.h"
#include "numpy/ndarraytypes.h"
#include "numpy/arrayscalars.h"
#include "numpy/ufuncobject.h"

    /* NumPy API declarations from "numpy/__init__.pxd" */
    
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include "eigency_cpp.h"
#include "eigency.h"
#include <utility>

    #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
    // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
    #include <type_traits>

    namespace cython_std {
    template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
    template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
    }

    #endif
    
#include "Common.h"
#include "Material.h"
#include "Waves.h"
#include "NonlinearLayer.h"
#include "NonlinearTMM.h"
#include "SecondOrderNLTMM.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

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

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


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

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

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


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


/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":690
 * # 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":691
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":692
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":693
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":697
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":698
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":699
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":700
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":704
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":705
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":714
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":715
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":716
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":718
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":719
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":720
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":722
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":723
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":725
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":726
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":727
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "eigency/core.pxd":4
 * cimport numpy as np
 * 
 * ctypedef signed char schar;             # <<<<<<<<<<<<<<
 * ctypedef unsigned char uchar;
 * ctypedef long double long_double;
 */
typedef signed char __pyx_t_7eigency_4core_schar;

/* "eigency/core.pxd":5
 * 
 * ctypedef signed char schar;
 * ctypedef unsigned char uchar;             # <<<<<<<<<<<<<<
 * ctypedef long double long_double;
 * 
 */
typedef unsigned char __pyx_t_7eigency_4core_uchar;

/* "eigency/core.pxd":6
 * ctypedef signed char schar;
 * ctypedef unsigned char uchar;
 * ctypedef long double long_double;             # <<<<<<<<<<<<<<
 * 
 * ctypedef fused dtype:
 */
typedef long double __pyx_t_7eigency_4core_long_double;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

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


/*--- Type declarations ---*/
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":729
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":730
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":731
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":733
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init;
struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init;

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":630
 *             del self._thisptr
 * 
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */
struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init {
  int __pyx_n;
  bool needDealloc;
  PyObject *parent;
};

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":680
 *             del self._thisptr
 * 
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */
struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init {
  int __pyx_n;
  bool needDealloc;
  PyObject *parent;
};

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":91
 * #===============================================================================
 * 
 * cdef class _Chi2Tensor:             # <<<<<<<<<<<<<<
 *     """_Chi2Tensor()
 * 
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_vtab;
  TMM::Chi2Tensor *_thisptr;
  PyObject *_parent;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":212
 * #===============================================================================
 * 
 * cdef class Material:             # <<<<<<<<<<<<<<
 *     """Material(wls, ns)
 * 
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material {
  PyObject_HEAD
  TMM::Material *_thisptr;
  PyObject *chi2;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":293
 * #===============================================================================
 * 
 * cdef class _Wave:             # <<<<<<<<<<<<<<
 *     """_Wave()
 * 
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_vtab;
  TMM::Wave *_thisptr;
  bool _needsDealloc;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":554
 * #===============================================================================
 * 
 * cdef class _Intensities:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store intensities for :class:`NonlinearTMM`.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_vtab;
  __pyx_t_double_complex inc;
  __pyx_t_double_complex r;
  __pyx_t_double_complex t;
  double I;
  double R;
  double T;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":592
 * #===============================================================================
 * 
 * cdef class _SweepResultNonlinearTMM:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the result of the :any:`NonlinearTMM.Sweep` method.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_vtab;
  TMM::SweepResultNonlinearTMM *_thisptr;
  PyArrayObject *inc;
  PyArrayObject *r;
  PyArrayObject *t;
  PyArrayObject *Ii;
  PyArrayObject *Ir;
  PyArrayObject *It;
  PyArrayObject *Ia;
  PyArrayObject *enh;
  bool _needDealloc;
  PyObject *_parent;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":649
 * #===============================================================================
 * 
 * cdef class _WaveSweepResultNonlinearTMM:             # <<<<<<<<<<<<<<
 *     """
 *     The helper class to store the results of `WaveSweep`.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_vtab;
  TMM::WaveSweepResultNonlinearTMM *_thisptr;
  PyArrayObject *Pi;
  PyArrayObject *Pr;
  PyArrayObject *Pt;
  PyArrayObject *enh;
  PyArrayObject *beamArea;
  bool _needDealloc;
  PyObject *_parent;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":695
 * #===============================================================================
 * 
 * cdef class _FieldsZ:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the results of `GetFields`.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_vtab;
  TMM::FieldsZ *_thisptr;
  PyArrayObject *E;
  PyArrayObject *H;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":730
 * #===============================================================================
 * 
 * cdef class _FieldsZX:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the result of `GetFields2D` and `WaveGetFields2D`.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_vtab;
  TMM::FieldsZX *_thisptr;
  PyArrayObject *Ex;
  PyArrayObject *Ey;
  PyArrayObject *Ez;
  PyArrayObject *Hx;
  PyArrayObject *Hy;
  PyArrayObject *Hz;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":818
 * #===============================================================================
 * 
 * cdef class _HomogeneousWave:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class for `NonlinearLayer` to describe the parameters of the
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_vtab;
  TMM::HomogeneousWave *_thisptr;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":872
 * #===============================================================================
 * 
 * cdef class _NonlinearLayer:             # <<<<<<<<<<<<<<
 *     """
 *         Helper class for layer specific data and mathods.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_vtab;
  TMM::NonlinearLayer *_thisptr;
  PyObject *hw;
  PyObject *_parent;
  int _layerNr;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":962
 * #===============================================================================
 * 
 * cdef class NonlinearTMM:             # <<<<<<<<<<<<<<
 *     """NonlinearTMM()
 * 
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_vtab;
  TMM::NonlinearTMM *_thisptr;
  PyObject *materialsCache;
  PyObject *layers;
  bool _needDealloc;
  PyObject *_parent;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *wave;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1510
 * #===============================================================================
 * 
 * cdef class _SecondOrderNLIntensities:             # <<<<<<<<<<<<<<
 *     """_SecondOrderNLIntensities()
 *     This is a helper class for `SecondOrderNLTMM`. It stores the results of
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_vtab;
  PyObject *P1;
  PyObject *P2;
  PyObject *Gen;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1551
 * #===============================================================================
 * 
 * cdef class _SweepResultSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *     """_SweepResultSecondOrderNLTMM()
 *     Helper class for `SecondOrderNLTMM`. Stores the results of `Sweep` method.
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_vtab;
  TMM::SweepResultSecondOrderNLTMM *_thisptr;
  PyObject *P1;
  PyObject *P2;
  PyObject *Gen;
  PyArrayObject *wlsGen;
  PyArrayObject *betasGen;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1602
 * #===============================================================================
 * 
 * cdef class _WaveSweepResultSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *     """_WaveSweepResultSecondOrderNLTMM()
 *     Helper class for `SecondOrderNLTMM`. Stores the results of `WaveSweep`
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM {
  PyObject_HEAD
  struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_vtab;
  TMM::WaveSweepResultSecondOrderNLTMM *_thisptr;
  PyObject *P1;
  PyObject *P2;
  PyObject *Gen;
  PyArrayObject *wlsGen;
  PyArrayObject *betasGen;
};


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1655
 * #===============================================================================
 * 
 * cdef class SecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *     """SecondOrderNLTMM(mode)
 * 
 */
struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM {
  PyObject_HEAD
  TMM::SecondOrderNLTMM *_thisptr;
  PyObject *materialsCache;
  PyObject *P1;
  PyObject *P2;
  PyObject *Gen;
};



/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":91
 * #===============================================================================
 * 
 * cdef class _Chi2Tensor:             # <<<<<<<<<<<<<<
 *     """_Chi2Tensor()
 * 
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *, TMM::Chi2Tensor *, PyObject *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":293
 * #===============================================================================
 * 
 * cdef class _Wave:             # <<<<<<<<<<<<<<
 *     """_Wave()
 * 
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *, TMM::Wave *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":554
 * #===============================================================================
 * 
 * cdef class _Intensities:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store intensities for :class:`NonlinearTMM`.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *, TMM::Intensities *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":592
 * #===============================================================================
 * 
 * cdef class _SweepResultNonlinearTMM:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the result of the :any:`NonlinearTMM.Sweep` method.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *, TMM::SweepResultNonlinearTMM *, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init *__pyx_optional_args);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":649
 * #===============================================================================
 * 
 * cdef class _WaveSweepResultNonlinearTMM:             # <<<<<<<<<<<<<<
 *     """
 *     The helper class to store the results of `WaveSweep`.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *, TMM::WaveSweepResultNonlinearTMM *, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init *__pyx_optional_args);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":695
 * #===============================================================================
 * 
 * cdef class _FieldsZ:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the results of `GetFields`.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *, TMM::FieldsZ *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":730
 * #===============================================================================
 * 
 * cdef class _FieldsZX:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class to store the result of `GetFields2D` and `WaveGetFields2D`.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *, TMM::FieldsZX *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":818
 * #===============================================================================
 * 
 * cdef class _HomogeneousWave:             # <<<<<<<<<<<<<<
 *     """
 *     Helper class for `NonlinearLayer` to describe the parameters of the
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *, TMM::HomogeneousWave *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":872
 * #===============================================================================
 * 
 * cdef class _NonlinearLayer:             # <<<<<<<<<<<<<<
 *     """
 *         Helper class for layer specific data and mathods.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *, TMM::NonlinearLayer *, int, PyObject *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":962
 * #===============================================================================
 * 
 * cdef class NonlinearTMM:             # <<<<<<<<<<<<<<
 *     """NonlinearTMM()
 * 
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *, TMM::NonlinearTMM *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1510
 * #===============================================================================
 * 
 * cdef class _SecondOrderNLIntensities:             # <<<<<<<<<<<<<<
 *     """_SecondOrderNLIntensities()
 *     This is a helper class for `SecondOrderNLTMM`. It stores the results of
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *, TMM::SecondOrderNLIntensities *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1551
 * #===============================================================================
 * 
 * cdef class _SweepResultSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *     """_SweepResultSecondOrderNLTMM()
 *     Helper class for `SecondOrderNLTMM`. Stores the results of `Sweep` method.
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *, TMM::SweepResultSecondOrderNLTMM *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;


/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1602
 * #===============================================================================
 * 
 * cdef class _WaveSweepResultSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *     """_WaveSweepResultSecondOrderNLTMM()
 *     Helper class for `SecondOrderNLTMM`. Stores the results of `WaveSweep`
 */

struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM {
  PyObject *(*_Init)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *, TMM::WaveSweepResultSecondOrderNLTMM *);
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* py_dict_pop.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
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

/* CallUnboundCMethod1.proto */
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

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

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

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  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_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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __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

/* bytes_tailmatch.proto */
static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
                                         Py_ssize_t start, Py_ssize_t end, int direction);
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
                                   Py_ssize_t start, Py_ssize_t end, int direction);

/* unicode_tailmatch.proto */
static int __Pyx_PyUnicode_Tailmatch(
    PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction);

/* str_tailmatch.proto */
static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction);

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

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

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

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

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

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

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

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

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

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

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

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

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

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

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

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

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_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

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

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


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

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

/* ToPy.proto */
#define __pyx_PyComplex_FromComplex(z)\
        PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
                              (double)__Pyx_CIMAG(z))

/* FromPy.proto */
static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(enum TMM::TMMParam value);

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

/* CIntFromPy.proto */
static CYTHON_INLINE enum TMM::TMMParam __Pyx_PyInt_As_enum__TMM_3a__3a_TMMParam(PyObject *);

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

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

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

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

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

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

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, TMM::Chi2Tensor *__pyx_v_ptr, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, TMM::Wave *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self, TMM::Intensities *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self, TMM::SweepResultNonlinearTMM *__pyx_v_ptr, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self, TMM::WaveSweepResultNonlinearTMM *__pyx_v_ptr, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self, TMM::FieldsZ *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self, TMM::FieldsZX *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, TMM::HomogeneousWave *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, TMM::NonlinearLayer *__pyx_v_ptr, int __pyx_v_layerNr, PyObject *__pyx_v_parent); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, TMM::NonlinearTMM *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self, TMM::SecondOrderNLIntensities *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self, TMM::SweepResultSecondOrderNLTMM *__pyx_v_ptr); /* proto*/
static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self, TMM::WaveSweepResultSecondOrderNLTMM *__pyx_v_ptr); /* proto*/

/* Module declarations from 'libcpp' */

/* Module declarations from 'cython' */

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

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

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

/* Module declarations from '__builtin__' */

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

/* Module declarations from 'cpython' */

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

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

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

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
static PyTypeObject *__pyx_ptype_5numpy_number = 0;
static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
static PyTypeObject *__pyx_ptype_5numpy_character = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;

/* Module declarations from 'eigency.core' */

/* Module declarations from 'libcpp.utility' */

/* Module declarations from 'libcpp.pair' */

/* Module declarations from 'CppSecondOrderNLTMM' */

/* Module declarations from 'NonlinearTMM._SecondOrderNLTMMCython' */
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_Material = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM = 0;
static PyTypeObject *__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM = 0;
static PyObject *__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict = 0;
static PyObject *__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDictSecondOrderNLTMM = 0;
static PyObject *__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_waveParamsSet = 0;
static enum TMM::Polarization __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_PolarizationFromStr(PyObject *); /*proto*/
static enum TMM::WaveDirection __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(PyObject *); /*proto*/
static enum TMM::NonlinearTmmMode __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTmmModeFromStr(PyObject *); /*proto*/
static enum TMM::NonlinearProcess __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearProcessFromStr(PyObject *); /*proto*/
static enum TMM::WaveType __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveTypeFromStr(PyObject *); /*proto*/
static enum TMM::TMMParam __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 };
#define __Pyx_MODULE_NAME "NonlinearTMM._SecondOrderNLTMMCython"
extern int __pyx_module_is_main_NonlinearTMM___SecondOrderNLTMMCython;
int __pyx_module_is_main_NonlinearTMM___SecondOrderNLTMMCython = 0;

/* Implementation of 'NonlinearTMM._SecondOrderNLTMMCython' */
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_a[] = "a";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_E0[] = "E0";
static const char __pyx_k_I0[] = "I0";
static const char __pyx_k_Ly[] = "Ly";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_ns[] = "ns";
static const char __pyx_k_ps[] = "ps";
static const char __pyx_k_w0[] = "w0";
static const char __pyx_k_wl[] = "wl";
static const char __pyx_k_x0[] = "x0";
static const char __pyx_k_x1[] = "x1";
static const char __pyx_k_xs[] = "xs";
static const char __pyx_k_zs[] = "zs";
static const char __pyx_k_chi[] = "chi";
static const char __pyx_k_d_2[] = "d_";
static const char __pyx_k_dfg[] = "dfg";
static const char __pyx_k_dir[] = "dir";
static const char __pyx_k_nan[] = "nan";
static const char __pyx_k_pol[] = "pol";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pwr[] = "pwr";
static const char __pyx_k_sfg[] = "sfg";
static const char __pyx_k_wls[] = "wls";
static const char __pyx_k_GetN[] = "GetN";
static const char __pyx_k_Wave[] = "_Wave";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_imag[] = "imag";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_maxX[] = "maxX";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_outR[] = "outR";
static const char __pyx_k_outT[] = "outT";
static const char __pyx_k_phiX[] = "phiX";
static const char __pyx_k_phiY[] = "phiY";
static const char __pyx_k_phiZ[] = "phiZ";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_spdc[] = "spdc";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_outP1[] = "outP1";
static const char __pyx_k_outP2[] = "outP2";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_total[] = "total";
static const char __pyx_k_tukey[] = "tukey";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_dirStr[] = "dirStr";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_layerZ[] = "layerZ";
static const char __pyx_k_maxPhi[] = "maxPhi";
static const char __pyx_k_outAbs[] = "outAbs";
static const char __pyx_k_outEnh[] = "outEnh";
static const char __pyx_k_outGen[] = "outGen";
static const char __pyx_k_outPwr[] = "outPwr";
static const char __pyx_k_parent[] = "parent";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_FieldsZ[] = "_FieldsZ";
static const char __pyx_k_forward[] = "forward";
static const char __pyx_k_layerNr[] = "layerNr";
static const char __pyx_k_squeeze[] = "squeeze";
static const char __pyx_k_AddLayer[] = "AddLayer";
static const char __pyx_k_FieldsZX[] = "_FieldsZX";
static const char __pyx_k_Material[] = "Material";
static const char __pyx_k_backward[] = "backward";
static const char __pyx_k_gaussian[] = "gaussian";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_incident[] = "incident";
static const char __pyx_k_material[] = "material";
static const char __pyx_k_paramStr[] = "paramStr";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_valuesP1[] = "valuesP1";
static const char __pyx_k_valuesP2[] = "valuesP2";
static const char __pyx_k_waveType[] = "waveType";
static const char __pyx_k_SetParams[] = "SetParams";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_nonlinear[] = "nonlinear";
static const char __pyx_k_planewave[] = "planewave";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_Chi2Tensor[] = "_Chi2Tensor";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_initStruct[] = "initStruct";
static const char __pyx_k_overrideE0[] = "overrideE0";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_Intensities[] = "_Intensities";
static const char __pyx_k_deltaWlSpdc[] = "deltaWlSpdc";
static const char __pyx_k_dynamicMaxX[] = "dynamicMaxX";
static const char __pyx_k_NonlinearTMM[] = "NonlinearTMM";
static const char __pyx_k_nPointsInteg[] = "nPointsInteg";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_NonlinearLayer[] = "_NonlinearLayer";
static const char __pyx_k_deltaThetaSpdc[] = "deltaThetaSpdc";
static const char __pyx_k_distinctFields[] = "distinctFields";
static const char __pyx_k_solidAngleSpdc[] = "solidAngleSpdc";
static const char __pyx_k_HomogeneousWave[] = "_HomogeneousWave";
static const char __pyx_k_Unknown_kwarg_s[] = "Unknown kwarg %s";
static const char __pyx_k_dynamicMaxXCoef[] = "dynamicMaxXCoef";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_SecondOrderNLTMM[] = "SecondOrderNLTMM";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_dynamicMaxXAddition[] = "dynamicMaxXAddition";
static const char __pyx_k_Unknown_polarization[] = "Unknown polarization.";
static const char __pyx_k_Material_GetN_line_250[] = "Material.GetN (line 250)";
static const char __pyx_k_SweepResultNonlinearTMM[] = "_SweepResultNonlinearTMM";
static const char __pyx_k_SecondOrderNLIntensities[] = "_SecondOrderNLIntensities";
static const char __pyx_k_Chi2Tensor_Update_line_114[] = "_Chi2Tensor.Update (line 114)";
static const char __pyx_k_SweepResultSecondOrderNLTMM[] = "_SweepResultSecondOrderNLTMM";
static const char __pyx_k_WaveSweepResultNonlinearTMM[] = "_WaveSweepResultNonlinearTMM";
static const char __pyx_k_NonlinearTMM_Solve_line_1087[] = "NonlinearTMM.Solve (line 1087)";
static const char __pyx_k_NonlinearTMM_AddLayer_line_1042[] = "NonlinearTMM.AddLayer (line 1042)";
static const char __pyx_k_WaveSweepResultSecondOrderNLTMM[] = "_WaveSweepResultSecondOrderNLTMM";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_AddLayer_d_material_Adds_layer_t[] = "AddLayer(d, material)\n        \n        Adds layer to the TMM.\n        \n        Parameters\n        ----------\n        d : float\n            Thickness of the layer in meters. First and the last medium have\n            infinite thickness.\n        material : :any:`Material`\n            Instance of the helper class :any:`Material`\n        \n        Examples\n        --------\n        >>> tmm = TMM()\n        >>> tmm.AddLayer(float(\"inf\"), Material.Static(1.5))\n        >>> tmm.AddLayer(50e-9, Material.Static(0.3 + 3j))\n        >>> tmm.AddLayer(float(\"inf\"), Material.Static(1.0))\n        ";
static const char __pyx_k_GetN_wl_Returns_refractive_index[] = "GetN(wl)\n        \n        Returns refractive index of material at specified wavelength.\n        \n        Parameters\n        ----------\n        wl : float\n            Wavelength in meters.\n        \n        Returns\n        -------\n        complex\n            Complex refractive index at wavelength wl.\n        \n        Examples\n        --------\n        >>> wls = np.array([400e-9, 600e-9, 800e-9], dtype = float)\n        >>> ns = np.array([1.5 + 0.3j, 1.7 + 0.2j, 1.8 + 0.1j], dtype = complex)\n        >>> mat = Material(wls, ns)\n        >>> mat(600e-9)\n        1.7 + 0.2j\n        \n        ";
static const char __pyx_k_Solve_kwargs_Solves_the_structur[] = "Solve(**kwargs)\n        \n        Solves the structure.\n        \n        Parameters\n        ----------\n        wl : float, optional\n             Wavelength in meters.\n        pol : str, optional\n            \"p\" or \"s\" denoting the polarization of the waves.\n        beta : float, optional\n            Normalized tangential wave vector.\n        E0 : complex, optional\n            Input plane wave amplitude in vacuum. Only used if :any:`overrideE0` is\n            True.\n        I0 : float, optional\n            Input plane wave intensity in the first layer. Only used if\n            :any:`overrideE0` is False.\n        overrideE0 : bool, optional\n            Selects between :any:`E0` and :any:`I0`.\n        \n        Examples\n        --------\n        >>> tmm.Solve(wl = 532e-9, beta = 0.0)\n            \n        ";
static const char __pyx_k_Update_kwargs_This_method_change[] = "Update(**kwargs)\n        \n        This method changes the values of second-order nonlinearity tensor. By\n        default the tensor is zero, not rotated and distinctFields set to True.\n        \n        Parameters\n        ----------\n        chiXYZ : float, optional\n            Updates tensor value of second-order nonlinearity, where X, Y, Z\n            denote numbers from 1..3 corresponding to x-, y-, z-axis.\n        dXK : float, optional\n            Updates tensor values by contracted notation, where dXK = 0.5 * chiXYZ\n            and K is defined as: 1 = 11; 2 = 22; 3 = 33; 4 = 23, 32; 5 = 31, 13; 6 = 12, 21.\n        distinctFields : bool, optional\n            If set to True, then assumes that two input waves in nonlinear process\n            are the same (e.g second harmonic generation). If False, then the\n            input fields are not equal (as a result the result will be multiplied by 2).\n            Default is true.\n        phiX : float, optional\n            The rotation angle (radians) around x-axis of the second order nonlinear tensor. \n        phiY : float, optional\n            The rotation angle (radians) around y-axis of the second order nonlinear tensor. \n        phiZ : float, optional\n            The rotation angle (radians) around z-axis of the second order nonlinear tensor.\n            \n        Examples\n        --------\n        Updates nonlinear tensor of material and then rotates it.\n        \n        >>> mat = Material.Static(1.5)\n        >>> mat.chi2.Update(d11 = 1e-12, d22 = 2e-12, chi23 = 3e-12)\n        >>> mat.chi2.Update(phiX = 0.2, phiY = 0.5, phiZ = -0.1)\n                 \n        ";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static PyObject *__pyx_n_s_AddLayer;
static PyObject *__pyx_kp_u_AddLayer_d_material_Adds_layer_t;
static PyObject *__pyx_n_s_Chi2Tensor;
static PyObject *__pyx_kp_u_Chi2Tensor_Update_line_114;
static PyObject *__pyx_n_s_E0;
static PyObject *__pyx_n_s_FieldsZ;
static PyObject *__pyx_n_s_FieldsZX;
static PyObject *__pyx_n_s_GetN;
static PyObject *__pyx_kp_u_GetN_wl_Returns_refractive_index;
static PyObject *__pyx_n_s_HomogeneousWave;
static PyObject *__pyx_n_s_I0;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_Intensities;
static PyObject *__pyx_n_s_Ly;
static PyObject *__pyx_n_s_Material;
static PyObject *__pyx_kp_u_Material_GetN_line_250;
static PyObject *__pyx_n_s_NonlinearLayer;
static PyObject *__pyx_n_s_NonlinearTMM;
static PyObject *__pyx_kp_u_NonlinearTMM_AddLayer_line_1042;
static PyObject *__pyx_kp_u_NonlinearTMM_Solve_line_1087;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_SecondOrderNLIntensities;
static PyObject *__pyx_n_s_SecondOrderNLTMM;
static PyObject *__pyx_n_s_SetParams;
static PyObject *__pyx_kp_u_Solve_kwargs_Solves_the_structur;
static PyObject *__pyx_n_s_SweepResultNonlinearTMM;
static PyObject *__pyx_n_s_SweepResultSecondOrderNLTMM;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unknown_kwarg_s;
static PyObject *__pyx_kp_s_Unknown_polarization;
static PyObject *__pyx_kp_u_Update_kwargs_This_method_change;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_Wave;
static PyObject *__pyx_n_s_WaveSweepResultNonlinearTMM;
static PyObject *__pyx_n_s_WaveSweepResultSecondOrderNLTMM;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_backward;
static PyObject *__pyx_n_s_beta;
static PyObject *__pyx_n_s_chi;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_d_2;
static PyObject *__pyx_n_s_deltaThetaSpdc;
static PyObject *__pyx_n_s_deltaWlSpdc;
static PyObject *__pyx_n_s_dfg;
static PyObject *__pyx_n_s_dir;
static PyObject *__pyx_n_s_dirStr;
static PyObject *__pyx_n_s_distinctFields;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_dynamicMaxX;
static PyObject *__pyx_n_s_dynamicMaxXAddition;
static PyObject *__pyx_n_s_dynamicMaxXCoef;
static PyObject *__pyx_n_s_forward;
static PyObject *__pyx_n_s_gaussian;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_imag;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_incident;
static PyObject *__pyx_n_s_initStruct;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_layerNr;
static PyObject *__pyx_n_s_layerZ;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_material;
static PyObject *__pyx_n_s_maxPhi;
static PyObject *__pyx_n_s_maxX;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_nPointsInteg;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nan;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_nonlinear;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_ns;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_outAbs;
static PyObject *__pyx_n_s_outEnh;
static PyObject *__pyx_n_s_outGen;
static PyObject *__pyx_n_s_outP1;
static PyObject *__pyx_n_s_outP2;
static PyObject *__pyx_n_s_outPwr;
static PyObject *__pyx_n_s_outR;
static PyObject *__pyx_n_s_outT;
static PyObject *__pyx_n_s_overrideE0;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_paramStr;
static PyObject *__pyx_n_s_parent;
static PyObject *__pyx_n_s_phiX;
static PyObject *__pyx_n_s_phiY;
static PyObject *__pyx_n_s_phiZ;
static PyObject *__pyx_n_s_planewave;
static PyObject *__pyx_n_s_pol;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_ps;
static PyObject *__pyx_n_s_pwr;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_sfg;
static PyObject *__pyx_n_s_solidAngleSpdc;
static PyObject *__pyx_n_s_spdc;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_squeeze;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_total;
static PyObject *__pyx_n_s_tukey;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_valuesP1;
static PyObject *__pyx_n_s_valuesP2;
static PyObject *__pyx_n_s_w0;
static PyObject *__pyx_n_s_waveType;
static PyObject *__pyx_n_s_wl;
static PyObject *__pyx_n_s_wls;
static PyObject *__pyx_n_s_x0;
static PyObject *__pyx_n_s_x1;
static PyObject *__pyx_n_s_xs;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_n_s_zs;
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_4Update(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_6GetChi2Tensor(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyArrayObject *__pyx_v_wls, PyArrayObject *__pyx_v_ns); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4__call__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyObject *__pyx_v_wl); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_6GetN(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyObject *__pyx_v_wl); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_8IsNonlinear(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType___get__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, PyObject *__pyx_v_waveTypeStr); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, bool __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, bool __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2GetMainFields(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2GetIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_4GetAbsorbedIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_6GetSrcIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, bool __pyx_v_initStruct, PyObject *__pyx_v_parent, PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4AddLayer(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, double __pyx_v_d, struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_8Solve(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10GetIntensities(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_12Sweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_values, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outAbs, PyObject *__pyx_v_outEnh); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14GetFields(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyObject *__pyx_v_dir); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_16GetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dir); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_18GetAbsorbedIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_20GetEnhancement(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_22WaveGetPowerFlows(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_x0, double __pyx_v_x1, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_24WaveGetEnhancement(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_26WaveSweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_values, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outR, bool __pyx_v_outT, bool __pyx_v_outEnh); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_28WaveGetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dirStr); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_polStr); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_modeStr); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_30__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_32__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_mode, PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_4SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_6AddLayer(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, double __pyx_v_d, struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_8Solve(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_10UpdateGenParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_12GetIntensities(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14Sweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_valuesP1, PyArrayObject *__pyx_v_valuesP2, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outAbs, bool __pyx_v_outEnh, bool __pyx_v_outP1, bool __pyx_v_outP2, bool __pyx_v_outGen); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_16WaveGetPowerFlows(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_x0, double __pyx_v_x1, double __pyx_v_z); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_18WaveSweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_valuesP1, PyArrayObject *__pyx_v_valuesP2, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outR, bool __pyx_v_outT, bool __pyx_v_outEnh, bool __pyx_v_outP1, bool __pyx_v_outP2, bool __pyx_v_outGen); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_20WaveGetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dirStr); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_Material(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static double __pyx_k__22;
static double __pyx_k__23;
static double __pyx_k__33;
static double __pyx_k__34;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
/* Late includes */

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":8
 * #===============================================================================
 * 
 * cdef PolarizationCpp PolarizationFromStr(str polStr):             # <<<<<<<<<<<<<<
 *     if polStr == "p":
 *         return P_POL
 */

static enum TMM::Polarization __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_PolarizationFromStr(PyObject *__pyx_v_polStr) {
  enum TMM::Polarization __pyx_r;
  __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("PolarizationFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":9
 * 
 * cdef PolarizationCpp PolarizationFromStr(str polStr):
 *     if polStr == "p":             # <<<<<<<<<<<<<<
 *         return P_POL
 *     elif polStr == "s":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_polStr, __pyx_n_s_p, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 9, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":10
 * cdef PolarizationCpp PolarizationFromStr(str polStr):
 *     if polStr == "p":
 *         return P_POL             # <<<<<<<<<<<<<<
 *     elif polStr == "s":
 *         return S_POL
 */
    __pyx_r = TMM::P_POL;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":9
 * 
 * cdef PolarizationCpp PolarizationFromStr(str polStr):
 *     if polStr == "p":             # <<<<<<<<<<<<<<
 *         return P_POL
 *     elif polStr == "s":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":11
 *     if polStr == "p":
 *         return P_POL
 *     elif polStr == "s":             # <<<<<<<<<<<<<<
 *         return S_POL
 *     else:
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_polStr, __pyx_n_s_s, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 11, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":12
 *         return P_POL
 *     elif polStr == "s":
 *         return S_POL             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError()
 */
    __pyx_r = TMM::S_POL;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":11
 *     if polStr == "p":
 *         return P_POL
 *     elif polStr == "s":             # <<<<<<<<<<<<<<
 *         return S_POL
 *     else:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":14
 *         return S_POL
 *     else:
 *         raise NotImplementedError()             # <<<<<<<<<<<<<<
 * 
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __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, 14, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":8
 * #===============================================================================
 * 
 * cdef PolarizationCpp PolarizationFromStr(str polStr):             # <<<<<<<<<<<<<<
 *     if polStr == "p":
 *         return P_POL
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.PolarizationFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::Polarization) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":16
 *         raise NotImplementedError()
 * 
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):             # <<<<<<<<<<<<<<
 *     if waveStr == "forward":
 *         return F
 */

static enum TMM::WaveDirection __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(PyObject *__pyx_v_waveStr) {
  enum TMM::WaveDirection __pyx_r;
  __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("WaveDirectionFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":17
 * 
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):
 *     if waveStr == "forward":             # <<<<<<<<<<<<<<
 *         return F
 *     elif waveStr == "backward":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_waveStr, __pyx_n_s_forward, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 17, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":18
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):
 *     if waveStr == "forward":
 *         return F             # <<<<<<<<<<<<<<
 *     elif waveStr == "backward":
 *         return B
 */
    __pyx_r = TMM::F;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":17
 * 
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):
 *     if waveStr == "forward":             # <<<<<<<<<<<<<<
 *         return F
 *     elif waveStr == "backward":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":19
 *     if waveStr == "forward":
 *         return F
 *     elif waveStr == "backward":             # <<<<<<<<<<<<<<
 *         return B
 *     elif waveStr == "total":
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_waveStr, __pyx_n_s_backward, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":20
 *         return F
 *     elif waveStr == "backward":
 *         return B             # <<<<<<<<<<<<<<
 *     elif waveStr == "total":
 *         return TOT
 */
    __pyx_r = TMM::B;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":19
 *     if waveStr == "forward":
 *         return F
 *     elif waveStr == "backward":             # <<<<<<<<<<<<<<
 *         return B
 *     elif waveStr == "total":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":21
 *     elif waveStr == "backward":
 *         return B
 *     elif waveStr == "total":             # <<<<<<<<<<<<<<
 *         return TOT
 *     else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_waveStr, __pyx_n_s_total, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 21, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":22
 *         return B
 *     elif waveStr == "total":
 *         return TOT             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError()
 */
    __pyx_r = TMM::TOT;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":21
 *     elif waveStr == "backward":
 *         return B
 *     elif waveStr == "total":             # <<<<<<<<<<<<<<
 *         return TOT
 *     else:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":24
 *         return TOT
 *     else:
 *         raise NotImplementedError()             # <<<<<<<<<<<<<<
 * 
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __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, 24, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":16
 *         raise NotImplementedError()
 * 
 * cdef WaveDirectionCpp WaveDirectionFromStr(str waveStr):             # <<<<<<<<<<<<<<
 *     if waveStr == "forward":
 *         return F
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.WaveDirectionFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::WaveDirection) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":26
 *         raise NotImplementedError()
 * 
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):             # <<<<<<<<<<<<<<
 *     if modeStr == "incident":
 *         return MODE_INCIDENT
 */

static enum TMM::NonlinearTmmMode __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTmmModeFromStr(PyObject *__pyx_v_modeStr) {
  enum TMM::NonlinearTmmMode __pyx_r;
  __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("NonlinearTmmModeFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":27
 * 
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):
 *     if modeStr == "incident":             # <<<<<<<<<<<<<<
 *         return MODE_INCIDENT
 *     elif modeStr == "nonlinear":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_modeStr, __pyx_n_s_incident, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 27, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":28
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):
 *     if modeStr == "incident":
 *         return MODE_INCIDENT             # <<<<<<<<<<<<<<
 *     elif modeStr == "nonlinear":
 *         return MODE_NONLINEAR
 */
    __pyx_r = TMM::MODE_INCIDENT;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":27
 * 
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):
 *     if modeStr == "incident":             # <<<<<<<<<<<<<<
 *         return MODE_INCIDENT
 *     elif modeStr == "nonlinear":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":29
 *     if modeStr == "incident":
 *         return MODE_INCIDENT
 *     elif modeStr == "nonlinear":             # <<<<<<<<<<<<<<
 *         return MODE_NONLINEAR
 *     else:
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_modeStr, __pyx_n_s_nonlinear, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 29, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":30
 *         return MODE_INCIDENT
 *     elif modeStr == "nonlinear":
 *         return MODE_NONLINEAR             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError()
 */
    __pyx_r = TMM::MODE_NONLINEAR;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":29
 *     if modeStr == "incident":
 *         return MODE_INCIDENT
 *     elif modeStr == "nonlinear":             # <<<<<<<<<<<<<<
 *         return MODE_NONLINEAR
 *     else:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":32
 *         return MODE_NONLINEAR
 *     else:
 *         raise ValueError()             # <<<<<<<<<<<<<<
 * 
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_ValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __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, 32, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":26
 *         raise NotImplementedError()
 * 
 * cdef NonlinearTmmModeCpp NonlinearTmmModeFromStr(str modeStr):             # <<<<<<<<<<<<<<
 *     if modeStr == "incident":
 *         return MODE_INCIDENT
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTmmModeFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::NonlinearTmmMode) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":34
 *         raise ValueError()
 * 
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):             # <<<<<<<<<<<<<<
 *     if processStr == "sfg":
 *         return SFG
 */

static enum TMM::NonlinearProcess __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearProcessFromStr(PyObject *__pyx_v_processStr) {
  enum TMM::NonlinearProcess __pyx_r;
  __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("NonlinearProcessFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":35
 * 
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):
 *     if processStr == "sfg":             # <<<<<<<<<<<<<<
 *         return SFG
 *     elif processStr == "dfg":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_processStr, __pyx_n_s_sfg, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 35, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":36
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):
 *     if processStr == "sfg":
 *         return SFG             # <<<<<<<<<<<<<<
 *     elif processStr == "dfg":
 *         return DFG
 */
    __pyx_r = TMM::SFG;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":35
 * 
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):
 *     if processStr == "sfg":             # <<<<<<<<<<<<<<
 *         return SFG
 *     elif processStr == "dfg":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":37
 *     if processStr == "sfg":
 *         return SFG
 *     elif processStr == "dfg":             # <<<<<<<<<<<<<<
 *         return DFG
 *     elif processStr == "spdc":
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_processStr, __pyx_n_s_dfg, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":38
 *         return SFG
 *     elif processStr == "dfg":
 *         return DFG             # <<<<<<<<<<<<<<
 *     elif processStr == "spdc":
 *         return SPDC
 */
    __pyx_r = TMM::DFG;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":37
 *     if processStr == "sfg":
 *         return SFG
 *     elif processStr == "dfg":             # <<<<<<<<<<<<<<
 *         return DFG
 *     elif processStr == "spdc":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":39
 *     elif processStr == "dfg":
 *         return DFG
 *     elif processStr == "spdc":             # <<<<<<<<<<<<<<
 *         return SPDC
 *     else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_processStr, __pyx_n_s_spdc, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 39, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":40
 *         return DFG
 *     elif processStr == "spdc":
 *         return SPDC             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError()
 */
    __pyx_r = TMM::SPDC;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":39
 *     elif processStr == "dfg":
 *         return DFG
 *     elif processStr == "spdc":             # <<<<<<<<<<<<<<
 *         return SPDC
 *     else:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":42
 *         return SPDC
 *     else:
 *         raise ValueError()             # <<<<<<<<<<<<<<
 * 
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_ValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __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, 42, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":34
 *         raise ValueError()
 * 
 * cdef NonlinearProcessCpp NonlinearProcessFromStr(str processStr):             # <<<<<<<<<<<<<<
 *     if processStr == "sfg":
 *         return SFG
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.NonlinearProcessFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::NonlinearProcess) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":44
 *         raise ValueError()
 * 
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):             # <<<<<<<<<<<<<<
 *     if waveTypeStr == "planewave":
 *         return PLANEWAVE
 */

static enum TMM::WaveType __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveTypeFromStr(PyObject *__pyx_v_waveTypeStr) {
  enum TMM::WaveType __pyx_r;
  __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("WaveTypeFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":45
 * 
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):
 *     if waveTypeStr == "planewave":             # <<<<<<<<<<<<<<
 *         return PLANEWAVE
 *     if waveTypeStr == "gaussian":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_waveTypeStr, __pyx_n_s_planewave, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 45, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":46
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):
 *     if waveTypeStr == "planewave":
 *         return PLANEWAVE             # <<<<<<<<<<<<<<
 *     if waveTypeStr == "gaussian":
 *         return GAUSSIANWAVE
 */
    __pyx_r = TMM::PLANEWAVE;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":45
 * 
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):
 *     if waveTypeStr == "planewave":             # <<<<<<<<<<<<<<
 *         return PLANEWAVE
 *     if waveTypeStr == "gaussian":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":47
 *     if waveTypeStr == "planewave":
 *         return PLANEWAVE
 *     if waveTypeStr == "gaussian":             # <<<<<<<<<<<<<<
 *         return GAUSSIANWAVE
 *     if waveTypeStr == "tukey":
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_waveTypeStr, __pyx_n_s_gaussian, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 47, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":48
 *         return PLANEWAVE
 *     if waveTypeStr == "gaussian":
 *         return GAUSSIANWAVE             # <<<<<<<<<<<<<<
 *     if waveTypeStr == "tukey":
 *         return TUKEYWAVE
 */
    __pyx_r = TMM::GAUSSIANWAVE;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":47
 *     if waveTypeStr == "planewave":
 *         return PLANEWAVE
 *     if waveTypeStr == "gaussian":             # <<<<<<<<<<<<<<
 *         return GAUSSIANWAVE
 *     if waveTypeStr == "tukey":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":49
 *     if waveTypeStr == "gaussian":
 *         return GAUSSIANWAVE
 *     if waveTypeStr == "tukey":             # <<<<<<<<<<<<<<
 *         return TUKEYWAVE
 *     if waveTypeStr == "spdc":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_waveTypeStr, __pyx_n_s_tukey, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 49, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":50
 *         return GAUSSIANWAVE
 *     if waveTypeStr == "tukey":
 *         return TUKEYWAVE             # <<<<<<<<<<<<<<
 *     if waveTypeStr == "spdc":
 *         return SPDCWAVE;
 */
    __pyx_r = TMM::TUKEYWAVE;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":49
 *     if waveTypeStr == "gaussian":
 *         return GAUSSIANWAVE
 *     if waveTypeStr == "tukey":             # <<<<<<<<<<<<<<
 *         return TUKEYWAVE
 *     if waveTypeStr == "spdc":
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":51
 *     if waveTypeStr == "tukey":
 *         return TUKEYWAVE
 *     if waveTypeStr == "spdc":             # <<<<<<<<<<<<<<
 *         return SPDCWAVE;
 *     else:
 */
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_waveTypeStr, __pyx_n_s_spdc, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":52
 *         return TUKEYWAVE
 *     if waveTypeStr == "spdc":
 *         return SPDCWAVE;             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError()
 */
    __pyx_r = TMM::SPDCWAVE;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":51
 *     if waveTypeStr == "tukey":
 *         return TUKEYWAVE
 *     if waveTypeStr == "spdc":             # <<<<<<<<<<<<<<
 *         return SPDCWAVE;
 *     else:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":54
 *         return SPDCWAVE;
 *     else:
 *         raise NotImplementedError()             # <<<<<<<<<<<<<<
 * 
 * cdef paramDict = {"wl": PARAM_WL, \
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __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, 54, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":44
 *         raise ValueError()
 * 
 * cdef WaveTypeCpp WaveTypeFromStr(str waveTypeStr):             # <<<<<<<<<<<<<<
 *     if waveTypeStr == "planewave":
 *         return PLANEWAVE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.WaveTypeFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::WaveType) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":84
 * 
 * 
 * cdef TMMParamCpp TmmParamFromStr(str paramStr):             # <<<<<<<<<<<<<<
 *     return paramDict[paramStr]
 * 
 */

static enum TMM::TMMParam __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(PyObject *__pyx_v_paramStr) {
  enum TMM::TMMParam __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  enum TMM::TMMParam __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("TmmParamFromStr", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":85
 * 
 * cdef TMMParamCpp TmmParamFromStr(str paramStr):
 *     return paramDict[paramStr]             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict, __pyx_v_paramStr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((enum TMM::TMMParam)__Pyx_PyInt_As_enum__TMM_3a__3a_TMMParam(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":84
 * 
 * 
 * cdef TMMParamCpp TmmParamFromStr(str paramStr):             # <<<<<<<<<<<<<<
 *     return paramDict[paramStr]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("NonlinearTMM._SecondOrderNLTMMCython.TmmParamFromStr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = (enum TMM::TMMParam) 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":102
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # This object is always allocated by Material class
 *         _thisptr = NULL
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self) {
  CYTHON_UNUSED void *__pyx_v__thisptr;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":104
 *     def __cinit__(self):
 *         # This object is always allocated by Material class
 *         _thisptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v__thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":102
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         # This object is always allocated by Material class
 *         _thisptr = NULL
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":106
 *         _thisptr = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # This object is always deallocated by Material class
 *         pass
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":110
 *         pass
 * 
 *     cdef _Init(self, Chi2TensorCpp* ptr, object parent):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._parent = parent # Avoid dealloc of parent
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, TMM::Chi2Tensor *__pyx_v_ptr, PyObject *__pyx_v_parent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":111
 * 
 *     cdef _Init(self, Chi2TensorCpp* ptr, object parent):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         self._parent = parent # Avoid dealloc of parent
 * 
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":112
 *     cdef _Init(self, Chi2TensorCpp* ptr, object parent):
 *         self._thisptr = ptr
 *         self._parent = parent # Avoid dealloc of parent             # <<<<<<<<<<<<<<
 * 
 *     def Update(self, **kwargs):
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(__pyx_v_self->_parent);
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":110
 *         pass
 * 
 *     cdef _Init(self, Chi2TensorCpp* ptr, object parent):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._parent = parent # Avoid dealloc of parent
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":114
 *         self._parent = parent # Avoid dealloc of parent
 * 
 *     def Update(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Update(**kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_5Update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_4Update[] = "Update(**kwargs)\n        \n        This method changes the values of second-order nonlinearity tensor. By\n        default the tensor is zero, not rotated and distinctFields set to True.\n        \n        Parameters\n        ----------\n        chiXYZ : float, optional\n            Updates tensor value of second-order nonlinearity, where X, Y, Z\n            denote numbers from 1..3 corresponding to x-, y-, z-axis.\n        dXK : float, optional\n            Updates tensor values by contracted notation, where dXK = 0.5 * chiXYZ\n            and K is defined as: 1 = 11; 2 = 22; 3 = 33; 4 = 23, 32; 5 = 31, 13; 6 = 12, 21.\n        distinctFields : bool, optional\n            If set to True, then assumes that two input waves in nonlinear process\n            are the same (e.g second harmonic generation). If False, then the\n            input fields are not equal (as a result the result will be multiplied by 2).\n            Default is true.\n        phiX : float, optional\n            The rotation angle (radians) around x-axis of the second order nonlinear tensor. \n        phiY : float, optional\n            The rotation angle (radians) around y-axis of the second order nonlinear tensor. \n        phiZ : float, optional\n            The rotation angle (radians) around z-axis of the second order nonlinear tensor.\n            \n        Examples\n        --------\n        Updates nonlinear tensor of material and then rotates it.\n        \n        >>> mat = Material.Static(1.5)\n        >>> mat.chi2.Update(d11 = 1e-12, d22 = 2e-12, chi23 = 3e-12)\n        >>> mat.chi2.Update(phiX = 0.2, phiY = 0.5, phiZ = -0.1)\n                 \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_5Update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Update (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("Update", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Update", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_4Update(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_4Update(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  int __pyx_v_i1;
  int __pyx_v_i2;
  int __pyx_v_i3;
  double __pyx_v_value;
  PyObject *__pyx_v_k = NULL;
  bool __pyx_v_distinctFields;
  double __pyx_v_phiX;
  double __pyx_v_phiY;
  double __pyx_v_phiZ;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  bool __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Update", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":153
 * 
 *         # d-values
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             if (not k.startswith("d")) or (len(k) != 3):
 *                 continue
 */
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 153, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":154
 *         # d-values
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("d")) or (len(k) != 3):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_k, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_d) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_d);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_4 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_9 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 154, __pyx_L1_error)
    __pyx_t_8 = ((__pyx_t_9 != 3) != 0);
    __pyx_t_4 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":155
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("d")) or (len(k) != 3):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             i1 = int(k[1])
 */
      goto __pyx_L3_continue;

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":154
 *         # d-values
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("d")) or (len(k) != 3):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":157
 *                 continue
 * 
 *             i1 = int(k[1])             # <<<<<<<<<<<<<<
 *             i2 = int(k[2])
 *             value = kwargs.pop(k)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_k, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_i1 = __pyx_t_10;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":158
 * 
 *             i1 = int(k[1])
 *             i2 = int(k[2])             # <<<<<<<<<<<<<<
 *             value = kwargs.pop(k)
 *             self._thisptr.SetD(i1, i2, value)
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_k, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_i2 = __pyx_t_10;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":159
 *             i1 = int(k[1])
 *             i2 = int(k[2])
 *             value = kwargs.pop(k)             # <<<<<<<<<<<<<<
 *             self._thisptr.SetD(i1, i2, value)
 * 
 */
    __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_v_k, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_value = __pyx_t_11;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":160
 *             i2 = int(k[2])
 *             value = kwargs.pop(k)
 *             self._thisptr.SetD(i1, i2, value)             # <<<<<<<<<<<<<<
 * 
 *         # chi2-values
 */
    try {
      __pyx_v_self->_thisptr->SetD(__pyx_v_i1, __pyx_v_i2, __pyx_v_value);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 160, __pyx_L1_error)
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":153
 * 
 *         # d-values
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             if (not k.startswith("d")) or (len(k) != 3):
 *                 continue
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":163
 * 
 *         # chi2-values
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             if (not k.startswith("chi")) or (len(k) != 6):
 *                 continue
 */
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":164
 *         # chi2-values
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("chi")) or (len(k) != 6):             # <<<<<<<<<<<<<<
 *                 continue
 *             i1 = int(k[3])
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_k, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_chi) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_chi);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((!__pyx_t_8) != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_4 = __pyx_t_7;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_9 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 164, __pyx_L1_error)
    __pyx_t_7 = ((__pyx_t_9 != 6) != 0);
    __pyx_t_4 = __pyx_t_7;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_4) {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":165
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("chi")) or (len(k) != 6):
 *                 continue             # <<<<<<<<<<<<<<
 *             i1 = int(k[3])
 *             i2 = int(k[4])
 */
      goto __pyx_L8_continue;

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":164
 *         # chi2-values
 *         for k in list(kwargs.keys()):
 *             if (not k.startswith("chi")) or (len(k) != 6):             # <<<<<<<<<<<<<<
 *                 continue
 *             i1 = int(k[3])
 */
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":166
 *             if (not k.startswith("chi")) or (len(k) != 6):
 *                 continue
 *             i1 = int(k[3])             # <<<<<<<<<<<<<<
 *             i2 = int(k[4])
 *             i3 = int(k[5])
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_k, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_i1 = __pyx_t_10;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":167
 *                 continue
 *             i1 = int(k[3])
 *             i2 = int(k[4])             # <<<<<<<<<<<<<<
 *             i3 = int(k[5])
 *             value = kwargs.pop(k)
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_k, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_i2 = __pyx_t_10;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":168
 *             i1 = int(k[3])
 *             i2 = int(k[4])
 *             i3 = int(k[5])             # <<<<<<<<<<<<<<
 *             value = kwargs.pop(k)
 *             self._thisptr.SetChi2(i1, i2, i3, value)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_k, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_i3 = __pyx_t_10;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":169
 *             i2 = int(k[4])
 *             i3 = int(k[5])
 *             value = kwargs.pop(k)             # <<<<<<<<<<<<<<
 *             self._thisptr.SetChi2(i1, i2, i3, value)
 * 
 */
    __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_v_k, ((PyObject *)NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_value = __pyx_t_11;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":170
 *             i3 = int(k[5])
 *             value = kwargs.pop(k)
 *             self._thisptr.SetChi2(i1, i2, i3, value)             # <<<<<<<<<<<<<<
 * 
 *         # Distinct fields
 */
    try {
      __pyx_v_self->_thisptr->SetChi2(__pyx_v_i1, __pyx_v_i2, __pyx_v_i3, __pyx_v_value);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 170, __pyx_L1_error)
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":163
 * 
 *         # chi2-values
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             if (not k.startswith("chi")) or (len(k) != 6):
 *                 continue
 */
    __pyx_L8_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":174
 *         # Distinct fields
 *         cdef bool distinctFields
 *         if "distinctFields" in kwargs:             # <<<<<<<<<<<<<<
 *             distinctFields = kwargs.pop("distinctFields")
 *             self._thisptr.SetDistinctFields(distinctFields)
 */
  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_distinctFields, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 174, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_4 != 0);
  if (__pyx_t_7) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":175
 *         cdef bool distinctFields
 *         if "distinctFields" in kwargs:
 *             distinctFields = kwargs.pop("distinctFields")             # <<<<<<<<<<<<<<
 *             self._thisptr.SetDistinctFields(distinctFields)
 * 
 */
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_distinctFields, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_12 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_distinctFields = __pyx_t_12;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":176
 *         if "distinctFields" in kwargs:
 *             distinctFields = kwargs.pop("distinctFields")
 *             self._thisptr.SetDistinctFields(distinctFields)             # <<<<<<<<<<<<<<
 * 
 *         # Phis (may generate exception if no phiY-Z available)
 */
    try {
      __pyx_v_self->_thisptr->SetDistinctFields(__pyx_v_distinctFields);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 176, __pyx_L1_error)
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":174
 *         # Distinct fields
 *         cdef bool distinctFields
 *         if "distinctFields" in kwargs:             # <<<<<<<<<<<<<<
 *             distinctFields = kwargs.pop("distinctFields")
 *             self._thisptr.SetDistinctFields(distinctFields)
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":180
 *         # Phis (may generate exception if no phiY-Z available)
 *         cdef double phiX, phiY, phiZ
 *         if "phiX" in kwargs:             # <<<<<<<<<<<<<<
 *             phiX = kwargs.pop("phiX")
 *             phiY = kwargs.pop("phiY")
 */
  __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_phiX, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_7 != 0);
  if (__pyx_t_4) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":181
 *         cdef double phiX, phiY, phiZ
 *         if "phiX" in kwargs:
 *             phiX = kwargs.pop("phiX")             # <<<<<<<<<<<<<<
 *             phiY = kwargs.pop("phiY")
 *             phiZ = kwargs.pop("phiZ")
 */
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_phiX, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_phiX = __pyx_t_11;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":182
 *         if "phiX" in kwargs:
 *             phiX = kwargs.pop("phiX")
 *             phiY = kwargs.pop("phiY")             # <<<<<<<<<<<<<<
 *             phiZ = kwargs.pop("phiZ")
 *             self._thisptr.SetRotation(phiX, phiY, phiZ)
 */
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_phiY, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_phiY = __pyx_t_11;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":183
 *             phiX = kwargs.pop("phiX")
 *             phiY = kwargs.pop("phiY")
 *             phiZ = kwargs.pop("phiZ")             # <<<<<<<<<<<<<<
 *             self._thisptr.SetRotation(phiX, phiY, phiZ)
 * 
 */
    __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_phiZ, ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_phiZ = __pyx_t_11;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":184
 *             phiY = kwargs.pop("phiY")
 *             phiZ = kwargs.pop("phiZ")
 *             self._thisptr.SetRotation(phiX, phiY, phiZ)             # <<<<<<<<<<<<<<
 * 
 *         # Errors
 */
    try {
      __pyx_v_self->_thisptr->SetRotation(__pyx_v_phiX, __pyx_v_phiY, __pyx_v_phiZ);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 184, __pyx_L1_error)
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":180
 *         # Phis (may generate exception if no phiY-Z available)
 *         cdef double phiX, phiY, phiZ
 *         if "phiX" in kwargs:             # <<<<<<<<<<<<<<
 *             phiX = kwargs.pop("phiX")
 *             phiY = kwargs.pop("phiY")
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":187
 * 
 *         # Errors
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             raise ValueError("Unknown kwarg %s" % (k))
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":188
 *         # Errors
 *         for k in list(kwargs.keys()):
 *             raise ValueError("Unknown kwarg %s" % (k))             # <<<<<<<<<<<<<<
 * 
 *     def GetChi2Tensor(self):
 */
    __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_kwarg_s, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 188, __pyx_L1_error)

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":187
 * 
 *         # Errors
 *         for k in list(kwargs.keys()):             # <<<<<<<<<<<<<<
 *             raise ValueError("Unknown kwarg %s" % (k))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":114
 *         self._parent = parent # Avoid dealloc of parent
 * 
 *     def Update(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Update(**kwargs)
 * 
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Chi2Tensor.Update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":190
 *             raise ValueError("Unknown kwarg %s" % (k))
 * 
 *     def GetChi2Tensor(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns rotated 3x3x3 second-order nonlinearity tensor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_7GetChi2Tensor(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_6GetChi2Tensor[] = "\n        Returns rotated 3x3x3 second-order nonlinearity tensor.\n        \n        Returns\n        -------\n        ndarray(3, 3, 3) of floats\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_7GetChi2Tensor(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetChi2Tensor (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_6GetChi2Tensor(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_6GetChi2Tensor(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_k;
  PyArrayObject *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetChi2Tensor", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":199
 *         """
 *         cdef int i, j, k
 *         cdef np.ndarray res = np.zeros([3, 3, 3], dtype = float)             # <<<<<<<<<<<<<<
 * 
 *         # Eigency currently doesn't support Tensors
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_3);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_v_res = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":202
 * 
 *         # Eigency currently doesn't support Tensors
 *         for i in range(3):             # <<<<<<<<<<<<<<
 *             for j in range(3):
 *                 for k in range(3):
 */
  for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":203
 *         # Eigency currently doesn't support Tensors
 *         for i in range(3):
 *             for j in range(3):             # <<<<<<<<<<<<<<
 *                 for k in range(3):
 *                     res[i, j, k] = self._thisptr.GetChi2Element(i + 1, j + 1, k + 1)
 */
    for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
      __pyx_v_j = __pyx_t_6;

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":204
 *         for i in range(3):
 *             for j in range(3):
 *                 for k in range(3):             # <<<<<<<<<<<<<<
 *                     res[i, j, k] = self._thisptr.GetChi2Element(i + 1, j + 1, k + 1)
 *         return res
 */
      for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
        __pyx_v_k = __pyx_t_7;

        /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":205
 *             for j in range(3):
 *                 for k in range(3):
 *                     res[i, j, k] = self._thisptr.GetChi2Element(i + 1, j + 1, k + 1)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
        try {
          __pyx_t_8 = __pyx_v_self->_thisptr->GetChi2Element((__pyx_v_i + 1), (__pyx_v_j + 1), (__pyx_v_k + 1));
        } catch(...) {
          __Pyx_CppExn2PyErr();
          __PYX_ERR(0, 205, __pyx_L1_error)
        }
        __pyx_t_4 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
        __pyx_t_1 = 0;
        __pyx_t_3 = 0;
        __pyx_t_2 = 0;
        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_res), __pyx_t_9, __pyx_t_4) < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":206
 *                 for k in range(3):
 *                     res[i, j, k] = self._thisptr.GetChi2Element(i + 1, j + 1, k + 1)
 *         return res             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":190
 *             raise ValueError("Unknown kwarg %s" % (k))
 * 
 *     def GetChi2Tensor(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns rotated 3x3x3 second-order nonlinearity tensor.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Chi2Tensor.GetChi2Tensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __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_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_8__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Chi2Tensor.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_10__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Chi2Tensor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":235
 *     cdef readonly object chi2
 * 
 *     def __cinit__(self, np.ndarray[double, ndim = 1] wls, np.ndarray[double complex, ndim = 1] ns):             # <<<<<<<<<<<<<<
 *         # Copy is made in c++
 *         self._thisptr = new MaterialCpp(Map[ArrayXd](wls), Map[ArrayXcd](ns))
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_wls = 0;
  PyArrayObject *__pyx_v_ns = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wls,&__pyx_n_s_ns,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 235, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 235, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_wls = ((PyArrayObject *)values[0]);
    __pyx_v_ns = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wls), __pyx_ptype_5numpy_ndarray, 1, "wls", 0))) __PYX_ERR(0, 235, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ns), __pyx_ptype_5numpy_ndarray, 1, "ns", 0))) __PYX_ERR(0, 235, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self), __pyx_v_wls, __pyx_v_ns);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyArrayObject *__pyx_v_wls, PyArrayObject *__pyx_v_ns) {
  TMM::Chi2Tensor *__pyx_v_chi2Ptr;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *__pyx_v_chi2 = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ns;
  __Pyx_Buffer __pyx_pybuffer_ns;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_wls;
  __Pyx_Buffer __pyx_pybuffer_wls;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  eigency::Map<Eigen::ArrayXd>  __pyx_t_1;
  eigency::Map<Eigen::ArrayXcd>  __pyx_t_2;
  TMM::Material *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __pyx_pybuffer_wls.pybuffer.buf = NULL;
  __pyx_pybuffer_wls.refcount = 0;
  __pyx_pybuffernd_wls.data = NULL;
  __pyx_pybuffernd_wls.rcbuffer = &__pyx_pybuffer_wls;
  __pyx_pybuffer_ns.pybuffer.buf = NULL;
  __pyx_pybuffer_ns.refcount = 0;
  __pyx_pybuffernd_ns.data = NULL;
  __pyx_pybuffernd_ns.rcbuffer = &__pyx_pybuffer_ns;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wls.rcbuffer->pybuffer, (PyObject*)__pyx_v_wls, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 235, __pyx_L1_error)
  }
  __pyx_pybuffernd_wls.diminfo[0].strides = __pyx_pybuffernd_wls.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wls.diminfo[0].shape = __pyx_pybuffernd_wls.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ns.rcbuffer->pybuffer, (PyObject*)__pyx_v_ns, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 235, __pyx_L1_error)
  }
  __pyx_pybuffernd_ns.diminfo[0].strides = __pyx_pybuffernd_ns.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ns.diminfo[0].shape = __pyx_pybuffernd_ns.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":237
 *     def __cinit__(self, np.ndarray[double, ndim = 1] wls, np.ndarray[double complex, ndim = 1] ns):
 *         # Copy is made in c++
 *         self._thisptr = new MaterialCpp(Map[ArrayXd](wls), Map[ArrayXcd](ns))             # <<<<<<<<<<<<<<
 * 
 *         cdef Chi2TensorCpp *chi2Ptr = &self._thisptr.chi2
 */
  try {
    __pyx_t_1 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_wls));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 237, __pyx_L1_error)
  }
  try {
    __pyx_t_2 = eigency::Map<Eigen::ArrayXcd> (((PyArrayObject *)__pyx_v_ns));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 237, __pyx_L1_error)
  }
  try {
    __pyx_t_3 = new TMM::Material(__pyx_t_1, __pyx_t_2);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 237, __pyx_L1_error)
  }
  __pyx_v_self->_thisptr = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":239
 *         self._thisptr = new MaterialCpp(Map[ArrayXd](wls), Map[ArrayXcd](ns))
 * 
 *         cdef Chi2TensorCpp *chi2Ptr = &self._thisptr.chi2             # <<<<<<<<<<<<<<
 *         chi2 = _Chi2Tensor()
 *         chi2._Init(chi2Ptr, self) # This class is passed as parent (avoids dealloc before chi2)
 */
  __pyx_v_chi2Ptr = (&__pyx_v_self->_thisptr->chi2);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":240
 * 
 *         cdef Chi2TensorCpp *chi2Ptr = &self._thisptr.chi2
 *         chi2 = _Chi2Tensor()             # <<<<<<<<<<<<<<
 *         chi2._Init(chi2Ptr, self) # This class is passed as parent (avoids dealloc before chi2)
 *         self.chi2 = chi2
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_chi2 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":241
 *         cdef Chi2TensorCpp *chi2Ptr = &self._thisptr.chi2
 *         chi2 = _Chi2Tensor()
 *         chi2._Init(chi2Ptr, self) # This class is passed as parent (avoids dealloc before chi2)             # <<<<<<<<<<<<<<
 *         self.chi2 = chi2
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)__pyx_v_chi2->__pyx_vtab)->_Init(__pyx_v_chi2, __pyx_v_chi2Ptr, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":242
 *         chi2 = _Chi2Tensor()
 *         chi2._Init(chi2Ptr, self) # This class is passed as parent (avoids dealloc before chi2)
 *         self.chi2 = chi2             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_chi2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chi2));
  __Pyx_GOTREF(__pyx_v_self->chi2);
  __Pyx_DECREF(__pyx_v_self->chi2);
  __pyx_v_self->chi2 = ((PyObject *)__pyx_v_chi2);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":235
 *     cdef readonly object chi2
 * 
 *     def __cinit__(self, np.ndarray[double, ndim = 1] wls, np.ndarray[double complex, ndim = 1] ns):             # <<<<<<<<<<<<<<
 *         # Copy is made in c++
 *         self._thisptr = new MaterialCpp(Map[ArrayXd](wls), Map[ArrayXcd](ns))
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  { 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_ns.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wls.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ns.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wls.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_chi2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":244
 *         self.chi2 = chi2
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":245
 * 
 *     def __dealloc__(self):
 *         del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, wl): # For compatibility
 */
  delete __pyx_v_self->_thisptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":244
 *         self.chi2 = chi2
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":247
 *         del self._thisptr
 * 
 *     def __call__(self, wl): # For compatibility             # <<<<<<<<<<<<<<
 *         return self.GetN(wl)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_wl = 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);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wl,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wl)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 247, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_wl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 247, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4__call__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self), __pyx_v_wl);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4__call__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyObject *__pyx_v_wl) {
  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);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":248
 * 
 *     def __call__(self, wl): # For compatibility
 *         return self.GetN(wl)             # <<<<<<<<<<<<<<
 * 
 *     def GetN(self, wl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_GetN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_wl) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_wl);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __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;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":247
 *         del self._thisptr
 * 
 *     def __call__(self, wl): # For compatibility             # <<<<<<<<<<<<<<
 *         return self.GetN(wl)
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":250
 *         return self.GetN(wl)
 * 
 *     def GetN(self, wl):             # <<<<<<<<<<<<<<
 *         """GetN(wl)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_7GetN(PyObject *__pyx_v_self, PyObject *__pyx_v_wl); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_6GetN[] = "GetN(wl)\n        \n        Returns refractive index of material at specified wavelength.\n        \n        Parameters\n        ----------\n        wl : float\n            Wavelength in meters.\n        \n        Returns\n        -------\n        complex\n            Complex refractive index at wavelength wl.\n        \n        Examples\n        --------\n        >>> wls = np.array([400e-9, 600e-9, 800e-9], dtype = float)\n        >>> ns = np.array([1.5 + 0.3j, 1.7 + 0.2j, 1.8 + 0.1j], dtype = complex)\n        >>> mat = Material(wls, ns)\n        >>> mat(600e-9)\n        1.7 + 0.2j\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_7GetN(PyObject *__pyx_v_self, PyObject *__pyx_v_wl) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetN (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_6GetN(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self), ((PyObject *)__pyx_v_wl));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_6GetN(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, PyObject *__pyx_v_wl) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __pyx_t_double_complex __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetN", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":274
 * 
 *         """
 *         return self._thisptr.GetN(wl)             # <<<<<<<<<<<<<<
 * 
 *     def IsNonlinear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_wl); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetN(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 274, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":250
 *         return self.GetN(wl)
 * 
 *     def GetN(self, wl):             # <<<<<<<<<<<<<<
 *         """GetN(wl)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.GetN", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":276
 *         return self._thisptr.GetN(wl)
 * 
 *     def IsNonlinear(self):             # <<<<<<<<<<<<<<
 *         """IsNonlinear()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_9IsNonlinear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_8IsNonlinear[] = "IsNonlinear()\n        \n        This method returns True if material nonlinearity tensor :any:`chi2` is nonzero,\n        False otherwise.\n        \n        Returns\n        -------\n        bool\n            True if chi2 tensor is nonzero, False otherwise.\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_9IsNonlinear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("IsNonlinear (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_8IsNonlinear(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_8IsNonlinear(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("IsNonlinear", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":287
 *             True if chi2 tensor is nonzero, False otherwise.
 *         """
 *         return self._thisptr.IsNonlinear()             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->IsNonlinear();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 287, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":276
 *         return self._thisptr.GetN(wl)
 * 
 *     def IsNonlinear(self):             # <<<<<<<<<<<<<<
 *         """IsNonlinear()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.IsNonlinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":233
 *     """
 *     cdef MaterialCpp *_thisptr
 *     cdef readonly object chi2             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, np.ndarray[double, ndim = 1] wls, np.ndarray[double complex, ndim = 1] ns):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->chi2);
  __pyx_r = __pyx_v_self->chi2;
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_10__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_12__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.Material.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":375
 *     cdef bool _needsDealloc;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         self._needsDealloc = False;
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":376
 * 
 *     def __cinit__(self):
 *         self._thisptr = NULL             # <<<<<<<<<<<<<<
 *         self._needsDealloc = False;
 * 
 */
  __pyx_v_self->_thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":377
 *     def __cinit__(self):
 *         self._thisptr = NULL
 *         self._needsDealloc = False;             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, WaveCpp *ptr):
 */
  __pyx_v_self->_needsDealloc = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":375
 *     cdef bool _needsDealloc;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         self._needsDealloc = False;
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":379
 *         self._needsDealloc = False;
 * 
 *     cdef _Init(self, WaveCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needsDealloc = False
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, TMM::Wave *__pyx_v_ptr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":380
 * 
 *     cdef _Init(self, WaveCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         self._needsDealloc = False
 * 
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":381
 *     cdef _Init(self, WaveCpp *ptr):
 *         self._thisptr = ptr
 *         self._needsDealloc = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_needsDealloc = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":379
 *         self._needsDealloc = False;
 * 
 *     cdef _Init(self, WaveCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needsDealloc = False
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":383
 *         self._needsDealloc = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needsDealloc:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":384
 * 
 *     def __dealloc__(self):
 *         if self._needsDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_needsDealloc != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":385
 *     def __dealloc__(self):
 *         if self._needsDealloc:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     def SetParams(self, **kwargs):
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":384
 * 
 *     def __dealloc__(self):
 *         if self._needsDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":383
 *         self._needsDealloc = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needsDealloc:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":387
 *             del self._thisptr
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4SetParams[] = "SetParams(**kwargs)\n        \n        Helper method to set all the attributes of the class.\n        \n        Returns \n        -------\n        None\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SetParams (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("SetParams", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "SetParams", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4SetParams(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SetParams", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":398
 *         """
 * 
 *         for name, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if name not in waveParamsSet:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":399
 * 
 *         for name, value in kwargs.iteritems():
 *             if name not in waveParamsSet:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_waveParamsSet, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (unlikely(__pyx_t_9)) {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":400
 *         for name, value in kwargs.iteritems():
 *             if name not in waveParamsSet:
 *                 raise ValueError("Unknown kwarg %s" % (name))             # <<<<<<<<<<<<<<
 *             setattr(self, name, value)
 * 
 */
      __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_kwarg_s, __pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 400, __pyx_L1_error)

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":399
 * 
 *         for name, value in kwargs.iteritems():
 *             if name not in waveParamsSet:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":401
 *             if name not in waveParamsSet:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)             # <<<<<<<<<<<<<<
 * 
 *     # Getters
 */
    __pyx_t_10 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 401, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":387
 *             del self._thisptr
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.SetParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":407
 * 
 *     @property
 *     def waveType(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType___get__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__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);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":408
 *     @property
 *     def waveType(self):
 *         raise NotImplementedError()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __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, 408, __pyx_L1_error)

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":407
 * 
 *     @property
 *     def waveType(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.waveType.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":498
 * 
 *     @waveType.setter
 *     def waveType(self, str waveTypeStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetWaveType(WaveTypeFromStr(waveTypeStr))
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_waveTypeStr); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_waveTypeStr) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_waveTypeStr), (&PyString_Type), 1, "waveTypeStr", 1))) __PYX_ERR(0, 498, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((PyObject*)__pyx_v_waveTypeStr));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, PyObject *__pyx_v_waveTypeStr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":499
 *     @waveType.setter
 *     def waveType(self, str waveTypeStr):  # @DuplicatedSignature
 *         self._thisptr.SetWaveType(WaveTypeFromStr(waveTypeStr))             # <<<<<<<<<<<<<<
 * 
 *     @pwr.setter
 */
  try {
    __pyx_v_self->_thisptr->SetWaveType(__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveTypeFromStr(__pyx_v_waveTypeStr));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 499, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":498
 * 
 *     @waveType.setter
 *     def waveType(self, str waveTypeStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetWaveType(WaveTypeFromStr(waveTypeStr))
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.waveType.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":411
 * 
 *     @property
 *     def pwr(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetPwr()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":412
 *     @property
 *     def pwr(self):
 *         return self._thisptr.GetPwr()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetPwr();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 412, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":411
 * 
 *     @property
 *     def pwr(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetPwr()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.pwr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":502
 * 
 *     @pwr.setter
 *     def pwr(self, double value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetPwr(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.pwr.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":503
 *     @pwr.setter
 *     def pwr(self, double value):  # @DuplicatedSignature
 *         self._thisptr.SetPwr(value)             # <<<<<<<<<<<<<<
 * 
 *     @overrideE0.setter
 */
  try {
    __pyx_v_self->_thisptr->SetPwr(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 503, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":502
 * 
 *     @pwr.setter
 *     def pwr(self, double value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetPwr(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.pwr.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":415
 * 
 *     @property
 *     def overrideE0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetOverrideE0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":416
 *     @property
 *     def overrideE0(self):
 *         return self._thisptr.GetOverrideE0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetOverrideE0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 416, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":415
 * 
 *     @property
 *     def overrideE0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetOverrideE0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.overrideE0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":506
 * 
 *     @overrideE0.setter
 *     def overrideE0(self, bool value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetOverrideE0(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  bool __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 506, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.overrideE0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((bool)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, bool __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":507
 *     @overrideE0.setter
 *     def overrideE0(self, bool value): # @DuplicatedSignature
 *         self._thisptr.SetOverrideE0(value)             # <<<<<<<<<<<<<<
 * 
 *     @E0.setter
 */
  try {
    __pyx_v_self->_thisptr->SetOverrideE0(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 507, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":506
 * 
 *     @overrideE0.setter
 *     def overrideE0(self, bool value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetOverrideE0(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.overrideE0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":419
 * 
 *     @property
 *     def E0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetE0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":420
 *     @property
 *     def E0(self):
 *         return self._thisptr.GetE0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetE0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 420, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":419
 * 
 *     @property
 *     def E0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetE0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.E0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":510
 * 
 *     @E0.setter
 *     def E0(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetE0(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.E0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":511
 *     @E0.setter
 *     def E0(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetE0(value)             # <<<<<<<<<<<<<<
 * 
 *     @w0.setter
 */
  try {
    __pyx_v_self->_thisptr->SetE0(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 511, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":510
 * 
 *     @E0.setter
 *     def E0(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetE0(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.E0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":423
 * 
 *     @property
 *     def w0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetW0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":424
 *     @property
 *     def w0(self):
 *         return self._thisptr.GetW0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetW0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 424, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":423
 * 
 *     @property
 *     def w0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetW0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.w0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":514
 * 
 *     @w0.setter
 *     def w0(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetW0(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 514, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.w0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":515
 *     @w0.setter
 *     def w0(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetW0(value)             # <<<<<<<<<<<<<<
 * 
 *     @Ly.setter
 */
  try {
    __pyx_v_self->_thisptr->SetW0(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 515, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":514
 * 
 *     @w0.setter
 *     def w0(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetW0(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.w0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":427
 * 
 *     @property
 *     def Ly(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetLy()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":428
 *     @property
 *     def Ly(self):
 *         return self._thisptr.GetLy()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetLy();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 428, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":427
 * 
 *     @property
 *     def Ly(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetLy()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.Ly.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":518
 * 
 *     @Ly.setter
 *     def Ly(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetLy(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.Ly.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":519
 *     @Ly.setter
 *     def Ly(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetLy(value)             # <<<<<<<<<<<<<<
 * 
 *     @a.setter
 */
  try {
    __pyx_v_self->_thisptr->SetLy(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 519, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":518
 * 
 *     @Ly.setter
 *     def Ly(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetLy(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.Ly.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":431
 * 
 *     @property
 *     def a(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetA()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":432
 *     @property
 *     def a(self):
 *         return self._thisptr.GetA()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetA();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 432, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":431
 * 
 *     @property
 *     def a(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetA()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":522
 * 
 *     @a.setter
 *     def a(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetA(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":523
 *     @a.setter
 *     def a(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetA(value)             # <<<<<<<<<<<<<<
 * 
 *     @nPointsInteg.setter
 */
  try {
    __pyx_v_self->_thisptr->SetA(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 523, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":522
 * 
 *     @a.setter
 *     def a(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetA(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":435
 * 
 *     @property
 *     def nPointsInteg(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetNPointsInteg()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  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__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":436
 *     @property
 *     def nPointsInteg(self):
 *         return self._thisptr.GetNPointsInteg()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetNPointsInteg();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 436, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":435
 * 
 *     @property
 *     def nPointsInteg(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetNPointsInteg()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.nPointsInteg.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":526
 * 
 *     @nPointsInteg.setter
 *     def nPointsInteg(self, int value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetNPointsInteg(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.nPointsInteg.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((int)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, int __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":527
 *     @nPointsInteg.setter
 *     def nPointsInteg(self, int value): # @DuplicatedSignature
 *         self._thisptr.SetNPointsInteg(value)             # <<<<<<<<<<<<<<
 * 
 *     @maxX.setter
 */
  try {
    __pyx_v_self->_thisptr->SetNPointsInteg(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 527, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":526
 * 
 *     @nPointsInteg.setter
 *     def nPointsInteg(self, int value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetNPointsInteg(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.nPointsInteg.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":439
 * 
 *     @property
 *     def maxX(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetMaxX()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":440
 *     @property
 *     def maxX(self):
 *         return self._thisptr.GetMaxX()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetMaxX();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 440, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":439
 * 
 *     @property
 *     def maxX(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetMaxX()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxX.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":530
 * 
 *     @maxX.setter
 *     def maxX(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMaxX(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxX.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":531
 *     @maxX.setter
 *     def maxX(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetMaxX(value)             # <<<<<<<<<<<<<<
 * 
 *     @dynamicMaxX.setter
 */
  try {
    __pyx_v_self->_thisptr->SetMaxX(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 531, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":530
 * 
 *     @maxX.setter
 *     def maxX(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMaxX(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxX.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":443
 * 
 *     @property
 *     def dynamicMaxX(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.IsDynamicMaxXEnabled()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":444
 *     @property
 *     def dynamicMaxX(self):
 *         return self._thisptr.IsDynamicMaxXEnabled()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->IsDynamicMaxXEnabled();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 444, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":443
 * 
 *     @property
 *     def dynamicMaxX(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.IsDynamicMaxXEnabled()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxX.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":534
 * 
 *     @dynamicMaxX.setter
 *     def dynamicMaxX(self, bool value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.EnableDynamicMaxX(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  bool __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 534, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxX.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((bool)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, bool __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":535
 *     @dynamicMaxX.setter
 *     def dynamicMaxX(self, bool value): # @DuplicatedSignature
 *         self._thisptr.EnableDynamicMaxX(value)             # <<<<<<<<<<<<<<
 * 
 *     @dynamicMaxXCoef.setter
 */
  try {
    __pyx_v_self->_thisptr->EnableDynamicMaxX(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 535, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":534
 * 
 *     @dynamicMaxX.setter
 *     def dynamicMaxX(self, bool value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.EnableDynamicMaxX(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxX.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":447
 * 
 *     @property
 *     def dynamicMaxXCoef(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDynamicMaxXCoef()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":448
 *     @property
 *     def dynamicMaxXCoef(self):
 *         return self._thisptr.GetDynamicMaxXCoef()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetDynamicMaxXCoef();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 448, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":447
 * 
 *     @property
 *     def dynamicMaxXCoef(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDynamicMaxXCoef()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXCoef.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":538
 * 
 *     @dynamicMaxXCoef.setter
 *     def dynamicMaxXCoef(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDynamicMaxXCoef(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 538, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXCoef.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":539
 *     @dynamicMaxXCoef.setter
 *     def dynamicMaxXCoef(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetDynamicMaxXCoef(value)             # <<<<<<<<<<<<<<
 * 
 *     @dynamicMaxXAddition.setter
 */
  try {
    __pyx_v_self->_thisptr->SetDynamicMaxXCoef(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 539, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":538
 * 
 *     @dynamicMaxXCoef.setter
 *     def dynamicMaxXCoef(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDynamicMaxXCoef(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXCoef.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":451
 * 
 *     @property
 *     def dynamicMaxXAddition(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDynamicMaxXAddition()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":452
 *     @property
 *     def dynamicMaxXAddition(self):
 *         return self._thisptr.GetDynamicMaxXAddition()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetDynamicMaxXAddition();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 452, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":451
 * 
 *     @property
 *     def dynamicMaxXAddition(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDynamicMaxXAddition()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXAddition.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":542
 * 
 *     @dynamicMaxXAddition.setter
 *     def dynamicMaxXAddition(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDynamicMaxXAddition(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXAddition.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":543
 *     @dynamicMaxXAddition.setter
 *     def dynamicMaxXAddition(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetDynamicMaxXAddition(value)             # <<<<<<<<<<<<<<
 * 
 *     @maxPhi.setter
 */
  try {
    __pyx_v_self->_thisptr->SetDynamicMaxXAddition(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 543, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":542
 * 
 *     @dynamicMaxXAddition.setter
 *     def dynamicMaxXAddition(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDynamicMaxXAddition(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.dynamicMaxXAddition.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":455
 * 
 *     @property
 *     def maxPhi(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetMaxPhi()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":456
 *     @property
 *     def maxPhi(self):
 *         return self._thisptr.GetMaxPhi()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetMaxPhi();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 456, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":455
 * 
 *     @property
 *     def maxPhi(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetMaxPhi()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxPhi.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":546
 * 
 *     @maxPhi.setter
 *     def maxPhi(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMaxPhi(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxPhi.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":547
 *     @maxPhi.setter
 *     def maxPhi(self, double value): # @DuplicatedSignature
 *         self._thisptr.SetMaxPhi(value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  try {
    __pyx_v_self->_thisptr->SetMaxPhi(__pyx_v_value);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 547, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":546
 * 
 *     @maxPhi.setter
 *     def maxPhi(self, double value): # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMaxPhi(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.maxPhi.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":459
 * 
 *     @property
 *     def xRange(self):             # <<<<<<<<<<<<<<
 *         cdef pair[double, double] r = self._thisptr.GetXRange()
 *         return (r.first, r.second)
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  std::pair<double,double>  __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::pair<double,double>  __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":460
 *     @property
 *     def xRange(self):
 *         cdef pair[double, double] r = self._thisptr.GetXRange()             # <<<<<<<<<<<<<<
 *         return (r.first, r.second)
 * 
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetXRange();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 460, __pyx_L1_error)
  }
  __pyx_v_r = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":461
 *     def xRange(self):
 *         cdef pair[double, double] r = self._thisptr.GetXRange()
 *         return (r.first, r.second)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_r.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_r.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":459
 * 
 *     @property
 *     def xRange(self):             # <<<<<<<<<<<<<<
 *         cdef pair[double, double] r = self._thisptr.GetXRange()
 *         return (r.first, r.second)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.xRange.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":464
 * 
 *     @property
 *     def betas(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetBetas()).squeeze()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":465
 *     @property
 *     def betas(self):
 *         return ndarray_copy(self._thisptr.GetBetas()).squeeze()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetBetas();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 465, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":464
 * 
 *     @property
 *     def betas(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetBetas()).squeeze()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.betas.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":468
 * 
 *     @property
 *     def phis(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetPhis()).squeeze()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":469
 *     @property
 *     def phis(self):
 *         return ndarray_copy(self._thisptr.GetPhis()).squeeze()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetPhis();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 469, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":468
 * 
 *     @property
 *     def phis(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetPhis()).squeeze()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.phis.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":472
 * 
 *     @property
 *     def kxs(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetKxs()).squeeze()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":473
 *     @property
 *     def kxs(self):
 *         return ndarray_copy(self._thisptr.GetKxs()).squeeze()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetKxs();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 473, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":472
 * 
 *     @property
 *     def kxs(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetKxs()).squeeze()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.kxs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":476
 * 
 *     @property
 *     def kzs(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetKzs()).squeeze()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":477
 *     @property
 *     def kzs(self):
 *         return ndarray_copy(self._thisptr.GetKzs()).squeeze()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetKzs();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 477, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":476
 * 
 *     @property
 *     def kzs(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetKzs()).squeeze()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.kzs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":480
 * 
 *     @property
 *     def fieldProfile(self):             # <<<<<<<<<<<<<<
 *         xs = ndarray_copy(self._thisptr.GetFieldProfileXs()).squeeze()
 *         fieldProfile = ndarray_copy(self._thisptr.GetFieldProfile()).squeeze()
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_v_xs = NULL;
  PyObject *__pyx_v_fieldProfile = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":481
 *     @property
 *     def fieldProfile(self):
 *         xs = ndarray_copy(self._thisptr.GetFieldProfileXs()).squeeze()             # <<<<<<<<<<<<<<
 *         fieldProfile = ndarray_copy(self._thisptr.GetFieldProfile()).squeeze()
 *         return xs, fieldProfile
 */
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetFieldProfileXs();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 481, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_xs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":482
 *     def fieldProfile(self):
 *         xs = ndarray_copy(self._thisptr.GetFieldProfileXs()).squeeze()
 *         fieldProfile = ndarray_copy(self._thisptr.GetFieldProfile()).squeeze()             # <<<<<<<<<<<<<<
 *         return xs, fieldProfile
 * 
 */
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetFieldProfile();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 482, __pyx_L1_error)
  }
  __pyx_t_4 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_fieldProfile = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":483
 *         xs = ndarray_copy(self._thisptr.GetFieldProfileXs()).squeeze()
 *         fieldProfile = ndarray_copy(self._thisptr.GetFieldProfile()).squeeze()
 *         return xs, fieldProfile             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_xs);
  __Pyx_GIVEREF(__pyx_v_xs);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xs);
  __Pyx_INCREF(__pyx_v_fieldProfile);
  __Pyx_GIVEREF(__pyx_v_fieldProfile);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_fieldProfile);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":480
 * 
 *     @property
 *     def fieldProfile(self):             # <<<<<<<<<<<<<<
 *         xs = ndarray_copy(self._thisptr.GetFieldProfileXs()).squeeze()
 *         fieldProfile = ndarray_copy(self._thisptr.GetFieldProfile()).squeeze()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.fieldProfile.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xs);
  __Pyx_XDECREF(__pyx_v_fieldProfile);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":486
 * 
 *     @property
 *     def expansionCoefsKx(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetExpansionCoefsKx()).squeeze()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Eigen::ArrayXcd __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("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":487
 *     @property
 *     def expansionCoefsKx(self):
 *         return ndarray_copy(self._thisptr.GetExpansionCoefsKx()).squeeze()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetExpansionCoefsKx();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 487, __pyx_L1_error)
  }
  __pyx_t_3 = ((PyObject *)eigency::ndarray_copy(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":486
 * 
 *     @property
 *     def expansionCoefsKx(self):             # <<<<<<<<<<<<<<
 *         return ndarray_copy(self._thisptr.GetExpansionCoefsKx()).squeeze()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.expansionCoefsKx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":490
 * 
 *     @property
 *     def beamArea(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetBeamArea()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":491
 *     @property
 *     def beamArea(self):
 *         return self._thisptr.GetBeamArea()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetBeamArea();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 491, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":490
 * 
 *     @property
 *     def beamArea(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetBeamArea()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.beamArea.__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):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Wave.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":577
 *     cdef readonly double I, R, T
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":580
 *         pass
 * 
 *     cdef _Init(self, IntensitiesCpp *ptr):             # <<<<<<<<<<<<<<
 *         self.inc = ptr.inc
 *         self.r = ptr.r
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self, TMM::Intensities *__pyx_v_ptr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __pyx_t_double_complex __pyx_t_1;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":581
 * 
 *     cdef _Init(self, IntensitiesCpp *ptr):
 *         self.inc = ptr.inc             # <<<<<<<<<<<<<<
 *         self.r = ptr.r
 *         self.t = ptr.t
 */
  __pyx_t_1 = __pyx_v_ptr->inc;
  __pyx_v_self->inc = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":582
 *     cdef _Init(self, IntensitiesCpp *ptr):
 *         self.inc = ptr.inc
 *         self.r = ptr.r             # <<<<<<<<<<<<<<
 *         self.t = ptr.t
 *         self.I = ptr.I
 */
  __pyx_t_1 = __pyx_v_ptr->r;
  __pyx_v_self->r = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":583
 *         self.inc = ptr.inc
 *         self.r = ptr.r
 *         self.t = ptr.t             # <<<<<<<<<<<<<<
 *         self.I = ptr.I
 *         self.R = ptr.R
 */
  __pyx_t_1 = __pyx_v_ptr->t;
  __pyx_v_self->t = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":584
 *         self.r = ptr.r
 *         self.t = ptr.t
 *         self.I = ptr.I             # <<<<<<<<<<<<<<
 *         self.R = ptr.R
 *         self.T = ptr.T
 */
  __pyx_t_2 = __pyx_v_ptr->I;
  __pyx_v_self->I = __pyx_t_2;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":585
 *         self.t = ptr.t
 *         self.I = ptr.I
 *         self.R = ptr.R             # <<<<<<<<<<<<<<
 *         self.T = ptr.T
 * 
 */
  __pyx_t_2 = __pyx_v_ptr->R;
  __pyx_v_self->R = __pyx_t_2;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":586
 *         self.I = ptr.I
 *         self.R = ptr.R
 *         self.T = ptr.T             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __pyx_t_2 = __pyx_v_ptr->T;
  __pyx_v_self->T = __pyx_t_2;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":580
 *         pass
 * 
 *     cdef _Init(self, IntensitiesCpp *ptr):             # <<<<<<<<<<<<<<
 *         self.inc = ptr.inc
 *         self.r = ptr.r
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":574
 * 
 *     """
 *     cdef readonly double complex inc, r, t             # <<<<<<<<<<<<<<
 *     cdef readonly double I, R, T
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_self->inc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.inc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_self->r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.r.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_self->t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.t.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":575
 *     """
 *     cdef readonly double complex inc, r, t
 *     cdef readonly double I, R, T             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->I); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.I.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->R); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.R.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->T); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.T.__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):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_2__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_4__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._Intensities.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":622
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._needDealloc = False
 *         pass
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":623
 * 
 *     def __cinit__(self):
 *         self._needDealloc = False             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_v_self->_needDealloc = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":622
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._needDealloc = False
 *         pass
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":626
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":627
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_needDealloc != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":628
 *     def __dealloc__(self):
 *         if self._needDealloc:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":627
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":626
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":630
 *             del self._thisptr
 * 
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self, TMM::SweepResultNonlinearTMM *__pyx_v_ptr, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init *__pyx_optional_args) {
  bool __pyx_v_needDealloc = ((bool)1);
  PyObject *__pyx_v_parent = ((PyObject *)Py_None);
  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("_Init", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_needDealloc = __pyx_optional_args->needDealloc;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_parent = __pyx_optional_args->parent;
      }
    }
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":631
 * 
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         self._needDealloc = needDealloc
 *         self._parent = parent # To avoid dealloc of parent before this
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":632
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc             # <<<<<<<<<<<<<<
 *         self._parent = parent # To avoid dealloc of parent before this
 * 
 */
  __pyx_v_self->_needDealloc = __pyx_v_needDealloc;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":633
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 *         self._parent = parent # To avoid dealloc of parent before this             # <<<<<<<<<<<<<<
 * 
 *         self.inc = ndarray_view(self._thisptr.inc).squeeze()
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(__pyx_v_self->_parent);
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":635
 *         self._parent = parent # To avoid dealloc of parent before this
 * 
 *         self.inc = ndarray_view(self._thisptr.inc).squeeze()             # <<<<<<<<<<<<<<
 *         self.r = ndarray_view(self._thisptr.r).squeeze()
 *         self.t = ndarray_view(self._thisptr.t).squeeze()
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->inc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->inc);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->inc));
  __pyx_v_self->inc = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":636
 * 
 *         self.inc = ndarray_view(self._thisptr.inc).squeeze()
 *         self.r = ndarray_view(self._thisptr.r).squeeze()             # <<<<<<<<<<<<<<
 *         self.t = ndarray_view(self._thisptr.t).squeeze()
 *         self.Ii = ndarray_view(self._thisptr.Ii).squeeze()
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->r)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->r);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->r));
  __pyx_v_self->r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":637
 *         self.inc = ndarray_view(self._thisptr.inc).squeeze()
 *         self.r = ndarray_view(self._thisptr.r).squeeze()
 *         self.t = ndarray_view(self._thisptr.t).squeeze()             # <<<<<<<<<<<<<<
 *         self.Ii = ndarray_view(self._thisptr.Ii).squeeze()
 *         self.Ir = ndarray_view(self._thisptr.Ir).squeeze()
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->t)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->t);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->t));
  __pyx_v_self->t = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":638
 *         self.r = ndarray_view(self._thisptr.r).squeeze()
 *         self.t = ndarray_view(self._thisptr.t).squeeze()
 *         self.Ii = ndarray_view(self._thisptr.Ii).squeeze()             # <<<<<<<<<<<<<<
 *         self.Ir = ndarray_view(self._thisptr.Ir).squeeze()
 *         self.It = ndarray_view(self._thisptr.It).squeeze()
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ii)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Ii);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Ii));
  __pyx_v_self->Ii = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":639
 *         self.t = ndarray_view(self._thisptr.t).squeeze()
 *         self.Ii = ndarray_view(self._thisptr.Ii).squeeze()
 *         self.Ir = ndarray_view(self._thisptr.Ir).squeeze()             # <<<<<<<<<<<<<<
 *         self.It = ndarray_view(self._thisptr.It).squeeze()
 *         self.Ia = ndarray_view(self._thisptr.Ia).squeeze()
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ir)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Ir);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Ir));
  __pyx_v_self->Ir = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":640
 *         self.Ii = ndarray_view(self._thisptr.Ii).squeeze()
 *         self.Ir = ndarray_view(self._thisptr.Ir).squeeze()
 *         self.It = ndarray_view(self._thisptr.It).squeeze()             # <<<<<<<<<<<<<<
 *         self.Ia = ndarray_view(self._thisptr.Ia).squeeze()
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->It)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->It);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->It));
  __pyx_v_self->It = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":641
 *         self.Ir = ndarray_view(self._thisptr.Ir).squeeze()
 *         self.It = ndarray_view(self._thisptr.It).squeeze()
 *         self.Ia = ndarray_view(self._thisptr.Ia).squeeze()             # <<<<<<<<<<<<<<
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()
 * 
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ia)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Ia);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Ia));
  __pyx_v_self->Ia = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":642
 *         self.It = ndarray_view(self._thisptr.It).squeeze()
 *         self.Ia = ndarray_view(self._thisptr.Ia).squeeze()
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->enh)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->enh);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->enh));
  __pyx_v_self->enh = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":630
 *             del self._thisptr
 * 
 *     cdef _Init(self, SweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */

  /* 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("NonlinearTMM._SecondOrderNLTMMCython._SweepResultNonlinearTMM._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":617
 *     """
 *     cdef SweepResultNonlinearTMMCpp *_thisptr
 *     cdef readonly np.ndarray inc, r, t             # <<<<<<<<<<<<<<
 *     cdef readonly np.ndarray Ii, Ir, It, Ia, enh
 *     cdef bool _needDealloc;
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->inc));
  __pyx_r = ((PyObject *)__pyx_v_self->inc);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->r));
  __pyx_r = ((PyObject *)__pyx_v_self->r);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->t));
  __pyx_r = ((PyObject *)__pyx_v_self->t);
  goto __pyx_L0;

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":618
 *     cdef SweepResultNonlinearTMMCpp *_thisptr
 *     cdef readonly np.ndarray inc, r, t
 *     cdef readonly np.ndarray Ii, Ir, It, Ia, enh             # <<<<<<<<<<<<<<
 *     cdef bool _needDealloc;
 *     cdef object _parent;
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ii));
  __pyx_r = ((PyObject *)__pyx_v_self->Ii);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ir));
  __pyx_r = ((PyObject *)__pyx_v_self->Ir);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->It));
  __pyx_r = ((PyObject *)__pyx_v_self->It);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ia));
  __pyx_r = ((PyObject *)__pyx_v_self->Ia);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->enh));
  __pyx_r = ((PyObject *)__pyx_v_self->enh);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SweepResultNonlinearTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SweepResultNonlinearTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":672
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._needDealloc = False
 *         pass
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":673
 * 
 *     def __cinit__(self):
 *         self._needDealloc = False             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_v_self->_needDealloc = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":672
 *     cdef object _parent;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._needDealloc = False
 *         pass
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":676
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":677
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_needDealloc != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":678
 *     def __dealloc__(self):
 *         if self._needDealloc:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":677
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":676
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":680
 *             del self._thisptr
 * 
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self, TMM::WaveSweepResultNonlinearTMM *__pyx_v_ptr, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init *__pyx_optional_args) {
  bool __pyx_v_needDealloc = ((bool)1);
  PyObject *__pyx_v_parent = ((PyObject *)Py_None);
  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("_Init", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_needDealloc = __pyx_optional_args->needDealloc;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_parent = __pyx_optional_args->parent;
      }
    }
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":681
 * 
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         self._needDealloc = needDealloc
 *         self._parent = parent # To avoid dealloc of parent before this
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":682
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc             # <<<<<<<<<<<<<<
 *         self._parent = parent # To avoid dealloc of parent before this
 * 
 */
  __pyx_v_self->_needDealloc = __pyx_v_needDealloc;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":683
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 *         self._parent = parent # To avoid dealloc of parent before this             # <<<<<<<<<<<<<<
 * 
 *         self.Pi = ndarray_view(self._thisptr.Pi).squeeze()
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(__pyx_v_self->_parent);
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":685
 *         self._parent = parent # To avoid dealloc of parent before this
 * 
 *         self.Pi = ndarray_view(self._thisptr.Pi).squeeze()             # <<<<<<<<<<<<<<
 *         self.Pr = ndarray_view(self._thisptr.Pr).squeeze()
 *         self.Pt = ndarray_view(self._thisptr.Pt).squeeze()
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Pi)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Pi);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Pi));
  __pyx_v_self->Pi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":686
 * 
 *         self.Pi = ndarray_view(self._thisptr.Pi).squeeze()
 *         self.Pr = ndarray_view(self._thisptr.Pr).squeeze()             # <<<<<<<<<<<<<<
 *         self.Pt = ndarray_view(self._thisptr.Pt).squeeze()
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Pr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Pr);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Pr));
  __pyx_v_self->Pr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":687
 *         self.Pi = ndarray_view(self._thisptr.Pi).squeeze()
 *         self.Pr = ndarray_view(self._thisptr.Pr).squeeze()
 *         self.Pt = ndarray_view(self._thisptr.Pt).squeeze()             # <<<<<<<<<<<<<<
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()
 *         self.beamArea = ndarray_view(self._thisptr.beamArea).squeeze()
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Pt)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 687, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->Pt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->Pt));
  __pyx_v_self->Pt = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":688
 *         self.Pr = ndarray_view(self._thisptr.Pr).squeeze()
 *         self.Pt = ndarray_view(self._thisptr.Pt).squeeze()
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()             # <<<<<<<<<<<<<<
 *         self.beamArea = ndarray_view(self._thisptr.beamArea).squeeze()
 * 
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->enh)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->enh);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->enh));
  __pyx_v_self->enh = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":689
 *         self.Pt = ndarray_view(self._thisptr.Pt).squeeze()
 *         self.enh = ndarray_view(self._thisptr.enh).squeeze()
 *         self.beamArea = ndarray_view(self._thisptr.beamArea).squeeze()             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __pyx_t_2 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->beamArea)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->beamArea);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->beamArea));
  __pyx_v_self->beamArea = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":680
 *             del self._thisptr
 * 
 *     cdef _Init(self, WaveSweepResultNonlinearTMMCpp *ptr, bool needDealloc = True, object parent = None):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._needDealloc = needDealloc
 */

  /* 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("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultNonlinearTMM._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":668
 *     """
 *     cdef WaveSweepResultNonlinearTMMCpp *_thisptr
 *     cdef readonly np.ndarray Pi, Pr, Pt, enh, beamArea             # <<<<<<<<<<<<<<
 *     cdef bool _needDealloc;
 *     cdef object _parent;
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Pi));
  __pyx_r = ((PyObject *)__pyx_v_self->Pi);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Pr));
  __pyx_r = ((PyObject *)__pyx_v_self->Pr);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Pt));
  __pyx_r = ((PyObject *)__pyx_v_self->Pt);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->enh));
  __pyx_r = ((PyObject *)__pyx_v_self->enh);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->beamArea));
  __pyx_r = ((PyObject *)__pyx_v_self->beamArea);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultNonlinearTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultNonlinearTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":714
 *     cdef readonly np.ndarray E, H;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":717
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":718
 * 
 *     def __dealloc__(self):
 *         del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, FieldsZCpp *ptr):
 */
  delete __pyx_v_self->_thisptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":717
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":720
 *         del self._thisptr
 * 
 *     cdef _Init(self, FieldsZCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self, TMM::FieldsZ *__pyx_v_ptr) {
  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("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":721
 * 
 *     cdef _Init(self, FieldsZCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 * 
 *         self.E = ndarray_view(self._thisptr.E)
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":723
 *         self._thisptr = ptr
 * 
 *         self.E = ndarray_view(self._thisptr.E)             # <<<<<<<<<<<<<<
 *         self.H = ndarray_view(self._thisptr.H)
 * 
 */
  __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->E)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->E);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->E));
  __pyx_v_self->E = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":724
 * 
 *         self.E = ndarray_view(self._thisptr.E)
 *         self.H = ndarray_view(self._thisptr.H)             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->H)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->H);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->H));
  __pyx_v_self->H = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":720
 *         del self._thisptr
 * 
 *     cdef _Init(self, FieldsZCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZ._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":712
 *     """
 *     cdef FieldsZCpp *_thisptr;
 *     cdef readonly np.ndarray E, H;             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->E));
  __pyx_r = ((PyObject *)__pyx_v_self->E);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->H));
  __pyx_r = ((PyObject *)__pyx_v_self->H);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZ.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZ.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":765
 *     cdef readonly np.ndarray Ex, Ey, Ez, Hx, Hy, Hz;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":768
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":769
 * 
 *     def __dealloc__(self):
 *         del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, FieldsZXCpp *ptr):
 */
  delete __pyx_v_self->_thisptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":768
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":771
 *         del self._thisptr
 * 
 *     cdef _Init(self, FieldsZXCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self, TMM::FieldsZX *__pyx_v_ptr) {
  enum TMM::Polarization __pyx_v_pol;
  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("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":772
 * 
 *     cdef _Init(self, FieldsZXCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 * 
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":773
 *     cdef _Init(self, FieldsZXCpp *ptr):
 *         self._thisptr = ptr
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()             # <<<<<<<<<<<<<<
 * 
 *         if pol == P_POL:
 */
  __pyx_v_pol = __pyx_v_self->_thisptr->GetPol();

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":775
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 * 
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             self.Hy = ndarray_view(self._thisptr.Hy)
 *             self.Ex = ndarray_view(self._thisptr.Ex)
 */
  switch (__pyx_v_pol) {
    case TMM::P_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":776
 * 
 *         if pol == P_POL:
 *             self.Hy = ndarray_view(self._thisptr.Hy)             # <<<<<<<<<<<<<<
 *             self.Ex = ndarray_view(self._thisptr.Ex)
 *             self.Ez = ndarray_view(self._thisptr.Ez)
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Hy)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Hy);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hy));
    __pyx_v_self->Hy = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":777
 *         if pol == P_POL:
 *             self.Hy = ndarray_view(self._thisptr.Hy)
 *             self.Ex = ndarray_view(self._thisptr.Ex)             # <<<<<<<<<<<<<<
 *             self.Ez = ndarray_view(self._thisptr.Ez)
 *             self.Hx = None
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ex)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Ex);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ex));
    __pyx_v_self->Ex = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":778
 *             self.Hy = ndarray_view(self._thisptr.Hy)
 *             self.Ex = ndarray_view(self._thisptr.Ex)
 *             self.Ez = ndarray_view(self._thisptr.Ez)             # <<<<<<<<<<<<<<
 *             self.Hx = None
 *             self.Ey = None
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ez)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Ez);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ez));
    __pyx_v_self->Ez = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":779
 *             self.Ex = ndarray_view(self._thisptr.Ex)
 *             self.Ez = ndarray_view(self._thisptr.Ez)
 *             self.Hx = None             # <<<<<<<<<<<<<<
 *             self.Ey = None
 *             self.Hz = None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Hx);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hx));
    __pyx_v_self->Hx = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":780
 *             self.Ez = ndarray_view(self._thisptr.Ez)
 *             self.Hx = None
 *             self.Ey = None             # <<<<<<<<<<<<<<
 *             self.Hz = None
 *         elif pol == S_POL:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Ey);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ey));
    __pyx_v_self->Ey = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":781
 *             self.Hx = None
 *             self.Ey = None
 *             self.Hz = None             # <<<<<<<<<<<<<<
 *         elif pol == S_POL:
 *             self.Hx = ndarray_view(self._thisptr.Hx)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Hz);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hz));
    __pyx_v_self->Hz = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":775
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 * 
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             self.Hy = ndarray_view(self._thisptr.Hy)
 *             self.Ex = ndarray_view(self._thisptr.Ex)
 */
    break;
    case TMM::S_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":783
 *             self.Hz = None
 *         elif pol == S_POL:
 *             self.Hx = ndarray_view(self._thisptr.Hx)             # <<<<<<<<<<<<<<
 *             self.Ey = ndarray_view(self._thisptr.Ey)
 *             self.Hz = ndarray_view(self._thisptr.Hz)
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Hx)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Hx);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hx));
    __pyx_v_self->Hx = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":784
 *         elif pol == S_POL:
 *             self.Hx = ndarray_view(self._thisptr.Hx)
 *             self.Ey = ndarray_view(self._thisptr.Ey)             # <<<<<<<<<<<<<<
 *             self.Hz = ndarray_view(self._thisptr.Hz)
 *             self.Hy = None
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Ey)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Ey);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ey));
    __pyx_v_self->Ey = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":785
 *             self.Hx = ndarray_view(self._thisptr.Hx)
 *             self.Ey = ndarray_view(self._thisptr.Ey)
 *             self.Hz = ndarray_view(self._thisptr.Hz)             # <<<<<<<<<<<<<<
 *             self.Hy = None
 *             self.Ex = None
 */
    __pyx_t_1 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->Hz)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->Hz);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hz));
    __pyx_v_self->Hz = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":786
 *             self.Ey = ndarray_view(self._thisptr.Ey)
 *             self.Hz = ndarray_view(self._thisptr.Hz)
 *             self.Hy = None             # <<<<<<<<<<<<<<
 *             self.Ex = None
 *             self.Ez = None
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Hy);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Hy));
    __pyx_v_self->Hy = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":787
 *             self.Hz = ndarray_view(self._thisptr.Hz)
 *             self.Hy = None
 *             self.Ex = None             # <<<<<<<<<<<<<<
 *             self.Ez = None
 *         else:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Ex);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ex));
    __pyx_v_self->Ex = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":788
 *             self.Hy = None
 *             self.Ex = None
 *             self.Ez = None             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Unknown polarization.")
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->Ez);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->Ez));
    __pyx_v_self->Ez = ((PyArrayObject *)Py_None);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":782
 *             self.Ey = None
 *             self.Hz = None
 *         elif pol == S_POL:             # <<<<<<<<<<<<<<
 *             self.Hx = ndarray_view(self._thisptr.Hx)
 *             self.Ey = ndarray_view(self._thisptr.Ey)
 */
    break;
    default:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":790
 *             self.Ez = None
 *         else:
 *             raise ValueError("Unknown polarization.")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __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, 790, __pyx_L1_error)
    break;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":771
 *         del self._thisptr
 * 
 *     cdef _Init(self, FieldsZXCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZX._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":793
 * 
 *     @property
 *     def EN(self):             # <<<<<<<<<<<<<<
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  enum TMM::Polarization __pyx_v_pol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":794
 *     @property
 *     def EN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()             # <<<<<<<<<<<<<<
 *         if pol == P_POL:
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 */
  __pyx_v_pol = __pyx_v_self->_thisptr->GetPol();

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":795
 *     def EN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 */
  switch (__pyx_v_pol) {
    case TMM::P_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":796
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \             # <<<<<<<<<<<<<<
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 *         elif pol == S_POL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Ex), __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Ex), __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":797
 *         if pol == P_POL:
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)             # <<<<<<<<<<<<<<
 *         elif pol == S_POL:
 *             return np.sqrt(self.Ey.real ** 2 + self.Ey.imag ** 2)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Ez), __pyx_n_s_real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":796
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \             # <<<<<<<<<<<<<<
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 *         elif pol == S_POL:
 */
    __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __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;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":797
 *         if pol == P_POL:
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)             # <<<<<<<<<<<<<<
 *         elif pol == S_POL:
 *             return np.sqrt(self.Ey.real ** 2 + self.Ey.imag ** 2)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Ez), __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Power(__pyx_t_4, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 797, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":795
 *     def EN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 */
    break;
    case TMM::S_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":799
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 *         elif pol == S_POL:
 *             return np.sqrt(self.Ey.real ** 2 + self.Ey.imag ** 2)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Unknown polarization.")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __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->Ey), __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Ey), __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":798
 *             return np.sqrt(self.Ex.real ** 2 + self.Ex.imag ** 2 + \
 *                            self.Ez.real ** 2 + self.Ez.imag ** 2)
 *         elif pol == S_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Ey.real ** 2 + self.Ey.imag ** 2)
 *         else:
 */
    break;
    default:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":801
 *             return np.sqrt(self.Ey.real ** 2 + self.Ey.imag ** 2)
 *         else:
 *             raise ValueError("Unknown polarization.")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __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, 801, __pyx_L1_error)
    break;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":793
 * 
 *     @property
 *     def EN(self):             # <<<<<<<<<<<<<<
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 */

  /* 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("NonlinearTMM._SecondOrderNLTMMCython._FieldsZX.EN.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":804
 * 
 *     @property
 *     def HN(self):             # <<<<<<<<<<<<<<
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  enum TMM::Polarization __pyx_v_pol;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":805
 *     @property
 *     def HN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()             # <<<<<<<<<<<<<<
 *         if pol == P_POL:
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 */
  __pyx_v_pol = __pyx_v_self->_thisptr->GetPol();

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":806
 *     def HN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 *         elif pol == S_POL:
 */
  switch (__pyx_v_pol) {
    case TMM::P_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":807
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)             # <<<<<<<<<<<<<<
 *         elif pol == S_POL:
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Hy), __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Hy), __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":806
 *     def HN(self):
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 *         elif pol == S_POL:
 */
    break;
    case TMM::S_POL:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":809
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 *         elif pol == S_POL:
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \             # <<<<<<<<<<<<<<
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Hx), __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 809, __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_self->Hx), __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":810
 *         elif pol == S_POL:
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Unknown polarization.")
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Hz), __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Power(__pyx_t_4, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":809
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 *         elif pol == S_POL:
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \             # <<<<<<<<<<<<<<
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)
 *         else:
 */
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":810
 *         elif pol == S_POL:
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Unknown polarization.")
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->Hz), __pyx_n_s_imag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __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;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":808
 *         if pol == P_POL:
 *             return np.sqrt(self.Hy.real ** 2 + self.Hy.imag ** 2)
 *         elif pol == S_POL:             # <<<<<<<<<<<<<<
 *             return np.sqrt(self.Hx.real ** 2 + self.Hx.imag ** 2 + \
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)
 */
    break;
    default:

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":812
 *                            self.Hz.real ** 2 + self.Hz.imag ** 2)
 *         else:
 *             raise ValueError("Unknown polarization.")             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __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, 812, __pyx_L1_error)
    break;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":804
 * 
 *     @property
 *     def HN(self):             # <<<<<<<<<<<<<<
 *         cdef PolarizationCpp pol = self._thisptr.GetPol()
 *         if pol == P_POL:
 */

  /* 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("NonlinearTMM._SecondOrderNLTMMCython._FieldsZX.HN.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":763
 *     """
 *     cdef FieldsZXCpp *_thisptr;
 *     cdef readonly np.ndarray Ex, Ey, Ez, Hx, Hy, Hz;             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ex));
  __pyx_r = ((PyObject *)__pyx_v_self->Ex);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ey));
  __pyx_r = ((PyObject *)__pyx_v_self->Ey);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Ez));
  __pyx_r = ((PyObject *)__pyx_v_self->Ez);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Hx));
  __pyx_r = ((PyObject *)__pyx_v_self->Hx);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Hy));
  __pyx_r = ((PyObject *)__pyx_v_self->Hy);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->Hz));
  __pyx_r = ((PyObject *)__pyx_v_self->Hz);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZX.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._FieldsZX.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":832
 *     cdef HomogeneousWaveCpp *_thisptr
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":833
 * 
 *     def __cinit__(self):
 *         self._thisptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, HomogeneousWaveCpp *ptr):
 */
  __pyx_v_self->_thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":832
 *     cdef HomogeneousWaveCpp *_thisptr
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":835
 *         self._thisptr = NULL
 * 
 *     cdef _Init(self, HomogeneousWaveCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, TMM::HomogeneousWave *__pyx_v_ptr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":836
 * 
 *     cdef _Init(self, HomogeneousWaveCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 * 
 *     def GetMainFields(self, double z):
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":835
 *         self._thisptr = NULL
 * 
 *     cdef _Init(self, HomogeneousWaveCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":838
 *         self._thisptr = ptr
 * 
 *     def GetMainFields(self, double z):             # <<<<<<<<<<<<<<
 *         """GetMainFields(z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3GetMainFields(PyObject *__pyx_v_self, PyObject *__pyx_arg_z); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2GetMainFields[] = "GetMainFields(z)\n        \n        Returns forward and backward component of the main fields at the\n        distance z.  In case of s-pol the main field is Ey and in case of p-pol\n        the main field is Hy.\n        \n        Parameters\n        ----------\n        z : float \n            z-coorinate for the main fields calculation. z=0 is the beginning of\n            the layer.\n        \n        Returns\n        -------\n        ndarray(2,) of complex\n            The foreard and backward component of the main fields.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3GetMainFields(PyObject *__pyx_v_self, PyObject *__pyx_arg_z) {
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetMainFields (wrapper)", 0);
  assert(__pyx_arg_z); {
    __pyx_v_z = __pyx_PyFloat_AsDouble(__pyx_arg_z); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.GetMainFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2GetMainFields(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self), ((double)__pyx_v_z));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2GetMainFields(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, double __pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Eigen::Array2cd __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetMainFields", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":858
 *         """
 *         # Have to copy, because result is in stack
 *         return ndarray_copy(self._thisptr.GetMainFields(z))             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetMainFields(__pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 858, __pyx_L1_error)
  }
  __pyx_t_2 = ((PyObject *)eigency::ndarray_copy(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":838
 *         self._thisptr = ptr
 * 
 *     def GetMainFields(self, double z):             # <<<<<<<<<<<<<<
 *         """GetMainFields(z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.GetMainFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":861
 * 
 *     @property
 *     def kzF(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetKzF()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __pyx_t_double_complex __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":862
 *     @property
 *     def kzF(self):
 *         return self._thisptr.GetKzF()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetKzF();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 862, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":861
 * 
 *     @property
 *     def kzF(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetKzF()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.kzF.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":865
 * 
 *     @property
 *     def kx(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetKx()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":866
 *     @property
 *     def kx(self):
 *         return self._thisptr.GetKx()             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetKx();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 866, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":865
 * 
 *     @property
 *     def kx(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetKx()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.kx.__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):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":887
 *     cdef int _layerNr;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         self.hw = None
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":888
 * 
 *     def __cinit__(self):
 *         self._thisptr = NULL             # <<<<<<<<<<<<<<
 *         self.hw = None
 * 
 */
  __pyx_v_self->_thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":889
 *     def __cinit__(self):
 *         self._thisptr = NULL
 *         self.hw = None             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, NonlinearLayerCpp *ptr, int layerNr, object parent):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->hw);
  __Pyx_DECREF(__pyx_v_self->hw);
  __pyx_v_self->hw = Py_None;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":887
 *     cdef int _layerNr;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         self.hw = None
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":891
 *         self.hw = None
 * 
 *     cdef _Init(self, NonlinearLayerCpp *ptr, int layerNr, object parent):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._parent = parent
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, TMM::NonlinearLayer *__pyx_v_ptr, int __pyx_v_layerNr, PyObject *__pyx_v_parent) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *__pyx_v_hw = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  TMM::HomogeneousWave *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":892
 * 
 *     cdef _Init(self, NonlinearLayerCpp *ptr, int layerNr, object parent):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self._layerNr = layerNr
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":893
 *     cdef _Init(self, NonlinearLayerCpp *ptr, int layerNr, object parent):
 *         self._thisptr = ptr
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self._layerNr = layerNr
 * 
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(__pyx_v_self->_parent);
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":894
 *         self._thisptr = ptr
 *         self._parent = parent
 *         self._layerNr = layerNr             # <<<<<<<<<<<<<<
 * 
 *         hw = _HomogeneousWave()
 */
  __pyx_v_self->_layerNr = __pyx_v_layerNr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":896
 *         self._layerNr = layerNr
 * 
 *         hw = _HomogeneousWave()             # <<<<<<<<<<<<<<
 *         hw._Init(self._thisptr.GetHw())
 *         self.hw = hw
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_hw = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":897
 * 
 *         hw = _HomogeneousWave()
 *         hw._Init(self._thisptr.GetHw())             # <<<<<<<<<<<<<<
 *         self.hw = hw
 * 
 */
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetHw();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 897, __pyx_L1_error)
  }
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)__pyx_v_hw->__pyx_vtab)->_Init(__pyx_v_hw, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":898
 *         hw = _HomogeneousWave()
 *         hw._Init(self._thisptr.GetHw())
 *         self.hw = hw             # <<<<<<<<<<<<<<
 * 
 *     def GetIntensity(self, double z):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_hw));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_hw));
  __Pyx_GOTREF(__pyx_v_self->hw);
  __Pyx_DECREF(__pyx_v_self->hw);
  __pyx_v_self->hw = ((PyObject *)__pyx_v_hw);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":891
 *         self.hw = None
 * 
 *     cdef _Init(self, NonlinearLayerCpp *ptr, int layerNr, object parent):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         self._parent = parent
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hw);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":900
 *         self.hw = hw
 * 
 *     def GetIntensity(self, double z):             # <<<<<<<<<<<<<<
 *         """GetIntensity(z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_3GetIntensity(PyObject *__pyx_v_self, PyObject *__pyx_arg_z); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2GetIntensity[] = "GetIntensity(z)\n        \n        Returns intensity of the plane wave at coordinate `z`.\n        \n        Parameters\n        ----------\n        z : float\n            z-coorinate\n        \n        Returns\n        -------\n        float\n            The intensity of the plane waves in layer.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_3GetIntensity(PyObject *__pyx_v_self, PyObject *__pyx_arg_z) {
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetIntensity (wrapper)", 0);
  assert(__pyx_arg_z); {
    __pyx_v_z = __pyx_PyFloat_AsDouble(__pyx_arg_z); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 900, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.GetIntensity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2GetIntensity(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self), ((double)__pyx_v_z));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2GetIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, double __pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetIntensity", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":916
 * 
 *         """
 *         return self._thisptr.GetIntensity(z);             # <<<<<<<<<<<<<<
 * 
 *     def GetAbsorbedIntensity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetIntensity(__pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 916, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":900
 *         self.hw = hw
 * 
 *     def GetIntensity(self, double z):             # <<<<<<<<<<<<<<
 *         """GetIntensity(z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.GetIntensity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":918
 *         return self._thisptr.GetIntensity(z);
 * 
 *     def GetAbsorbedIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetAbsorbedIntensity()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_5GetAbsorbedIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_4GetAbsorbedIntensity[] = "GetAbsorbedIntensity()\n        \n        Returns absorbed intensity in the layer.\n        \n        Returns\n        -------\n        float\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_5GetAbsorbedIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetAbsorbedIntensity (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_4GetAbsorbedIntensity(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_4GetAbsorbedIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetAbsorbedIntensity", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":928
 * 
 *         """
 *         return self._thisptr.GetAbsorbedIntensity();             # <<<<<<<<<<<<<<
 * 
 *     def GetSrcIntensity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetAbsorbedIntensity();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 928, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":918
 *         return self._thisptr.GetIntensity(z);
 * 
 *     def GetAbsorbedIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetAbsorbedIntensity()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.GetAbsorbedIntensity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":930
 *         return self._thisptr.GetAbsorbedIntensity();
 * 
 *     def GetSrcIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetSrcIntensity()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_7GetSrcIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_6GetSrcIntensity[] = "GetSrcIntensity()\n        \n        Calculates source power of the layer. Only nonzero if the material is\n        nonlinear.\n        \n        Returns\n        -------\n        float\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_7GetSrcIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetSrcIntensity (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_6GetSrcIntensity(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_6GetSrcIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetSrcIntensity", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":941
 * 
 *         """
 *         return self._thisptr.GetSrcIntensity();             # <<<<<<<<<<<<<<
 * 
 *     # Getter
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetSrcIntensity();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 941, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":930
 *         return self._thisptr.GetAbsorbedIntensity();
 * 
 *     def GetSrcIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetSrcIntensity()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.GetSrcIntensity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":947
 * 
 *     @property
 *     def d(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetThickness()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":948
 *     @property
 *     def d(self):
 *         return self._thisptr.GetThickness()             # <<<<<<<<<<<<<<
 * 
 *     # Setter
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetThickness();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 948, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":947
 * 
 *     @property
 *     def d(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetThickness()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.d.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":954
 * 
 *     @d.setter
 *     def d(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetThickness(value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":955
 *     @d.setter
 *     def d(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetThickness(value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetThickness(__pyx_t_1);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 955, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":954
 * 
 *     @d.setter
 *     def d(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetThickness(value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.d.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":883
 *     """
 *     cdef NonlinearLayerCpp *_thisptr
 *     cdef readonly object hw             # <<<<<<<<<<<<<<
 *     cdef object _parent;
 *     cdef int _layerNr;
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->hw);
  __pyx_r = __pyx_v_self->hw;
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_8__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_10__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1014
 *     cdef readonly _Wave wave;
 * 
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):             # <<<<<<<<<<<<<<
 *         if initStruct:
 *             self._thisptr = new NonlinearTMMCpp()
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  bool __pyx_v_initStruct;
  PyObject *__pyx_v_parent = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_initStruct,&__pyx_n_s_parent,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_initStruct);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parent);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1014, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_initStruct = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_initStruct == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L3_error)
    } else {
      __pyx_v_initStruct = ((bool)1);
    }
    __pyx_v_parent = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1014, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_initStruct, __pyx_v_parent, __pyx_v_kwargs);

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, bool __pyx_v_initStruct, PyObject *__pyx_v_parent, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  TMM::NonlinearTMM *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  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("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1015
 * 
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):
 *         if initStruct:             # <<<<<<<<<<<<<<
 *             self._thisptr = new NonlinearTMMCpp()
 *             self._Init(self._thisptr)
 */
  __pyx_t_1 = (__pyx_v_initStruct != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1016
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):
 *         if initStruct:
 *             self._thisptr = new NonlinearTMMCpp()             # <<<<<<<<<<<<<<
 *             self._Init(self._thisptr)
 *             self._needDealloc = True
 */
    try {
      __pyx_t_2 = new TMM::NonlinearTMM();
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1016, __pyx_L1_error)
    }
    __pyx_v_self->_thisptr = __pyx_t_2;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1017
 *         if initStruct:
 *             self._thisptr = new NonlinearTMMCpp()
 *             self._Init(self._thisptr)             # <<<<<<<<<<<<<<
 *             self._needDealloc = True
 *         else:
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self->__pyx_vtab)->_Init(__pyx_v_self, __pyx_v_self->_thisptr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1018
 *             self._thisptr = new NonlinearTMMCpp()
 *             self._Init(self._thisptr)
 *             self._needDealloc = True             # <<<<<<<<<<<<<<
 *         else:
 *             self._thisptr = NULL
 */
    __pyx_v_self->_needDealloc = 1;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1015
 * 
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):
 *         if initStruct:             # <<<<<<<<<<<<<<
 *             self._thisptr = new NonlinearTMMCpp()
 *             self._Init(self._thisptr)
 */
    goto __pyx_L3;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1020
 *             self._needDealloc = True
 *         else:
 *             self._thisptr = NULL             # <<<<<<<<<<<<<<
 *             self._needDealloc = False
 *         self._parent = parent
 */
  /*else*/ {
    __pyx_v_self->_thisptr = NULL;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1021
 *         else:
 *             self._thisptr = NULL
 *             self._needDealloc = False             # <<<<<<<<<<<<<<
 *         self._parent = parent
 * 
 */
    __pyx_v_self->_needDealloc = 0;
  }
  __pyx_L3:;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1022
 *             self._thisptr = NULL
 *             self._needDealloc = False
 *         self._parent = parent             # <<<<<<<<<<<<<<
 * 
 *         self.materialsCache = []
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(__pyx_v_self->_parent);
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1024
 *         self._parent = parent
 * 
 *         self.materialsCache = []             # <<<<<<<<<<<<<<
 *         self.layers = []
 *         self.SetParams(**kwargs)
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->materialsCache);
  __Pyx_DECREF(__pyx_v_self->materialsCache);
  __pyx_v_self->materialsCache = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1025
 * 
 *         self.materialsCache = []
 *         self.layers = []             # <<<<<<<<<<<<<<
 *         self.SetParams(**kwargs)
 * 
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->layers);
  __Pyx_DECREF(__pyx_v_self->layers);
  __pyx_v_self->layers = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1026
 *         self.materialsCache = []
 *         self.layers = []
 *         self.SetParams(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, NonlinearTMMCpp* ptr):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_SetParams); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __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_5); __pyx_t_5 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1014
 *     cdef readonly _Wave wave;
 * 
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):             # <<<<<<<<<<<<<<
 *         if initStruct:
 *             self._thisptr = new NonlinearTMMCpp()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1028
 *         self.SetParams(**kwargs)
 * 
 *     cdef _Init(self, NonlinearTMMCpp* ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, TMM::NonlinearTMM *__pyx_v_ptr) {
  TMM::Wave *__pyx_v_wavePtr;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *__pyx_v_wave = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TMM::Wave *__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);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1029
 * 
 *     cdef _Init(self, NonlinearTMMCpp* ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()
 *         wave = _Wave()
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1030
 *     cdef _Init(self, NonlinearTMMCpp* ptr):
 *         self._thisptr = ptr
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()             # <<<<<<<<<<<<<<
 *         wave = _Wave()
 *         wave._Init(wavePtr)
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetWave();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1030, __pyx_L1_error)
  }
  __pyx_v_wavePtr = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1031
 *         self._thisptr = ptr
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()
 *         wave = _Wave()             # <<<<<<<<<<<<<<
 *         wave._Init(wavePtr)
 *         self.wave = wave
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_wave = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1032
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()
 *         wave = _Wave()
 *         wave._Init(wavePtr)             # <<<<<<<<<<<<<<
 *         self.wave = wave
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)__pyx_v_wave->__pyx_vtab)->_Init(__pyx_v_wave, __pyx_v_wavePtr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1033
 *         wave = _Wave()
 *         wave._Init(wavePtr)
 *         self.wave = wave             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_wave));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_wave));
  __Pyx_GOTREF(__pyx_v_self->wave);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->wave));
  __pyx_v_self->wave = __pyx_v_wave;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1028
 *         self.SetParams(**kwargs)
 * 
 *     cdef _Init(self, NonlinearTMMCpp* ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 *         cdef WaveCpp *wavePtr = self._thisptr.GetWave()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_wave);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1035
 *         self.wave = wave
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1036
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_needDealloc != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1037
 *     def __dealloc__(self):
 *         if self._needDealloc:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     # Methods
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1036
 * 
 *     def __dealloc__(self):
 *         if self._needDealloc:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1035
 *         self.wave = wave
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._needDealloc:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1042
 *     #---------------------------------------------------------------------------
 * 
 *     def AddLayer(self, double d, Material material):             # <<<<<<<<<<<<<<
 *         """AddLayer(d, material)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_5AddLayer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4AddLayer[] = "AddLayer(d, material)\n        \n        Adds layer to the TMM.\n        \n        Parameters\n        ----------\n        d : float\n            Thickness of the layer in meters. First and the last medium have\n            infinite thickness.\n        material : :any:`Material`\n            Instance of the helper class :any:`Material`\n        \n        Examples\n        --------\n        >>> tmm = TMM()\n        >>> tmm.AddLayer(float(\"inf\"), Material.Static(1.5))\n        >>> tmm.AddLayer(50e-9, Material.Static(0.3 + 3j))\n        >>> tmm.AddLayer(float(\"inf\"), Material.Static(1.0))\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_5AddLayer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_d;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("AddLayer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_material,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("AddLayer", 1, 2, 2, 1); __PYX_ERR(0, 1042, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "AddLayer") < 0)) __PYX_ERR(0, 1042, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_d = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_d == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1042, __pyx_L3_error)
    __pyx_v_material = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("AddLayer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1042, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.AddLayer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material), __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, 1, "material", 0))) __PYX_ERR(0, 1042, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4AddLayer(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_d, __pyx_v_material);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4AddLayer(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, double __pyx_v_d, struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material) {
  int __pyx_v_lastLayer;
  TMM::NonlinearLayer *__pyx_v_layerptr;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *__pyx_v_layer = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  TMM::NonlinearLayer *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("AddLayer", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1063
 *         """
 *         # No copy of material is made
 *         self._thisptr.AddLayer(d, material._thisptr)             # <<<<<<<<<<<<<<
 * 
 *         # Cache material classes, avoids dealloc
 */
  try {
    __pyx_v_self->_thisptr->AddLayer(__pyx_v_d, __pyx_v_material->_thisptr);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1063, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1066
 * 
 *         # Cache material classes, avoids dealloc
 *         self.materialsCache.append(material)             # <<<<<<<<<<<<<<
 * 
 *         # Layers list
 */
  if (unlikely(__pyx_v_self->materialsCache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 1066, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->materialsCache, ((PyObject *)__pyx_v_material)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1066, __pyx_L1_error)

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1069
 * 
 *         # Layers list
 *         cdef int lastLayer = self._thisptr.LayersCount() - 1             # <<<<<<<<<<<<<<
 *         cdef NonlinearLayerCpp *layerptr = self._thisptr.GetLayer(lastLayer)
 *         layer = _NonlinearLayer()
 */
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->LayersCount();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1069, __pyx_L1_error)
  }
  __pyx_v_lastLayer = (__pyx_t_2 - 1);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1070
 *         # Layers list
 *         cdef int lastLayer = self._thisptr.LayersCount() - 1
 *         cdef NonlinearLayerCpp *layerptr = self._thisptr.GetLayer(lastLayer)             # <<<<<<<<<<<<<<
 *         layer = _NonlinearLayer()
 *         layer._Init(layerptr, lastLayer, self)
 */
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->GetLayer(__pyx_v_lastLayer);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1070, __pyx_L1_error)
  }
  __pyx_v_layerptr = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1071
 *         cdef int lastLayer = self._thisptr.LayersCount() - 1
 *         cdef NonlinearLayerCpp *layerptr = self._thisptr.GetLayer(lastLayer)
 *         layer = _NonlinearLayer()             # <<<<<<<<<<<<<<
 *         layer._Init(layerptr, lastLayer, self)
 *         self.layers.append(layer)
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_layer = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1072
 *         cdef NonlinearLayerCpp *layerptr = self._thisptr.GetLayer(lastLayer)
 *         layer = _NonlinearLayer()
 *         layer._Init(layerptr, lastLayer, self)             # <<<<<<<<<<<<<<
 *         self.layers.append(layer)
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)__pyx_v_layer->__pyx_vtab)->_Init(__pyx_v_layer, __pyx_v_layerptr, __pyx_v_lastLayer, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1073
 *         layer = _NonlinearLayer()
 *         layer._Init(layerptr, lastLayer, self)
 *         self.layers.append(layer)             # <<<<<<<<<<<<<<
 * 
 *     def SetParams(self, **kwargs):
 */
  if (unlikely(__pyx_v_self->layers == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 1073, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyList_Append(__pyx_v_self->layers, ((PyObject *)__pyx_v_layer)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1073, __pyx_L1_error)

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1042
 *     #---------------------------------------------------------------------------
 * 
 *     def AddLayer(self, double d, Material material):             # <<<<<<<<<<<<<<
 *         """AddLayer(d, material)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.AddLayer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_layer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1075
 *         self.layers.append(layer)
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_7SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6SetParams[] = "SetParams(**kwargs)\n        \n        Helper method to set the values of all the attributes. See the docstring\n        of :any:`NonlinearTMM`.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_7SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SetParams (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("SetParams", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "SetParams", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6SetParams(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SetParams", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1082
 * 
 *         """
 *         for name, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if name not in paramDict:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1083
 *         """
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDict:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1083, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (unlikely(__pyx_t_9)) {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1084
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDict:
 *                 raise ValueError("Unknown kwarg %s" % (name))             # <<<<<<<<<<<<<<
 *             setattr(self, name, value)
 * 
 */
      __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_kwarg_s, __pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1084, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 1084, __pyx_L1_error)

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1083
 *         """
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDict:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1085
 *             if name not in paramDict:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)             # <<<<<<<<<<<<<<
 * 
 *     def Solve(self, **kwargs):
 */
    __pyx_t_10 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1085, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1075
 *         self.layers.append(layer)
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.SetParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1087
 *             setattr(self, name, value)
 * 
 *     def Solve(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Solve(**kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_9Solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_8Solve[] = "Solve(**kwargs)\n        \n        Solves the structure.\n        \n        Parameters\n        ----------\n        wl : float, optional\n             Wavelength in meters.\n        pol : str, optional\n            \"p\" or \"s\" denoting the polarization of the waves.\n        beta : float, optional\n            Normalized tangential wave vector.\n        E0 : complex, optional\n            Input plane wave amplitude in vacuum. Only used if :any:`overrideE0` is\n            True.\n        I0 : float, optional\n            Input plane wave intensity in the first layer. Only used if\n            :any:`overrideE0` is False.\n        overrideE0 : bool, optional\n            Selects between :any:`E0` and :any:`I0`.\n        \n        Examples\n        --------\n        >>> tmm.Solve(wl = 532e-9, beta = 0.0)\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_9Solve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Solve (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("Solve", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "Solve", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_8Solve(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_8Solve(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, 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("Solve", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1114
 * 
 *         """
 *         self.SetParams(**kwargs)             # <<<<<<<<<<<<<<
 *         self._thisptr.Solve()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_SetParams); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1115
 *         """
 *         self.SetParams(**kwargs)
 *         self._thisptr.Solve()             # <<<<<<<<<<<<<<
 * 
 *     def GetIntensities(self):
 */
  try {
    __pyx_v_self->_thisptr->Solve();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1115, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1087
 *             setattr(self, name, value)
 * 
 *     def Solve(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """Solve(**kwargs)
 * 
 */

  /* 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("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.Solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1117
 *         self._thisptr.Solve()
 * 
 *     def GetIntensities(self):             # <<<<<<<<<<<<<<
 *         """GetIntensities()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_11GetIntensities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10GetIntensities[] = "GetIntensities()\n        \n        Returns the intensities and amplitutes of incident, reflected and\n        transmitted wave. The structure must be solved first.\n        \n        Returns\n        -------\n        :any:`_Intensities`\n            Helper class to hold intensity data.\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_11GetIntensities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetIntensities (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10GetIntensities(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10GetIntensities(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  TMM::Intensities __pyx_v_resCpp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TMM::Intensities __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetIntensities", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1128
 *             Helper class to hold intensity data.
 *         """
 *         cdef IntensitiesCpp resCpp = self._thisptr.GetIntensities()             # <<<<<<<<<<<<<<
 *         res = _Intensities()
 *         res._Init(&resCpp)
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetIntensities();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1128, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1129
 *         """
 *         cdef IntensitiesCpp resCpp = self._thisptr.GetIntensities()
 *         res = _Intensities()             # <<<<<<<<<<<<<<
 *         res._Init(&resCpp)
 *         return res
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1130
 *         cdef IntensitiesCpp resCpp = self._thisptr.GetIntensities()
 *         res = _Intensities()
 *         res._Init(&resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, (&__pyx_v_resCpp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1131
 *         res = _Intensities()
 *         res._Init(&resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] values, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, outEnh = False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1117
 *         self._thisptr.Solve()
 * 
 *     def GetIntensities(self):             # <<<<<<<<<<<<<<
 *         """GetIntensities()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetIntensities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1133
 *         return res
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] values, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, outEnh = False):             # <<<<<<<<<<<<<<
 *         """Sweep(paramStr, values, layerNr = 0, layerZ = 0, outPwr = True, outAbs = False, outEnh = False)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_13Sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_12Sweep[] = "Sweep(paramStr, values, layerNr = 0, layerZ = 0, outPwr = True, outAbs = False, outEnh = False)\n        \n        Solves the structure for series of :any:`values` of param :any:`paramStr`. Using\n        this function is more confortable and faster than just changing params\n        and solving the structure.\n        \n        Parameters\n        ----------\n        paramStr : str\n            'wl':\n                Wavelength in meters\n            'beta':\n                normalized tangential wavevector\n            'I0':\n                intensity of the wave\n            'd_i': thikness of layer i (0..N-1)\n        values : ndarray of floats\n            Correspondig values of param :any:`paramStr`.\n        layerNr : int\n            Specifies layer, where electrical field enhancment is calculated.\n        layerZ : double\n            Specifies z-coordinate of enchncment calculation inside :any:`layerNr`.\n        outPwr : bool\n            Turns calculation of intensities on/off.\n        outAbs : bool\n            Turns calculation of absoprtiopn in the entire structure on/off.\n        outEnh : bool\n            Turns calculation of enhancment in layer :any:`layerNr` at distance\n            :any:`layerZ` on/off.values\n        \n        Returns\n        -------\n        :any:`_SweepResultNonlinearTMM`\n            Helper class to store the result.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_13Sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_paramStr = 0;
  PyArrayObject *__pyx_v_values = 0;
  int __pyx_v_layerNr;
  double __pyx_v_layerZ;
  bool __pyx_v_outPwr;
  bool __pyx_v_outAbs;
  PyObject *__pyx_v_outEnh = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Sweep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paramStr,&__pyx_n_s_values,&__pyx_n_s_layerNr,&__pyx_n_s_layerZ,&__pyx_n_s_outPwr,&__pyx_n_s_outAbs,&__pyx_n_s_outEnh,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[6] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramStr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Sweep", 0, 2, 7, 1); __PYX_ERR(0, 1133, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerZ);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outPwr);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outAbs);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outEnh);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Sweep") < 0)) __PYX_ERR(0, 1133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_paramStr = ((PyObject*)values[0]);
    __pyx_v_values = ((PyArrayObject *)values[1]);
    if (values[2]) {
      __pyx_v_layerNr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L3_error)
    } else {
      __pyx_v_layerNr = ((int)0);
    }
    if (values[3]) {
      __pyx_v_layerZ = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_layerZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L3_error)
    } else {
      __pyx_v_layerZ = ((double)0.0);
    }
    if (values[4]) {
      __pyx_v_outPwr = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_outPwr == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L3_error)
    } else {
      __pyx_v_outPwr = ((bool)1);
    }
    if (values[5]) {
      __pyx_v_outAbs = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_outAbs == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L3_error)
    } else {
      __pyx_v_outAbs = ((bool)0);
    }
    __pyx_v_outEnh = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Sweep", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.Sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_paramStr), (&PyString_Type), 1, "paramStr", 1))) __PYX_ERR(0, 1133, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) __PYX_ERR(0, 1133, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_12Sweep(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_paramStr, __pyx_v_values, __pyx_v_layerNr, __pyx_v_layerZ, __pyx_v_outPwr, __pyx_v_outAbs, __pyx_v_outEnh);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_12Sweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_values, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outAbs, PyObject *__pyx_v_outEnh) {
  TMM::SweepResultNonlinearTMM *__pyx_v_resCpp;
  int __pyx_v_outmask;
  enum TMM::TMMParam __pyx_v_param;
  int __pyx_v_paramLayer;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_5;
  TMM::SweepResultNonlinearTMM *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Sweep", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1133, __pyx_L1_error)
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1171
 *         """
 *         cdef SweepResultNonlinearTMMCpp *resCpp;
 *         cdef int outmask = 0             # <<<<<<<<<<<<<<
 * 
 *         if outPwr:
 */
  __pyx_v_outmask = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1173
 *         cdef int outmask = 0
 * 
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 */
  __pyx_t_1 = (__pyx_v_outPwr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1174
 * 
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS             # <<<<<<<<<<<<<<
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_PWRFLOWS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1173
 *         cdef int outmask = 0
 * 
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1175
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 */
  __pyx_t_1 = (__pyx_v_outAbs != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1176
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 *             outmask |= SWEEP_ABS             # <<<<<<<<<<<<<<
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ABS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1175
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1177
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_outEnh); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1177, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1178
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 *             outmask |= SWEEP_ENH             # <<<<<<<<<<<<<<
 * 
 *         cdef TMMParamCpp param;
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ENH);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1177
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1181
 * 
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;             # <<<<<<<<<<<<<<
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 */
  __pyx_v_paramLayer = -1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1182
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
  if (unlikely(__pyx_v_paramStr == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
    __PYX_ERR(0, 1182, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(__pyx_v_paramStr, __pyx_n_s_d_2, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1182, __pyx_L1_error)
  if ((__pyx_t_1 != 0)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1183
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D             # <<<<<<<<<<<<<<
 *             paramLayer = int(paramStr[2:])
 *         else:
 */
    __pyx_v_param = TMM::PARAM_LAYER_D;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1184
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])             # <<<<<<<<<<<<<<
 *         else:
 *             param = TmmParamFromStr(paramStr)
 */
    if (unlikely(__pyx_v_paramStr == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1184, __pyx_L1_error)
    }
    __pyx_t_2 = PySequence_GetSlice(__pyx_v_paramStr, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_paramLayer = __pyx_t_4;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1182
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
    goto __pyx_L6;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1186
 *             paramLayer = int(paramStr[2:])
 *         else:
 *             param = TmmParamFromStr(paramStr)             # <<<<<<<<<<<<<<
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 */
  /*else*/ {
    __pyx_v_param = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(__pyx_v_paramStr);
  }
  __pyx_L6:;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1188
 *             param = TmmParamFromStr(paramStr)
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)             # <<<<<<<<<<<<<<
 *         res = _SweepResultNonlinearTMM()
 *         res._Init(resCpp);
 */
  try {
    __pyx_t_5 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_values));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1188, __pyx_L1_error)
  }
  try {
    __pyx_t_6 = __pyx_v_self->_thisptr->Sweep(__pyx_v_param, __pyx_t_5, __pyx_v_outmask, __pyx_v_paramLayer, __pyx_v_layerNr, __pyx_v_layerZ);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1188, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_6;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1189
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 *         res = _SweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp);
 *         return res
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1190
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 *         res = _SweepResultNonlinearTMM()
 *         res._Init(resCpp);             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1191
 *         res = _SweepResultNonlinearTMM()
 *         res._Init(resCpp);
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def GetFields(self, np.ndarray[double, ndim = 1] zs, str dir = "total"):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1133
 *         return res
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] values, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, outEnh = False):             # <<<<<<<<<<<<<<
 *         """Sweep(paramStr, values, layerNr = 0, layerZ = 0, outPwr = True, outAbs = False, outEnh = False)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { 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_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.Sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1193
 *         return res
 * 
 *     def GetFields(self, np.ndarray[double, ndim = 1] zs, str dir = "total"):             # <<<<<<<<<<<<<<
 *         """GetFields(zs, dir = "total")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_15GetFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14GetFields[] = "GetFields(zs, dir = \"total\")\n        \n        Calculates electical and magnetic fields along z-axis. The structure\n        must be solved first.\n        \n        Parameters\n        ----------\n        zs : ndarray of floats\n            Points on z-axis where to calculate the fields. The beginning of the\n            first layer is at z = 0.\n        dir : {'total', 'forward', 'backward'}\n            Specifies the components of the output fields.\n            \n        Returns\n        -------\n        :any:`_FieldsZ`\n            Helper class to store electric and magnetic fields.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_15GetFields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_zs = 0;
  PyObject *__pyx_v_dir = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetFields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zs,&__pyx_n_s_dir,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject*)__pyx_n_s_total);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dir);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "GetFields") < 0)) __PYX_ERR(0, 1193, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_zs = ((PyArrayObject *)values[0]);
    __pyx_v_dir = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("GetFields", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1193, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zs), __pyx_ptype_5numpy_ndarray, 1, "zs", 0))) __PYX_ERR(0, 1193, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dir), (&PyString_Type), 1, "dir", 1))) __PYX_ERR(0, 1193, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14GetFields(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_zs, __pyx_v_dir);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14GetFields(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyObject *__pyx_v_dir) {
  TMM::FieldsZ *__pyx_v_resCpp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_zs;
  __Pyx_Buffer __pyx_pybuffer_zs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  eigency::Map<Eigen::ArrayXd>  __pyx_t_1;
  TMM::FieldsZ *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetFields", 0);
  __pyx_pybuffer_zs.pybuffer.buf = NULL;
  __pyx_pybuffer_zs.refcount = 0;
  __pyx_pybuffernd_zs.data = NULL;
  __pyx_pybuffernd_zs.rcbuffer = &__pyx_pybuffer_zs;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zs.rcbuffer->pybuffer, (PyObject*)__pyx_v_zs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  }
  __pyx_pybuffernd_zs.diminfo[0].strides = __pyx_pybuffernd_zs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zs.diminfo[0].shape = __pyx_pybuffernd_zs.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1214
 *         """
 *         cdef FieldsZCpp *resCpp;
 *         resCpp = self._thisptr.GetFields(Map[ArrayXd](zs), WaveDirectionFromStr(dir))             # <<<<<<<<<<<<<<
 *         res = _FieldsZ()
 *         res._Init(resCpp)
 */
  try {
    __pyx_t_1 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_zs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1214, __pyx_L1_error)
  }
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetFields(__pyx_t_1, __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(__pyx_v_dir));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1214, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_2;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1215
 *         cdef FieldsZCpp *resCpp;
 *         resCpp = self._thisptr.GetFields(Map[ArrayXd](zs), WaveDirectionFromStr(dir))
 *         res = _FieldsZ()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp)
 *         return res
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1216
 *         resCpp = self._thisptr.GetFields(Map[ArrayXd](zs), WaveDirectionFromStr(dir))
 *         res = _FieldsZ()
 *         res._Init(resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1217
 *         res = _FieldsZ()
 *         res._Init(resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def GetFields2D(self, np.ndarray[double, ndim = 1] zs, np.ndarray[double, ndim = 1] xs, str dir = "total"):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1193
 *         return res
 * 
 *     def GetFields(self, np.ndarray[double, ndim = 1] zs, str dir = "total"):             # <<<<<<<<<<<<<<
 *         """GetFields(zs, dir = "total")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { 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_zs.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetFields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1219
 *         return res
 * 
 *     def GetFields2D(self, np.ndarray[double, ndim = 1] zs, np.ndarray[double, ndim = 1] xs, str dir = "total"):             # <<<<<<<<<<<<<<
 *         """GetFields2D(zs, xs, dir = "total")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_17GetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_16GetFields2D[] = "GetFields2D(zs, xs, dir = \"total\")\n        \n        Calculates electical and magnetic fields in xz-plane. Made as fast as\n        possible. The structure must be solved first.\n        \n        Parameters\n        ----------\n        zs : ndarray of floats\n            Points on z-axis where to calculate the fields. The beginning of the\n            first layer is at z = 0.\n        xs : ndarray of floats\n            Points on x-axis where to calculate the fields.\n        dir : {'total', 'forward', 'backward'}\n            Specifies the components of the output fields.\n            \n        Returns\n        -------\n        :any:`_FieldsZX`\n            Helper class to store electric and magnetic fields in regular grid.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_17GetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_zs = 0;
  PyArrayObject *__pyx_v_xs = 0;
  PyObject *__pyx_v_dir = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetFields2D (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zs,&__pyx_n_s_xs,&__pyx_n_s_dir,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject*)__pyx_n_s_total);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("GetFields2D", 0, 2, 3, 1); __PYX_ERR(0, 1219, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dir);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "GetFields2D") < 0)) __PYX_ERR(0, 1219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_zs = ((PyArrayObject *)values[0]);
    __pyx_v_xs = ((PyArrayObject *)values[1]);
    __pyx_v_dir = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("GetFields2D", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zs), __pyx_ptype_5numpy_ndarray, 1, "zs", 0))) __PYX_ERR(0, 1219, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xs), __pyx_ptype_5numpy_ndarray, 1, "xs", 0))) __PYX_ERR(0, 1219, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dir), (&PyString_Type), 1, "dir", 1))) __PYX_ERR(0, 1219, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_16GetFields2D(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_zs, __pyx_v_xs, __pyx_v_dir);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_16GetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dir) {
  TMM::FieldsZX *__pyx_v_resCpp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_xs;
  __Pyx_Buffer __pyx_pybuffer_xs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_zs;
  __Pyx_Buffer __pyx_pybuffer_zs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  eigency::Map<Eigen::ArrayXd>  __pyx_t_1;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_2;
  TMM::FieldsZX *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetFields2D", 0);
  __pyx_pybuffer_zs.pybuffer.buf = NULL;
  __pyx_pybuffer_zs.refcount = 0;
  __pyx_pybuffernd_zs.data = NULL;
  __pyx_pybuffernd_zs.rcbuffer = &__pyx_pybuffer_zs;
  __pyx_pybuffer_xs.pybuffer.buf = NULL;
  __pyx_pybuffer_xs.refcount = 0;
  __pyx_pybuffernd_xs.data = NULL;
  __pyx_pybuffernd_xs.rcbuffer = &__pyx_pybuffer_xs;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zs.rcbuffer->pybuffer, (PyObject*)__pyx_v_zs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1219, __pyx_L1_error)
  }
  __pyx_pybuffernd_zs.diminfo[0].strides = __pyx_pybuffernd_zs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zs.diminfo[0].shape = __pyx_pybuffernd_zs.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xs.rcbuffer->pybuffer, (PyObject*)__pyx_v_xs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1219, __pyx_L1_error)
  }
  __pyx_pybuffernd_xs.diminfo[0].strides = __pyx_pybuffernd_xs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xs.diminfo[0].shape = __pyx_pybuffernd_xs.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1242
 *         """
 *         cdef FieldsZXCpp *resCpp;
 *         resCpp = self._thisptr.GetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), WaveDirectionFromStr(dir))             # <<<<<<<<<<<<<<
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 */
  try {
    __pyx_t_1 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_zs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1242, __pyx_L1_error)
  }
  try {
    __pyx_t_2 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_xs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1242, __pyx_L1_error)
  }
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->GetFields2D(__pyx_t_1, __pyx_t_2, __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(__pyx_v_dir));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1242, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1243
 *         cdef FieldsZXCpp *resCpp;
 *         resCpp = self._thisptr.GetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), WaveDirectionFromStr(dir))
 *         res = _FieldsZX()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp)
 *         return res
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1244
 *         resCpp = self._thisptr.GetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), WaveDirectionFromStr(dir))
 *         res = _FieldsZX()
 *         res._Init(resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1245
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def GetAbsorbedIntensity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1219
 *         return res
 * 
 *     def GetFields2D(self, np.ndarray[double, ndim = 1] zs, np.ndarray[double, ndim = 1] xs, str dir = "total"):             # <<<<<<<<<<<<<<
 *         """GetFields2D(zs, xs, dir = "total")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  { 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_xs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1247
 *         return res
 * 
 *     def GetAbsorbedIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetAbsorbedIntensity()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_19GetAbsorbedIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_18GetAbsorbedIntensity[] = "GetAbsorbedIntensity()\n        \n        Calculates intensity of absorption. The structure must be solved first.\n        \n        Returns\n        -------\n        float\n            Absorption intensity\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_19GetAbsorbedIntensity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetAbsorbedIntensity (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_18GetAbsorbedIntensity(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_18GetAbsorbedIntensity(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetAbsorbedIntensity", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1258
 * 
 *         """
 *         return self._thisptr.GetAbsorbedIntensity();             # <<<<<<<<<<<<<<
 * 
 *     def GetEnhancement(self, int layerNr, double z = 0.0):
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetAbsorbedIntensity();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1258, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1247
 *         return res
 * 
 *     def GetAbsorbedIntensity(self):             # <<<<<<<<<<<<<<
 *         """GetAbsorbedIntensity()
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1260
 *         return self._thisptr.GetAbsorbedIntensity();
 * 
 *     def GetEnhancement(self, int layerNr, double z = 0.0):             # <<<<<<<<<<<<<<
 *         """GetEnhancement(layerNr, z = 0.0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_21GetEnhancement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_20GetEnhancement[] = "GetEnhancement(layerNr, z = 0.0)\n        \n        Calculates the enhancement of electical field norm at specified layer at\n        fixed z-cooridnate.\n        \n        Parameters\n        ----------\n        layerNr : int\n            Number of layer where to calculate the enhancement.\n        z : float\n            Z-distance from the beginning of the layer.\n            \n        Returns\n        -------\n        float\n            The enhancment of the electrical field norm in comparison to the\n            input wave in the vacuum.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_21GetEnhancement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_layerNr;
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetEnhancement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_layerNr,&__pyx_n_s_z,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "GetEnhancement") < 0)) __PYX_ERR(0, 1260, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_layerNr = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1260, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_z = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1260, __pyx_L3_error)
    } else {
      __pyx_v_z = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("GetEnhancement", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.GetEnhancement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_20GetEnhancement(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_layerNr, __pyx_v_z);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_20GetEnhancement(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_z) {
  double __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetEnhancement", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1281
 *         """
 *         cdef double res
 *         res = self._thisptr.GetEnhancement(layerNr, z)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetEnhancement(__pyx_v_layerNr, __pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1281, __pyx_L1_error)
  }
  __pyx_v_res = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1282
 *         cdef double res
 *         res = self._thisptr.GetEnhancement(layerNr, z)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     # Waves
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1260
 *         return self._thisptr.GetAbsorbedIntensity();
 * 
 *     def GetEnhancement(self, int layerNr, double z = 0.0):             # <<<<<<<<<<<<<<
 *         """GetEnhancement(layerNr, z = 0.0)
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1286
 *     # Waves
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_23WaveGetPowerFlows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_22WaveGetPowerFlows[] = "WaveGetPowerFlows(layerNr, x0 = float(\"nan\"), x1 = float(\"nan\"), z = 0.0)\n        \n        Analogous to the :any:`GetIntensities`, but calculates the powers of the\n        beams instead of the intensities of the plane-waves.\n        \n        Parameters\n        ----------\n        layerNr : int\n            Specifies layer number where to calculate the power of the beam.\n        x0 : float\n            Specifies the starting point of the integration of the power in the\n            x-direction. By default this parameter is selected by the :any:`_Wave`\n            class.\n        x1 : float\n            Specifies the end point of the integration of the power in the\n            x-direction. By default this parameter is selected by the :any:`_Wave`\n            class.\n        z : float\n            Specifies the z-position of the line through which the integration\n            of the power of the beam is done.\n            \n        Returns\n        -------\n        tuple of floats (PB, PF)\n            PB is the power propageted into netagtive infinity and PF denotes\n            the power propagation to the positive direction of z-axis.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_23WaveGetPowerFlows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_layerNr;
  double __pyx_v_x0;
  double __pyx_v_x1;
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveGetPowerFlows (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_layerNr,&__pyx_n_s_x0,&__pyx_n_s_x1,&__pyx_n_s_z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveGetPowerFlows") < 0)) __PYX_ERR(0, 1286, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_layerNr = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_x0 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_x0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    } else {
      __pyx_v_x0 = __pyx_k__22;
    }
    if (values[2]) {
      __pyx_v_x1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_x1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    } else {
      __pyx_v_x1 = __pyx_k__23;
    }
    if (values[3]) {
      __pyx_v_z = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L3_error)
    } else {
      __pyx_v_z = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveGetPowerFlows", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveGetPowerFlows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_22WaveGetPowerFlows(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_layerNr, __pyx_v_x0, __pyx_v_x1, __pyx_v_z);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_22WaveGetPowerFlows(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_x0, double __pyx_v_x1, double __pyx_v_z) {
  std::pair<double,double>  __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::pair<double,double>  __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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("WaveGetPowerFlows", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1317
 *         # NonlinearLayer has its own specific method
 *         cdef pair[double, double] res;
 *         res = self._thisptr.WaveGetPowerFlows(layerNr, x0, x1, z)             # <<<<<<<<<<<<<<
 *         return (res.first, res.second)
 * 
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->WaveGetPowerFlows(__pyx_v_layerNr, __pyx_v_x0, __pyx_v_x1, __pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1317, __pyx_L1_error)
  }
  __pyx_v_res = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1318
 *         cdef pair[double, double] res;
 *         res = self._thisptr.WaveGetPowerFlows(layerNr, x0, x1, z)
 *         return (res.first, res.second)             # <<<<<<<<<<<<<<
 * 
 *     def WaveGetEnhancement(self, int layerNr, double z = 0.0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_res.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_res.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1286
 *     # Waves
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveGetPowerFlows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1320
 *         return (res.first, res.second)
 * 
 *     def WaveGetEnhancement(self, int layerNr, double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetEnhancement(layerNr, z = 0.0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_25WaveGetEnhancement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_24WaveGetEnhancement[] = "WaveGetEnhancement(layerNr, z = 0.0)\n        \n        Calculates enhencment of electical field norm in comparison to the imput\n        beam in vacuum. Analogous to :any:`GetEnhancement`.\n        \n        Parameters\n        ----------\n        layerNr : int\n            Number of layer where to calculate the enhancement.\n        z : float\n            Z-distance from the beginning of the layer.\n            \n        Returns\n        -------\n        float\n            The enhancment of the electrical field norm in comparison to the\n            input wave in the vacuum.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_25WaveGetEnhancement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_layerNr;
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveGetEnhancement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_layerNr,&__pyx_n_s_z,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveGetEnhancement") < 0)) __PYX_ERR(0, 1320, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_layerNr = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1320, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_z = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1320, __pyx_L3_error)
    } else {
      __pyx_v_z = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveGetEnhancement", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1320, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveGetEnhancement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_24WaveGetEnhancement(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_layerNr, __pyx_v_z);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_24WaveGetEnhancement(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_z) {
  double __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WaveGetEnhancement", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1341
 *         """
 *         cdef double res
 *         res = self._thisptr.WaveGetEnhancement(layerNr, z)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->WaveGetEnhancement(__pyx_v_layerNr, __pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1341, __pyx_L1_error)
  }
  __pyx_v_res = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1342
 *         cdef double res
 *         res = self._thisptr.WaveGetEnhancement(layerNr, z)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1320
 *         return (res.first, res.second)
 * 
 *     def WaveGetEnhancement(self, int layerNr, double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetEnhancement(layerNr, z = 0.0)
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1344
 *         return res
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \             # <<<<<<<<<<<<<<
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_27WaveSweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_26WaveSweep[] = "WaveSweep(paramStr, values, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False)\n        \n        Solves the structure for waves for series of :any:`values` of param\n        :any:`paramStr`. Using this function is more confortable and faster than just\n        changing params and solving the structure. Analogous to :any:`Sweep`.\n        \n        Parameters\n        ----------\n        paramStr : str\n            'wl':\n                Wavelength in meters\n            'beta':\n                normalized tangential wavevector\n            'I0':\n                intensity of the wave\n            'd_i':\n                thikness of layer i (0..N-1)\n            'w0':\n                waist size of the input beam\n        values : ndarray of floats\n            Correspondig values of param :any:`paramStr`.\n        layerNr : int\n            Specifies layer, where electrical field enhancment is calculated.\n        layerZ : double\n            Specifies z-coordinate of enchncment calculation inside :any:`layerNr`.\n        outPwr : bool\n            Turns calculation of all powers on/off.\n        outR : bool\n            Turns calculation of reflected power on/off.\n        outT : bool\n            Turns calculation of transmitted power on/off.\n        outEnh : bool\n            Turns calculation of enhancment in layer layerNr at distance\n            :any:`layerZ` on/off.\n        \n        Returns\n        -------\n        :any:`_SweepResultNonlinearTMM`\n            Helper class to store the result.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_27WaveSweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_paramStr = 0;
  PyArrayObject *__pyx_v_values = 0;
  int __pyx_v_layerNr;
  double __pyx_v_layerZ;
  bool __pyx_v_outPwr;
  bool __pyx_v_outR;
  bool __pyx_v_outT;
  bool __pyx_v_outEnh;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveSweep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paramStr,&__pyx_n_s_values,&__pyx_n_s_layerNr,&__pyx_n_s_layerZ,&__pyx_n_s_outPwr,&__pyx_n_s_outR,&__pyx_n_s_outT,&__pyx_n_s_outEnh,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramStr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("WaveSweep", 0, 2, 8, 1); __PYX_ERR(0, 1344, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerZ);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outPwr);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outR);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outT);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outEnh);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveSweep") < 0)) __PYX_ERR(0, 1344, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_paramStr = ((PyObject*)values[0]);
    __pyx_v_values = ((PyArrayObject *)values[1]);
    if (values[2]) {
      __pyx_v_layerNr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1345, __pyx_L3_error)
    } else {
      __pyx_v_layerNr = ((int)0);
    }
    if (values[3]) {
      __pyx_v_layerZ = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_layerZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1345, __pyx_L3_error)
    } else {
      __pyx_v_layerZ = ((double)0.0);
    }
    if (values[4]) {
      __pyx_v_outPwr = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_outPwr == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1345, __pyx_L3_error)
    } else {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1345
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \             # <<<<<<<<<<<<<<
 *             bool outR = False, bool outT = False, bool outEnh = False):
 *         """WaveSweep(paramStr, values, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False)
 */
      __pyx_v_outPwr = ((bool)1);
    }
    if (values[5]) {
      __pyx_v_outR = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_outR == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1346, __pyx_L3_error)
    } else {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1346
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False):             # <<<<<<<<<<<<<<
 *         """WaveSweep(paramStr, values, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False)
 * 
 */
      __pyx_v_outR = ((bool)0);
    }
    if (values[6]) {
      __pyx_v_outT = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_outT == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1346, __pyx_L3_error)
    } else {
      __pyx_v_outT = ((bool)0);
    }
    if (values[7]) {
      __pyx_v_outEnh = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_outEnh == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1346, __pyx_L3_error)
    } else {
      __pyx_v_outEnh = ((bool)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveSweep", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveSweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_paramStr), (&PyString_Type), 1, "paramStr", 1))) __PYX_ERR(0, 1344, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) __PYX_ERR(0, 1344, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_26WaveSweep(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_paramStr, __pyx_v_values, __pyx_v_layerNr, __pyx_v_layerZ, __pyx_v_outPwr, __pyx_v_outR, __pyx_v_outT, __pyx_v_outEnh);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1344
 *         return res
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \             # <<<<<<<<<<<<<<
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_26WaveSweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_values, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outR, bool __pyx_v_outT, bool __pyx_v_outEnh) {
  TMM::WaveSweepResultNonlinearTMM *__pyx_v_resCpp;
  int __pyx_v_outmask;
  enum TMM::TMMParam __pyx_v_param;
  int __pyx_v_paramLayer;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_5;
  TMM::WaveSweepResultNonlinearTMM *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WaveSweep", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1389
 *         """
 *         cdef WaveSweepResultNonlinearTMMCpp *resCpp;
 *         cdef int outmask = 0             # <<<<<<<<<<<<<<
 * 
 *         if outPwr:
 */
  __pyx_v_outmask = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1391
 *         cdef int outmask = 0
 * 
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 */
  __pyx_t_1 = (__pyx_v_outPwr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1392
 * 
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS             # <<<<<<<<<<<<<<
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_PWRFLOWS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1391
 *         cdef int outmask = 0
 * 
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1393
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 *         if outR:
 */
  __pyx_t_1 = (__pyx_v_outEnh != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1394
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 *             outmask |= SWEEP_ENH             # <<<<<<<<<<<<<<
 *         if outR:
 *             outmask |= SWEEP_R
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ENH);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1393
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 *         if outR:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1395
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 *         if outR:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_R
 *         if outT:
 */
  __pyx_t_1 = (__pyx_v_outR != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1396
 *             outmask |= SWEEP_ENH
 *         if outR:
 *             outmask |= SWEEP_R             # <<<<<<<<<<<<<<
 *         if outT:
 *             outmask |= SWEEP_T
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_R);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1395
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 *         if outR:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_R
 *         if outT:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1397
 *         if outR:
 *             outmask |= SWEEP_R
 *         if outT:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_T
 * 
 */
  __pyx_t_1 = (__pyx_v_outT != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1398
 *             outmask |= SWEEP_R
 *         if outT:
 *             outmask |= SWEEP_T             # <<<<<<<<<<<<<<
 * 
 *         cdef TMMParamCpp param;
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_T);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1397
 *         if outR:
 *             outmask |= SWEEP_R
 *         if outT:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_T
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1401
 * 
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;             # <<<<<<<<<<<<<<
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 */
  __pyx_v_paramLayer = -1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1402
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
  if (unlikely(__pyx_v_paramStr == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
    __PYX_ERR(0, 1402, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(__pyx_v_paramStr, __pyx_n_s_d_2, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1402, __pyx_L1_error)
  if ((__pyx_t_1 != 0)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1403
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D             # <<<<<<<<<<<<<<
 *             paramLayer = int(paramStr[2:])
 *         else:
 */
    __pyx_v_param = TMM::PARAM_LAYER_D;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1404
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])             # <<<<<<<<<<<<<<
 *         else:
 *             param = TmmParamFromStr(paramStr)
 */
    if (unlikely(__pyx_v_paramStr == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1404, __pyx_L1_error)
    }
    __pyx_t_2 = PySequence_GetSlice(__pyx_v_paramStr, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1404, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_paramLayer = __pyx_t_4;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1402
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
    goto __pyx_L7;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1406
 *             paramLayer = int(paramStr[2:])
 *         else:
 *             param = TmmParamFromStr(paramStr)             # <<<<<<<<<<<<<<
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 */
  /*else*/ {
    __pyx_v_param = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(__pyx_v_paramStr);
  }
  __pyx_L7:;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1408
 *             param = TmmParamFromStr(paramStr)
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)             # <<<<<<<<<<<<<<
 *         res = _WaveSweepResultNonlinearTMM()
 *         res._Init(resCpp);
 */
  try {
    __pyx_t_5 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_values));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1408, __pyx_L1_error)
  }
  try {
    __pyx_t_6 = __pyx_v_self->_thisptr->WaveSweep(__pyx_v_param, __pyx_t_5, __pyx_v_outmask, __pyx_v_paramLayer, __pyx_v_layerNr, __pyx_v_layerZ);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1408, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_6;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1409
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 *         res = _WaveSweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp);
 *         return res
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1410
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](values), outmask, paramLayer, layerNr, layerZ)
 *         res = _WaveSweepResultNonlinearTMM()
 *         res._Init(resCpp);             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1411
 *         res = _WaveSweepResultNonlinearTMM()
 *         res._Init(resCpp);
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1344
 *         return res
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] values, \             # <<<<<<<<<<<<<<
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { 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_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveSweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1413
 *         return res
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \             # <<<<<<<<<<<<<<
 *             np.ndarray[double, ndim = 1] xs, str dirStr = "total"):
 *         """WaveGetFields2D(zs, xs, dirStr = "total")
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_29WaveGetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_28WaveGetFields2D[] = "WaveGetFields2D(zs, xs, dirStr = \"total\")\n        \n        Calculates 2D electric and magnetic fields of beam propagating in the\n        structure. Analogous to the :any:`GetFields2D` of plane waves.\n        \n        Parameters\n        ----------\n        zs : ndarray of floats\n            Points on z-axis where to calculate the fields. The beginning of the\n            first layer is at z = 0.\n        xs : ndarray of floats\n            Points on x-axis where to calculate the fields.\n        dir : {'total', 'forward', 'backward'}\n            Specifies the components of the output fields.\n            \n        Returns\n        -------\n        :any:`_FieldsZX`\n            Helper class to store electric and magnetic fields in regular grid.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_29WaveGetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_zs = 0;
  PyArrayObject *__pyx_v_xs = 0;
  PyObject *__pyx_v_dirStr = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveGetFields2D (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zs,&__pyx_n_s_xs,&__pyx_n_s_dirStr,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject*)__pyx_n_s_total);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("WaveGetFields2D", 0, 2, 3, 1); __PYX_ERR(0, 1413, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dirStr);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveGetFields2D") < 0)) __PYX_ERR(0, 1413, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_zs = ((PyArrayObject *)values[0]);
    __pyx_v_xs = ((PyArrayObject *)values[1]);
    __pyx_v_dirStr = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveGetFields2D", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1413, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveGetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zs), __pyx_ptype_5numpy_ndarray, 1, "zs", 0))) __PYX_ERR(0, 1413, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xs), __pyx_ptype_5numpy_ndarray, 1, "xs", 0))) __PYX_ERR(0, 1414, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dirStr), (&PyString_Type), 1, "dirStr", 1))) __PYX_ERR(0, 1414, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_28WaveGetFields2D(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), __pyx_v_zs, __pyx_v_xs, __pyx_v_dirStr);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_28WaveGetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dirStr) {
  TMM::FieldsZX *__pyx_v_resCpp;
  enum TMM::WaveDirection __pyx_v_direction;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_xs;
  __Pyx_Buffer __pyx_pybuffer_xs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_zs;
  __Pyx_Buffer __pyx_pybuffer_zs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  eigency::Map<Eigen::ArrayXd>  __pyx_t_1;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_2;
  TMM::FieldsZX *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WaveGetFields2D", 0);
  __pyx_pybuffer_zs.pybuffer.buf = NULL;
  __pyx_pybuffer_zs.refcount = 0;
  __pyx_pybuffernd_zs.data = NULL;
  __pyx_pybuffernd_zs.rcbuffer = &__pyx_pybuffer_zs;
  __pyx_pybuffer_xs.pybuffer.buf = NULL;
  __pyx_pybuffer_xs.refcount = 0;
  __pyx_pybuffernd_xs.data = NULL;
  __pyx_pybuffernd_xs.rcbuffer = &__pyx_pybuffer_xs;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zs.rcbuffer->pybuffer, (PyObject*)__pyx_v_zs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1413, __pyx_L1_error)
  }
  __pyx_pybuffernd_zs.diminfo[0].strides = __pyx_pybuffernd_zs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zs.diminfo[0].shape = __pyx_pybuffernd_zs.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xs.rcbuffer->pybuffer, (PyObject*)__pyx_v_xs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1413, __pyx_L1_error)
  }
  __pyx_pybuffernd_xs.diminfo[0].strides = __pyx_pybuffernd_xs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xs.diminfo[0].shape = __pyx_pybuffernd_xs.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1437
 *         """
 *         cdef FieldsZXCpp *resCpp;
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)             # <<<<<<<<<<<<<<
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()
 */
  __pyx_v_direction = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(__pyx_v_dirStr);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1438
 *         cdef FieldsZXCpp *resCpp;
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)             # <<<<<<<<<<<<<<
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 */
  try {
    __pyx_t_1 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_zs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1438, __pyx_L1_error)
  }
  try {
    __pyx_t_2 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_xs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1438, __pyx_L1_error)
  }
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->WaveGetFields2D(__pyx_t_1, __pyx_t_2, __pyx_v_direction);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1438, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1439
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp)
 *         return res
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1440
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()
 *         res._Init(resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1441
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     # Getters
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1413
 *         return res
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \             # <<<<<<<<<<<<<<
 *             np.ndarray[double, ndim = 1] xs, str dirStr = "total"):
 *         """WaveGetFields2D(zs, xs, dirStr = "total")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  { 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_xs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.WaveGetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1447
 * 
 *     @property
 *     def wl(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetWl()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1448
 *     @property
 *     def wl(self):
 *         return self._thisptr.GetWl()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetWl();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1448, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1447
 * 
 *     @property
 *     def wl(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetWl()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.wl.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1478
 * 
 *     @wl.setter
 *     def wl(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetWl(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1479
 *     @wl.setter
 *     def wl(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetWl(<double>value)             # <<<<<<<<<<<<<<
 * 
 *     @beta.setter
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetWl(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1479, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1478
 * 
 *     @wl.setter
 *     def wl(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetWl(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.wl.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1451
 * 
 *     @property
 *     def beta(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetBeta()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1452
 *     @property
 *     def beta(self):
 *         return self._thisptr.GetBeta()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetBeta();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1452, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1451
 * 
 *     @property
 *     def beta(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetBeta()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.beta.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1482
 * 
 *     @beta.setter
 *     def beta(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetBeta(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1483
 *     @beta.setter
 *     def beta(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetBeta(<double>value)             # <<<<<<<<<<<<<<
 * 
 *     @pol.setter
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1483, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetBeta(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1483, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1482
 * 
 *     @beta.setter
 *     def beta(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetBeta(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.beta.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1455
 * 
 *     @property
 *     def pol(self):             # <<<<<<<<<<<<<<
 *         return "ps"[<int>self._thisptr.GetPolarization()]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  enum TMM::Polarization __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__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1456
 *     @property
 *     def pol(self):
 *         return "ps"[<int>self._thisptr.GetPolarization()]             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetPolarization();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1456, __pyx_L1_error)
  }
  __pyx_t_2 = ((int)__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_n_s_ps, __pyx_t_2, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1455
 * 
 *     @property
 *     def pol(self):             # <<<<<<<<<<<<<<
 *         return "ps"[<int>self._thisptr.GetPolarization()]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.pol.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1486
 * 
 *     @pol.setter
 *     def pol(self, polStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetPolarization(PolarizationFromStr(polStr))
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_polStr); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_polStr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_polStr));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_polStr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1487
 *     @pol.setter
 *     def pol(self, polStr):  # @DuplicatedSignature
 *         self._thisptr.SetPolarization(PolarizationFromStr(polStr))             # <<<<<<<<<<<<<<
 * 
 *     @I0.setter
 */
  if (!(likely(PyString_CheckExact(__pyx_v_polStr))||((__pyx_v_polStr) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_polStr)->tp_name), 0))) __PYX_ERR(0, 1487, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetPolarization(__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_PolarizationFromStr(((PyObject*)__pyx_v_polStr)));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1487, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1486
 * 
 *     @pol.setter
 *     def pol(self, polStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetPolarization(PolarizationFromStr(polStr))
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.pol.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1459
 * 
 *     @property
 *     def I0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetI0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1460
 *     @property
 *     def I0(self):
 *         return self._thisptr.GetI0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetI0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1459
 * 
 *     @property
 *     def I0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetI0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.I0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1490
 * 
 *     @I0.setter
 *     def I0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetI0(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1491
 *     @I0.setter
 *     def I0(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetI0(<double>value)             # <<<<<<<<<<<<<<
 * 
 *     @overrideE0.setter
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1491, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetI0(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1491, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1490
 * 
 *     @I0.setter
 *     def I0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetI0(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.I0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1463
 * 
 *     @property
 *     def overrideE0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetOverrideE0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1464
 *     @property
 *     def overrideE0(self):
 *         return self._thisptr.GetOverrideE0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetOverrideE0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1464, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1463
 * 
 *     @property
 *     def overrideE0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetOverrideE0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.overrideE0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1494
 * 
 *     @overrideE0.setter
 *     def overrideE0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetOverrideE0(<bool>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  bool __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1495
 *     @overrideE0.setter
 *     def overrideE0(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetOverrideE0(<bool>value)             # <<<<<<<<<<<<<<
 * 
 *     @E0.setter
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1495, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetOverrideE0(((bool)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1495, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1494
 * 
 *     @overrideE0.setter
 *     def overrideE0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetOverrideE0(<bool>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.overrideE0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1467
 * 
 *     @property
 *     def E0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetE0()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __pyx_t_double_complex __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1468
 *     @property
 *     def E0(self):
 *         return self._thisptr.GetE0()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetE0();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1468, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1467
 * 
 *     @property
 *     def E0(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetE0()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.E0.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1498
 * 
 *     @E0.setter
 *     def E0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetE0(<double complex>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_double_complex __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1499
 *     @E0.setter
 *     def E0(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetE0(<double complex>value)             # <<<<<<<<<<<<<<
 * 
 *     @mode.setter
 */
  __pyx_t_1 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1499, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetE0(__pyx_t_double_complex_from_parts(((double)__Pyx_CREAL(__pyx_t_1)), ((double)__Pyx_CIMAG(__pyx_t_1))));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1499, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1498
 * 
 *     @E0.setter
 *     def E0(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetE0(<double complex>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.E0.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1471
 * 
 *     @property
 *     def mode(self):             # <<<<<<<<<<<<<<
 *         return ["incident", "nonlinear"][<int>self._thisptr.GetMode()]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  enum TMM::NonlinearTmmMode __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1472
 *     @property
 *     def mode(self):
 *         return ["incident", "nonlinear"][<int>self._thisptr.GetMode()]             # <<<<<<<<<<<<<<
 * 
 *     # Setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_incident);
  __Pyx_GIVEREF(__pyx_n_s_incident);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_incident);
  __Pyx_INCREF(__pyx_n_s_nonlinear);
  __Pyx_GIVEREF(__pyx_n_s_nonlinear);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_nonlinear);
  try {
    __pyx_t_2 = __pyx_v_self->_thisptr->GetMode();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1472, __pyx_L1_error)
  }
  __pyx_t_3 = ((int)__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_t_1, __pyx_t_3, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1471
 * 
 *     @property
 *     def mode(self):             # <<<<<<<<<<<<<<
 *         return ["incident", "nonlinear"][<int>self._thisptr.GetMode()]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1502
 * 
 *     @mode.setter
 *     def mode(self, modeStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMode(NonlinearTmmModeFromStr(modeStr))
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_modeStr); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_modeStr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v_modeStr));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, PyObject *__pyx_v_modeStr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1503
 *     @mode.setter
 *     def mode(self, modeStr):  # @DuplicatedSignature
 *         self._thisptr.SetMode(NonlinearTmmModeFromStr(modeStr))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (!(likely(PyString_CheckExact(__pyx_v_modeStr))||((__pyx_v_modeStr) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_modeStr)->tp_name), 0))) __PYX_ERR(0, 1503, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetMode(__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTmmModeFromStr(((PyObject*)__pyx_v_modeStr)));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1503, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1502
 * 
 *     @mode.setter
 *     def mode(self, modeStr):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetMode(NonlinearTmmModeFromStr(modeStr))
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.mode.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1008
 * 
 *     cdef NonlinearTMMCpp *_thisptr
 *     cdef readonly list materialsCache             # <<<<<<<<<<<<<<
 *     cdef readonly list layers
 *     cdef bool _needDealloc
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->materialsCache);
  __pyx_r = __pyx_v_self->materialsCache;
  goto __pyx_L0;

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1009
 *     cdef NonlinearTMMCpp *_thisptr
 *     cdef readonly list materialsCache
 *     cdef readonly list layers             # <<<<<<<<<<<<<<
 *     cdef bool _needDealloc
 *     cdef object _parent;
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->layers);
  __pyx_r = __pyx_v_self->layers;
  goto __pyx_L0;

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1012
 *     cdef bool _needDealloc
 *     cdef object _parent;
 *     cdef readonly _Wave wave;             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, bool initStruct = True, object parent = None, **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->wave));
  __pyx_r = ((PyObject *)__pyx_v_self->wave);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_31__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_31__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_30__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_30__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_33__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_33__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_32__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_32__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1530
 *     cdef readonly object P1, P2, Gen
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities___cinit__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1533
 *         pass
 * 
 *     cdef _Init(self, SecondOrderNLIntensitiesCpp* ptr):             # <<<<<<<<<<<<<<
 *         P1 = _Intensities()
 *         P1._Init(&ptr.P1)
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self, TMM::SecondOrderNLIntensities *__pyx_v_ptr) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_P1 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_P2 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *__pyx_v_Gen = NULL;
  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("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1534
 * 
 *     cdef _Init(self, SecondOrderNLIntensitiesCpp* ptr):
 *         P1 = _Intensities()             # <<<<<<<<<<<<<<
 *         P1._Init(&ptr.P1)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P1 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1535
 *     cdef _Init(self, SecondOrderNLIntensitiesCpp* ptr):
 *         P1 = _Intensities()
 *         P1._Init(&ptr.P1)             # <<<<<<<<<<<<<<
 * 
 *         P2 = _Intensities()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_P1->__pyx_vtab)->_Init(__pyx_v_P1, (&__pyx_v_ptr->P1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1537
 *         P1._Init(&ptr.P1)
 * 
 *         P2 = _Intensities()             # <<<<<<<<<<<<<<
 *         P2._Init(&ptr.P2)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P2 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1538
 * 
 *         P2 = _Intensities()
 *         P2._Init(&ptr.P2)             # <<<<<<<<<<<<<<
 * 
 *         Gen = _Intensities()
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_P2->__pyx_vtab)->_Init(__pyx_v_P2, (&__pyx_v_ptr->P2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1540
 *         P2._Init(&ptr.P2)
 * 
 *         Gen = _Intensities()             # <<<<<<<<<<<<<<
 *         Gen._Init(&ptr.Gen)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Gen = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1541
 * 
 *         Gen = _Intensities()
 *         Gen._Init(&ptr.Gen)             # <<<<<<<<<<<<<<
 * 
 *         self.P1 = P1
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)__pyx_v_Gen->__pyx_vtab)->_Init(__pyx_v_Gen, (&__pyx_v_ptr->Gen)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1543
 *         Gen._Init(&ptr.Gen)
 * 
 *         self.P1 = P1             # <<<<<<<<<<<<<<
 *         self.P2 = P2
 *         self.Gen = Gen
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P1));
  __Pyx_GOTREF(__pyx_v_self->P1);
  __Pyx_DECREF(__pyx_v_self->P1);
  __pyx_v_self->P1 = ((PyObject *)__pyx_v_P1);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1544
 * 
 *         self.P1 = P1
 *         self.P2 = P2             # <<<<<<<<<<<<<<
 *         self.Gen = Gen
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P2));
  __Pyx_GOTREF(__pyx_v_self->P2);
  __Pyx_DECREF(__pyx_v_self->P2);
  __pyx_v_self->P2 = ((PyObject *)__pyx_v_P2);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1545
 *         self.P1 = P1
 *         self.P2 = P2
 *         self.Gen = Gen             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GOTREF(__pyx_v_self->Gen);
  __Pyx_DECREF(__pyx_v_self->Gen);
  __pyx_v_self->Gen = ((PyObject *)__pyx_v_Gen);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1533
 *         pass
 * 
 *     cdef _Init(self, SecondOrderNLIntensitiesCpp* ptr):             # <<<<<<<<<<<<<<
 *         P1 = _Intensities()
 *         P1._Init(&ptr.P1)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SecondOrderNLIntensities._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_P1);
  __Pyx_XDECREF((PyObject *)__pyx_v_P2);
  __Pyx_XDECREF((PyObject *)__pyx_v_Gen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1528
 * 
 *     """
 *     cdef readonly object P1, P2, Gen             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P1);
  __pyx_r = __pyx_v_self->P1;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P2);
  __pyx_r = __pyx_v_self->P2;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->Gen);
  __pyx_r = __pyx_v_self->Gen;
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SecondOrderNLIntensities.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_4__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SecondOrderNLIntensities.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1573
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         pass
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1574
 * 
 *     def __cinit__(self):
 *         self._thisptr = NULL             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_v_self->_thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1573
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         pass
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1577
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._thisptr:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1578
 * 
 *     def __dealloc__(self):
 *         if self._thisptr:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_thisptr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1579
 *     def __dealloc__(self):
 *         if self._thisptr:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, SweepResultSecondOrderNLTMMCpp *ptr):
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1578
 * 
 *     def __dealloc__(self):
 *         if self._thisptr:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1577
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._thisptr:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1581
 *             del self._thisptr
 * 
 *     cdef _Init(self, SweepResultSecondOrderNLTMMCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self, TMM::SweepResultSecondOrderNLTMM *__pyx_v_ptr) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_P1 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_P2 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *__pyx_v_Gen = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init __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("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1582
 * 
 *     cdef _Init(self, SweepResultSecondOrderNLTMMCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 * 
 *         P1 = _SweepResultNonlinearTMM()
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1584
 *         self._thisptr = ptr
 * 
 *         P1 = _SweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         P2 = _SweepResultNonlinearTMM()
 *         Gen = _SweepResultNonlinearTMM()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P1 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1585
 * 
 *         P1 = _SweepResultNonlinearTMM()
 *         P2 = _SweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         Gen = _SweepResultNonlinearTMM()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P2 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1586
 *         P1 = _SweepResultNonlinearTMM()
 *         P2 = _SweepResultNonlinearTMM()
 *         Gen = _SweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 * 
 *         P1._Init(&ptr.P1, False, self)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Gen = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1588
 *         Gen = _SweepResultNonlinearTMM()
 * 
 *         P1._Init(&ptr.P1, False, self)             # <<<<<<<<<<<<<<
 *         P2._Init(&ptr.P2, False, self)
 *         Gen._Init(&ptr.Gen, False, self)
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_P1->__pyx_vtab)->_Init(__pyx_v_P1, (&__pyx_v_ptr->P1), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1589
 * 
 *         P1._Init(&ptr.P1, False, self)
 *         P2._Init(&ptr.P2, False, self)             # <<<<<<<<<<<<<<
 *         Gen._Init(&ptr.Gen, False, self)
 * 
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_P2->__pyx_vtab)->_Init(__pyx_v_P2, (&__pyx_v_ptr->P2), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1590
 *         P1._Init(&ptr.P1, False, self)
 *         P2._Init(&ptr.P2, False, self)
 *         Gen._Init(&ptr.Gen, False, self)             # <<<<<<<<<<<<<<
 * 
 *         self.P1 = P1
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)__pyx_v_Gen->__pyx_vtab)->_Init(__pyx_v_Gen, (&__pyx_v_ptr->Gen), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1592
 *         Gen._Init(&ptr.Gen, False, self)
 * 
 *         self.P1 = P1             # <<<<<<<<<<<<<<
 *         self.P2 = P2
 *         self.Gen = Gen
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P1));
  __Pyx_GOTREF(__pyx_v_self->P1);
  __Pyx_DECREF(__pyx_v_self->P1);
  __pyx_v_self->P1 = ((PyObject *)__pyx_v_P1);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1593
 * 
 *         self.P1 = P1
 *         self.P2 = P2             # <<<<<<<<<<<<<<
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P2));
  __Pyx_GOTREF(__pyx_v_self->P2);
  __Pyx_DECREF(__pyx_v_self->P2);
  __pyx_v_self->P2 = ((PyObject *)__pyx_v_P2);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1594
 *         self.P1 = P1
 *         self.P2 = P2
 *         self.Gen = Gen             # <<<<<<<<<<<<<<
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GOTREF(__pyx_v_self->Gen);
  __Pyx_DECREF(__pyx_v_self->Gen);
  __pyx_v_self->Gen = ((PyObject *)__pyx_v_Gen);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1595
 *         self.P2 = P2
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()             # <<<<<<<<<<<<<<
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()
 * 
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->wlsGen)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->wlsGen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->wlsGen));
  __pyx_v_self->wlsGen = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1596
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()             # <<<<<<<<<<<<<<
 * 
 * #===============================================================================
 */
  __pyx_t_4 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->betasGen)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1596, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->betasGen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->betasGen));
  __pyx_v_self->betasGen = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1581
 *             del self._thisptr
 * 
 *     cdef _Init(self, SweepResultSecondOrderNLTMMCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

  /* 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_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SweepResultSecondOrderNLTMM._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_P1);
  __Pyx_XDECREF((PyObject *)__pyx_v_P2);
  __Pyx_XDECREF((PyObject *)__pyx_v_Gen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1570
 *     """
 *     cdef SweepResultSecondOrderNLTMMCpp *_thisptr
 *     cdef readonly object P1, P2, Gen             # <<<<<<<<<<<<<<
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P1);
  __pyx_r = __pyx_v_self->P1;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P2);
  __pyx_r = __pyx_v_self->P2;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->Gen);
  __pyx_r = __pyx_v_self->Gen;
  goto __pyx_L0;

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1571
 *     cdef SweepResultSecondOrderNLTMMCpp *_thisptr
 *     cdef readonly object P1, P2, Gen
 *     cdef readonly np.ndarray wlsGen, betasGen;             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->wlsGen));
  __pyx_r = ((PyObject *)__pyx_v_self->wlsGen);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->betasGen));
  __pyx_r = ((PyObject *)__pyx_v_self->betasGen);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SweepResultSecondOrderNLTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._SweepResultSecondOrderNLTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1625
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         pass
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1626
 * 
 *     def __cinit__(self):
 *         self._thisptr = NULL             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
  __pyx_v_self->_thisptr = NULL;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1625
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._thisptr = NULL
 *         pass
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1629
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._thisptr:
 *             del self._thisptr
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1630
 * 
 *     def __dealloc__(self):
 *         if self._thisptr:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_thisptr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1631
 *     def __dealloc__(self):
 *         if self._thisptr:
 *             del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     cdef _Init(self, WaveSweepResultSecondOrderNLTMMCpp *ptr):
 */
    delete __pyx_v_self->_thisptr;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1630
 * 
 *     def __dealloc__(self):
 *         if self._thisptr:             # <<<<<<<<<<<<<<
 *             del self._thisptr
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1629
 *         pass
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._thisptr:
 *             del self._thisptr
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1633
 *             del self._thisptr
 * 
 *     cdef _Init(self, WaveSweepResultSecondOrderNLTMMCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

static PyObject *__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM__Init(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self, TMM::WaveSweepResultSecondOrderNLTMM *__pyx_v_ptr) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_P1 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_P2 = NULL;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *__pyx_v_Gen = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init __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("_Init", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1634
 * 
 *     cdef _Init(self, WaveSweepResultSecondOrderNLTMMCpp *ptr):
 *         self._thisptr = ptr             # <<<<<<<<<<<<<<
 * 
 *         P1 = _WaveSweepResultNonlinearTMM()
 */
  __pyx_v_self->_thisptr = __pyx_v_ptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1636
 *         self._thisptr = ptr
 * 
 *         P1 = _WaveSweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         P2 = _WaveSweepResultNonlinearTMM()
 *         Gen = _WaveSweepResultNonlinearTMM()
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P1 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1637
 * 
 *         P1 = _WaveSweepResultNonlinearTMM()
 *         P2 = _WaveSweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 *         Gen = _WaveSweepResultNonlinearTMM()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_P2 = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1638
 *         P1 = _WaveSweepResultNonlinearTMM()
 *         P2 = _WaveSweepResultNonlinearTMM()
 *         Gen = _WaveSweepResultNonlinearTMM()             # <<<<<<<<<<<<<<
 * 
 *         P1._Init(&ptr.P1, False, self)
 */
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Gen = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1640
 *         Gen = _WaveSweepResultNonlinearTMM()
 * 
 *         P1._Init(&ptr.P1, False, self)             # <<<<<<<<<<<<<<
 *         P2._Init(&ptr.P2, False, self)
 *         Gen._Init(&ptr.Gen, False, self)
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_P1->__pyx_vtab)->_Init(__pyx_v_P1, (&__pyx_v_ptr->P1), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1641
 * 
 *         P1._Init(&ptr.P1, False, self)
 *         P2._Init(&ptr.P2, False, self)             # <<<<<<<<<<<<<<
 *         Gen._Init(&ptr.Gen, False, self)
 * 
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_P2->__pyx_vtab)->_Init(__pyx_v_P2, (&__pyx_v_ptr->P2), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1642
 *         P1._Init(&ptr.P1, False, self)
 *         P2._Init(&ptr.P2, False, self)
 *         Gen._Init(&ptr.Gen, False, self)             # <<<<<<<<<<<<<<
 * 
 *         self.P1 = P1
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.needDealloc = 0;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)__pyx_v_Gen->__pyx_vtab)->_Init(__pyx_v_Gen, (&__pyx_v_ptr->Gen), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1644
 *         Gen._Init(&ptr.Gen, False, self)
 * 
 *         self.P1 = P1             # <<<<<<<<<<<<<<
 *         self.P2 = P2
 *         self.Gen = Gen
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P1));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P1));
  __Pyx_GOTREF(__pyx_v_self->P1);
  __Pyx_DECREF(__pyx_v_self->P1);
  __pyx_v_self->P1 = ((PyObject *)__pyx_v_P1);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1645
 * 
 *         self.P1 = P1
 *         self.P2 = P2             # <<<<<<<<<<<<<<
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_P2));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_P2));
  __Pyx_GOTREF(__pyx_v_self->P2);
  __Pyx_DECREF(__pyx_v_self->P2);
  __pyx_v_self->P2 = ((PyObject *)__pyx_v_P2);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1646
 *         self.P1 = P1
 *         self.P2 = P2
 *         self.Gen = Gen             # <<<<<<<<<<<<<<
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Gen));
  __Pyx_GOTREF(__pyx_v_self->Gen);
  __Pyx_DECREF(__pyx_v_self->Gen);
  __pyx_v_self->Gen = ((PyObject *)__pyx_v_Gen);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1647
 *         self.P2 = P2
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()             # <<<<<<<<<<<<<<
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()
 * 
 */
  __pyx_t_3 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->wlsGen)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->wlsGen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->wlsGen));
  __pyx_v_self->wlsGen = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1648
 *         self.Gen = Gen
 *         self.wlsGen = ndarray_view(self._thisptr.wlsGen).squeeze()
 *         self.betasGen = ndarray_view(self._thisptr.betasGen).squeeze()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = ((PyObject *)eigency::ndarray_view(__pyx_v_self->_thisptr->betasGen)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_squeeze); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1648, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->betasGen);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->betasGen));
  __pyx_v_self->betasGen = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1633
 *             del self._thisptr
 * 
 *     cdef _Init(self, WaveSweepResultSecondOrderNLTMMCpp *ptr):             # <<<<<<<<<<<<<<
 *         self._thisptr = ptr
 * 
 */

  /* 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_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultSecondOrderNLTMM._Init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_P1);
  __Pyx_XDECREF((PyObject *)__pyx_v_P2);
  __Pyx_XDECREF((PyObject *)__pyx_v_Gen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1622
 *     """
 *     cdef WaveSweepResultSecondOrderNLTMMCpp *_thisptr
 *     cdef readonly object P1, P2, Gen             # <<<<<<<<<<<<<<
 *     cdef readonly np.ndarray wlsGen, betasGen;
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P1);
  __pyx_r = __pyx_v_self->P1;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P2);
  __pyx_r = __pyx_v_self->P2;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->Gen);
  __pyx_r = __pyx_v_self->Gen;
  goto __pyx_L0;

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1623
 *     cdef WaveSweepResultSecondOrderNLTMMCpp *_thisptr
 *     cdef readonly object P1, P2, Gen
 *     cdef readonly np.ndarray wlsGen, betasGen;             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->wlsGen));
  __pyx_r = ((PyObject *)__pyx_v_self->wlsGen);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->betasGen));
  __pyx_r = ((PyObject *)__pyx_v_self->betasGen);
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_4__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultSecondOrderNLTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultSecondOrderNLTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1693
 *     cdef readonly object P1, P2, Gen
 * 
 *     def __cinit__(self, str mode = "sfg", **kwargs):             # <<<<<<<<<<<<<<
 *         self._thisptr = new SecondOrderNLTMMCpp()
 *         self._thisptr.SetProcess(NonlinearProcessFromStr(mode))
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mode,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject*)__pyx_n_s_sfg);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1693, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mode = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1693, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mode), (&PyString_Type), 1, "mode", 1))) __PYX_ERR(0, 1693, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM___cinit__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_mode, __pyx_v_kwargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM___cinit__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_mode, PyObject *__pyx_v_kwargs) {
  TMM::NonlinearTMM *__pyx_v_tmmP1Ptr;
  TMM::NonlinearTMM *__pyx_v_tmmP2Ptr;
  TMM::NonlinearTMM *__pyx_v_tmmGenPtr;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_tmmP1Py = 0;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_tmmP2Py = 0;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *__pyx_v_tmmGenPy = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  TMM::SecondOrderNLTMM *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  TMM::NonlinearTMM *__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("__cinit__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1694
 * 
 *     def __cinit__(self, str mode = "sfg", **kwargs):
 *         self._thisptr = new SecondOrderNLTMMCpp()             # <<<<<<<<<<<<<<
 *         self._thisptr.SetProcess(NonlinearProcessFromStr(mode))
 *         self.materialsCache = []
 */
  try {
    __pyx_t_1 = new TMM::SecondOrderNLTMM();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1694, __pyx_L1_error)
  }
  __pyx_v_self->_thisptr = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1695
 *     def __cinit__(self, str mode = "sfg", **kwargs):
 *         self._thisptr = new SecondOrderNLTMMCpp()
 *         self._thisptr.SetProcess(NonlinearProcessFromStr(mode))             # <<<<<<<<<<<<<<
 *         self.materialsCache = []
 * 
 */
  try {
    __pyx_v_self->_thisptr->SetProcess(__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearProcessFromStr(__pyx_v_mode));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1695, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1696
 *         self._thisptr = new SecondOrderNLTMMCpp()
 *         self._thisptr.SetProcess(NonlinearProcessFromStr(mode))
 *         self.materialsCache = []             # <<<<<<<<<<<<<<
 * 
 *         # Pointers to TMM-s
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->materialsCache);
  __Pyx_DECREF(__pyx_v_self->materialsCache);
  __pyx_v_self->materialsCache = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1699
 * 
 *         # Pointers to TMM-s
 *         cdef NonlinearTMMCpp* tmmP1Ptr = self._thisptr.GetP1()             # <<<<<<<<<<<<<<
 *         cdef NonlinearTMMCpp* tmmP2Ptr = self._thisptr.GetP2()
 *         cdef NonlinearTMMCpp* tmmGenPtr = self._thisptr.GetGen()
 */
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->GetP1();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1699, __pyx_L1_error)
  }
  __pyx_v_tmmP1Ptr = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1700
 *         # Pointers to TMM-s
 *         cdef NonlinearTMMCpp* tmmP1Ptr = self._thisptr.GetP1()
 *         cdef NonlinearTMMCpp* tmmP2Ptr = self._thisptr.GetP2()             # <<<<<<<<<<<<<<
 *         cdef NonlinearTMMCpp* tmmGenPtr = self._thisptr.GetGen()
 * 
 */
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->GetP2();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1700, __pyx_L1_error)
  }
  __pyx_v_tmmP2Ptr = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1701
 *         cdef NonlinearTMMCpp* tmmP1Ptr = self._thisptr.GetP1()
 *         cdef NonlinearTMMCpp* tmmP2Ptr = self._thisptr.GetP2()
 *         cdef NonlinearTMMCpp* tmmGenPtr = self._thisptr.GetGen()             # <<<<<<<<<<<<<<
 * 
 *         # Wrapper classes
 */
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->GetGen();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1701, __pyx_L1_error)
  }
  __pyx_v_tmmGenPtr = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1704
 * 
 *         # Wrapper classes
 *         cdef NonlinearTMM tmmP1Py = NonlinearTMM(False)             # <<<<<<<<<<<<<<
 *         cdef NonlinearTMM tmmP2Py = NonlinearTMM(False)
 *         cdef NonlinearTMM tmmGenPy = NonlinearTMM(False)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_tmmP1Py = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1705
 *         # Wrapper classes
 *         cdef NonlinearTMM tmmP1Py = NonlinearTMM(False)
 *         cdef NonlinearTMM tmmP2Py = NonlinearTMM(False)             # <<<<<<<<<<<<<<
 *         cdef NonlinearTMM tmmGenPy = NonlinearTMM(False)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_tmmP2Py = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1706
 *         cdef NonlinearTMM tmmP1Py = NonlinearTMM(False)
 *         cdef NonlinearTMM tmmP2Py = NonlinearTMM(False)
 *         cdef NonlinearTMM tmmGenPy = NonlinearTMM(False)             # <<<<<<<<<<<<<<
 * 
 *         # Init wrappers
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_tmmGenPy = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1709
 * 
 *         # Init wrappers
 *         tmmP1Py._Init(tmmP1Ptr)             # <<<<<<<<<<<<<<
 *         tmmP2Py._Init(tmmP2Ptr)
 *         tmmGenPy._Init(tmmGenPtr)
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_tmmP1Py->__pyx_vtab)->_Init(__pyx_v_tmmP1Py, __pyx_v_tmmP1Ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1710
 *         # Init wrappers
 *         tmmP1Py._Init(tmmP1Ptr)
 *         tmmP2Py._Init(tmmP2Ptr)             # <<<<<<<<<<<<<<
 *         tmmGenPy._Init(tmmGenPtr)
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_tmmP2Py->__pyx_vtab)->_Init(__pyx_v_tmmP2Py, __pyx_v_tmmP2Ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1711
 *         tmmP1Py._Init(tmmP1Ptr)
 *         tmmP2Py._Init(tmmP2Ptr)
 *         tmmGenPy._Init(tmmGenPtr)             # <<<<<<<<<<<<<<
 * 
 *         # Save to members
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)__pyx_v_tmmGenPy->__pyx_vtab)->_Init(__pyx_v_tmmGenPy, __pyx_v_tmmGenPtr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1714
 * 
 *         # Save to members
 *         self.P1 = tmmP1Py             # <<<<<<<<<<<<<<
 *         self.P2 = tmmP2Py
 *         self.Gen = tmmGenPy
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_tmmP1Py));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tmmP1Py));
  __Pyx_GOTREF(__pyx_v_self->P1);
  __Pyx_DECREF(__pyx_v_self->P1);
  __pyx_v_self->P1 = ((PyObject *)__pyx_v_tmmP1Py);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1715
 *         # Save to members
 *         self.P1 = tmmP1Py
 *         self.P2 = tmmP2Py             # <<<<<<<<<<<<<<
 *         self.Gen = tmmGenPy
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_tmmP2Py));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tmmP2Py));
  __Pyx_GOTREF(__pyx_v_self->P2);
  __Pyx_DECREF(__pyx_v_self->P2);
  __pyx_v_self->P2 = ((PyObject *)__pyx_v_tmmP2Py);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1716
 *         self.P1 = tmmP1Py
 *         self.P2 = tmmP2Py
 *         self.Gen = tmmGenPy             # <<<<<<<<<<<<<<
 * 
 *         # Set params
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_tmmGenPy));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_tmmGenPy));
  __Pyx_GOTREF(__pyx_v_self->Gen);
  __Pyx_DECREF(__pyx_v_self->Gen);
  __pyx_v_self->Gen = ((PyObject *)__pyx_v_tmmGenPy);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1719
 * 
 *         # Set params
 *         self.SetParams(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_SetParams); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1719, __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_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1693
 *     cdef readonly object P1, P2, Gen
 * 
 *     def __cinit__(self, str mode = "sfg", **kwargs):             # <<<<<<<<<<<<<<
 *         self._thisptr = new SecondOrderNLTMMCpp()
 *         self._thisptr.SetProcess(NonlinearProcessFromStr(mode))
 */

  /* 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_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tmmP1Py);
  __Pyx_XDECREF((PyObject *)__pyx_v_tmmP2Py);
  __Pyx_XDECREF((PyObject *)__pyx_v_tmmGenPy);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1721
 *         self.SetParams(**kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

/* Python wrapper */
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2__dealloc__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static void __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2__dealloc__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1722
 * 
 *     def __dealloc__(self):
 *         del self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     # Methods
 */
  delete __pyx_v_self->_thisptr;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1721
 *         self.SetParams(**kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self._thisptr
 * 
 */

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

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1727
 *     #---------------------------------------------------------------------------
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_5SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_4SetParams[] = "SetParams(**kwargs)\n        \n        Helper method to set the values of all the attributes. See the docstring\n        of :any:`SecondOrderNLTMM`.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_5SetParams(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("SetParams (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("SetParams", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "SetParams", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_4SetParams(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_4SetParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("SetParams", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1734
 * 
 *         """
 *         for name, value in kwargs.iteritems():             # <<<<<<<<<<<<<<
 *             if name not in paramDictSecondOrderNLTMM:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1735
 *         """
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDictSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDictSecondOrderNLTMM, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1735, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (unlikely(__pyx_t_9)) {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1736
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDictSecondOrderNLTMM:
 *                 raise ValueError("Unknown kwarg %s" % (name))             # <<<<<<<<<<<<<<
 *             setattr(self, name, value)
 * 
 */
      __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_kwarg_s, __pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 1736, __pyx_L1_error)

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1735
 *         """
 *         for name, value in kwargs.iteritems():
 *             if name not in paramDictSecondOrderNLTMM:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)
 */
    }

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1737
 *             if name not in paramDictSecondOrderNLTMM:
 *                 raise ValueError("Unknown kwarg %s" % (name))
 *             setattr(self, name, value)             # <<<<<<<<<<<<<<
 * 
 *     def AddLayer(self, double d, Material material):
 */
    __pyx_t_10 = PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1737, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1727
 *     #---------------------------------------------------------------------------
 * 
 *     def SetParams(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """SetParams(**kwargs)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.SetParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1739
 *             setattr(self, name, value)
 * 
 *     def AddLayer(self, double d, Material material):             # <<<<<<<<<<<<<<
 *         """AddLayer(d, material)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_7AddLayer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_6AddLayer[] = "AddLayer(d, material)\n        \n        Adds layer to SecondOrderNLTMM. Equivalent of adding layer to P1, P2\n        and Gen.\n        \n        Parameters\n        ----------\n        d : float\n            layer thickness (m)\n        material : :any:`Material`\n            The class containing the material parameters.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_7AddLayer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_d;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("AddLayer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_material,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("AddLayer", 1, 2, 2, 1); __PYX_ERR(0, 1739, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "AddLayer") < 0)) __PYX_ERR(0, 1739, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_d = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_d == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1739, __pyx_L3_error)
    __pyx_v_material = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("AddLayer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1739, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.AddLayer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material), __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, 1, "material", 0))) __PYX_ERR(0, 1739, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_6AddLayer(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_d, __pyx_v_material);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_6AddLayer(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, double __pyx_v_d, struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *__pyx_v_material) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("AddLayer", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1754
 *         """
 *         # No copy of material is made
 *         self.P1.AddLayer(d, material)             # <<<<<<<<<<<<<<
 *         self.P2.AddLayer(d, material)
 *         self.Gen.AddLayer(d, material)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->P1, __pyx_n_s_AddLayer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_material));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_material));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_material));
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1755
 *         # No copy of material is made
 *         self.P1.AddLayer(d, material)
 *         self.P2.AddLayer(d, material)             # <<<<<<<<<<<<<<
 *         self.Gen.AddLayer(d, material)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->P2, __pyx_n_s_AddLayer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_v_material));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_material));
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, ((PyObject *)__pyx_v_material));
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1756
 *         self.P1.AddLayer(d, material)
 *         self.P2.AddLayer(d, material)
 *         self.Gen.AddLayer(d, material)             # <<<<<<<<<<<<<<
 * 
 *         # Cache material classes, avoids material dealloc
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->Gen, __pyx_n_s_AddLayer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, ((PyObject *)__pyx_v_material)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_material));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_material));
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, ((PyObject *)__pyx_v_material));
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1759
 * 
 *         # Cache material classes, avoids material dealloc
 *         self.materialsCache.append(material)             # <<<<<<<<<<<<<<
 * 
 *     def Solve(self):
 */
  if (unlikely(__pyx_v_self->materialsCache == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 1759, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->materialsCache, ((PyObject *)__pyx_v_material)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1759, __pyx_L1_error)

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1739
 *             setattr(self, name, value)
 * 
 *     def AddLayer(self, double d, Material material):             # <<<<<<<<<<<<<<
 *         """AddLayer(d, material)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.AddLayer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1761
 *         self.materialsCache.append(material)
 * 
 *     def Solve(self):             # <<<<<<<<<<<<<<
 *         """Solve()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_9Solve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_8Solve[] = "Solve()\n        \n        Solves the structure.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_9Solve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Solve (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_8Solve(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_8Solve(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Solve", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1767
 * 
 *         """
 *         self._thisptr.Solve()             # <<<<<<<<<<<<<<
 * 
 *     def UpdateGenParams(self):
 */
  try {
    __pyx_v_self->_thisptr->Solve();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1767, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1761
 *         self.materialsCache.append(material)
 * 
 *     def Solve(self):             # <<<<<<<<<<<<<<
 *         """Solve()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.Solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1769
 *         self._thisptr.Solve()
 * 
 *     def UpdateGenParams(self):             # <<<<<<<<<<<<<<
 *         """UpdateGenParams()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11UpdateGenParams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_10UpdateGenParams[] = "UpdateGenParams()\n        \n        Forces the update of the wavelength and beta of the generated beam :any:`Gen`.\n\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11UpdateGenParams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("UpdateGenParams (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_10UpdateGenParams(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_10UpdateGenParams(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("UpdateGenParams", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1775
 * 
 *         """
 *         self._thisptr.UpdateGenParams()             # <<<<<<<<<<<<<<
 * 
 *     def GetIntensities(self):
 */
  try {
    __pyx_v_self->_thisptr->UpdateGenParams();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1775, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1769
 *         self._thisptr.Solve()
 * 
 *     def UpdateGenParams(self):             # <<<<<<<<<<<<<<
 *         """UpdateGenParams()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.UpdateGenParams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1777
 *         self._thisptr.UpdateGenParams()
 * 
 *     def GetIntensities(self):             # <<<<<<<<<<<<<<
 *         """GetIntensities()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_13GetIntensities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_12GetIntensities[] = "GetIntensities()\n        \n        Returns the intensities and amplitutes of incident, reflected and\n        transmitted wave for :any:`P1`, :any:`P2` and :any:`Gen`.\n        The structure must be solved first.\n        \n        Returns\n        -------\n        :any:`_SecondOrderNLIntensities`\n            Helper class to hold intensity data.\n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_13GetIntensities(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("GetIntensities (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_12GetIntensities(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_12GetIntensities(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  TMM::SecondOrderNLIntensities __pyx_v_resCpp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  TMM::SecondOrderNLIntensities __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("GetIntensities", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1790
 *         """
 *         cdef SecondOrderNLIntensitiesCpp resCpp;
 *         resCpp = self._thisptr.GetIntensities();             # <<<<<<<<<<<<<<
 * 
 *         res = _SecondOrderNLIntensities()
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetIntensities();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1790, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1792
 *         resCpp = self._thisptr.GetIntensities();
 * 
 *         res = _SecondOrderNLIntensities()             # <<<<<<<<<<<<<<
 *         res._Init(&resCpp)
 *         return res
 */
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1793
 * 
 *         res = _SecondOrderNLIntensities()
 *         res._Init(&resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, (&__pyx_v_resCpp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1794
 *         res = _SecondOrderNLIntensities()
 *         res._Init(&resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, np.ndarray[double, ndim = 1] valuesP2, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, bool outEnh = False, bool outP1 = True, bool outP2 = True, bool outGen = True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1777
 *         self._thisptr.UpdateGenParams()
 * 
 *     def GetIntensities(self):             # <<<<<<<<<<<<<<
 *         """GetIntensities()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.GetIntensities", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1796
 *         return res
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, np.ndarray[double, ndim = 1] valuesP2, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, bool outEnh = False, bool outP1 = True, bool outP2 = True, bool outGen = True):             # <<<<<<<<<<<<<<
 *         """Sweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outAbs = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_15Sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14Sweep[] = "Sweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outAbs = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)\n        \n        Solves the structure for series of :any:`valuesP1` and :any:`valuesP2`\n        of param :any:`paramStr`. Using this function is more confortable and\n        faster than just changing params and solving the structure (parallelized\n        with OpenMP).\n        \n        Parameters\n        ----------\n        paramStr : str\n            'wl':\n                Wavelength in meters\n            'beta':\n                normalized tangential wavevector\n            'I0':\n                intensity of the wave\n            'd_i': thikness of layer i (0..N-1)\n        valuesP1 : ndarray of floats\n            Correspondig values of param :any:`paramStr` for :any:`P1`.\n        valuesP2 : ndarray of floats\n            Correspondig values of param :any:`paramStr` for :any:`P2`.\n        layerNr : int\n            Specifies layer, where electrical field enhancment is calculated.\n        layerZ : double\n            Specifies z-coordinate of enchncment calculation inside :any:`layerNr`.\n        outPwr : bool\n            Turns calculation of intensities on/off.\n        outAbs : bool\n            Turns calculation of absoprtiopn in the entire structure on/off.\n        outEnh : bool\n            Turns calculation of enhancment in layer :any:`layerNr` at distance\n            :any:`layerZ` on/off.values\n        outP1 : bool\n            Turns calculation of the :any:`P1` on/off.\n        outP2 : bool\n            Turns calculation of the :any:`P2` on/off.\n        outGen : bool\n            Turns calculation of the :any:`Gen` on/off.\n        \n        Returns\n        -------\n        :any:`_SweepResultSecondOrderNLTMM`\n            Helper class to store the result.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_15Sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_paramStr = 0;
  PyArrayObject *__pyx_v_valuesP1 = 0;
  PyArrayObject *__pyx_v_valuesP2 = 0;
  int __pyx_v_layerNr;
  double __pyx_v_layerZ;
  bool __pyx_v_outPwr;
  bool __pyx_v_outAbs;
  bool __pyx_v_outEnh;
  bool __pyx_v_outP1;
  bool __pyx_v_outP2;
  bool __pyx_v_outGen;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Sweep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paramStr,&__pyx_n_s_valuesP1,&__pyx_n_s_valuesP2,&__pyx_n_s_layerNr,&__pyx_n_s_layerZ,&__pyx_n_s_outPwr,&__pyx_n_s_outAbs,&__pyx_n_s_outEnh,&__pyx_n_s_outP1,&__pyx_n_s_outP2,&__pyx_n_s_outGen,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramStr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuesP1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Sweep", 0, 3, 11, 1); __PYX_ERR(0, 1796, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuesP2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Sweep", 0, 3, 11, 2); __PYX_ERR(0, 1796, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerZ);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outPwr);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outAbs);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outEnh);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outP1);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outP2);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outGen);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Sweep") < 0)) __PYX_ERR(0, 1796, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_paramStr = ((PyObject*)values[0]);
    __pyx_v_valuesP1 = ((PyArrayObject *)values[1]);
    __pyx_v_valuesP2 = ((PyArrayObject *)values[2]);
    if (values[3]) {
      __pyx_v_layerNr = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_layerNr = ((int)0);
    }
    if (values[4]) {
      __pyx_v_layerZ = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_layerZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_layerZ = ((double)0.0);
    }
    if (values[5]) {
      __pyx_v_outPwr = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_outPwr == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outPwr = ((bool)1);
    }
    if (values[6]) {
      __pyx_v_outAbs = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_outAbs == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outAbs = ((bool)0);
    }
    if (values[7]) {
      __pyx_v_outEnh = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_outEnh == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outEnh = ((bool)0);
    }
    if (values[8]) {
      __pyx_v_outP1 = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_outP1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outP1 = ((bool)1);
    }
    if (values[9]) {
      __pyx_v_outP2 = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_outP2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outP2 = ((bool)1);
    }
    if (values[10]) {
      __pyx_v_outGen = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_outGen == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
    } else {
      __pyx_v_outGen = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Sweep", 0, 3, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1796, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.Sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_paramStr), (&PyString_Type), 1, "paramStr", 1))) __PYX_ERR(0, 1796, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_valuesP1), __pyx_ptype_5numpy_ndarray, 1, "valuesP1", 0))) __PYX_ERR(0, 1796, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_valuesP2), __pyx_ptype_5numpy_ndarray, 1, "valuesP2", 0))) __PYX_ERR(0, 1796, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14Sweep(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_paramStr, __pyx_v_valuesP1, __pyx_v_valuesP2, __pyx_v_layerNr, __pyx_v_layerZ, __pyx_v_outPwr, __pyx_v_outAbs, __pyx_v_outEnh, __pyx_v_outP1, __pyx_v_outP2, __pyx_v_outGen);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14Sweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_valuesP1, PyArrayObject *__pyx_v_valuesP2, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outAbs, bool __pyx_v_outEnh, bool __pyx_v_outP1, bool __pyx_v_outP2, bool __pyx_v_outGen) {
  TMM::SweepResultSecondOrderNLTMM *__pyx_v_resCpp;
  int __pyx_v_outmask;
  enum TMM::TMMParam __pyx_v_param;
  int __pyx_v_paramLayer;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_valuesP1;
  __Pyx_Buffer __pyx_pybuffer_valuesP1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_valuesP2;
  __Pyx_Buffer __pyx_pybuffer_valuesP2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_5;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_6;
  TMM::SweepResultSecondOrderNLTMM *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Sweep", 0);
  __pyx_pybuffer_valuesP1.pybuffer.buf = NULL;
  __pyx_pybuffer_valuesP1.refcount = 0;
  __pyx_pybuffernd_valuesP1.data = NULL;
  __pyx_pybuffernd_valuesP1.rcbuffer = &__pyx_pybuffer_valuesP1;
  __pyx_pybuffer_valuesP2.pybuffer.buf = NULL;
  __pyx_pybuffer_valuesP2.refcount = 0;
  __pyx_pybuffernd_valuesP2.data = NULL;
  __pyx_pybuffernd_valuesP2.rcbuffer = &__pyx_pybuffer_valuesP2;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valuesP1.rcbuffer->pybuffer, (PyObject*)__pyx_v_valuesP1, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1796, __pyx_L1_error)
  }
  __pyx_pybuffernd_valuesP1.diminfo[0].strides = __pyx_pybuffernd_valuesP1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valuesP1.diminfo[0].shape = __pyx_pybuffernd_valuesP1.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer, (PyObject*)__pyx_v_valuesP2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1796, __pyx_L1_error)
  }
  __pyx_pybuffernd_valuesP2.diminfo[0].strides = __pyx_pybuffernd_valuesP2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valuesP2.diminfo[0].shape = __pyx_pybuffernd_valuesP2.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1843
 *         """
 *         cdef SweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0             # <<<<<<<<<<<<<<
 *         if outP1:
 *             outmask |= SWEEP_P1
 */
  __pyx_v_outmask = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1844
 *         cdef SweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0
 *         if outP1:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P1
 *         if outP2:
 */
  __pyx_t_1 = (__pyx_v_outP1 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1845
 *         cdef int outmask = 0
 *         if outP1:
 *             outmask |= SWEEP_P1             # <<<<<<<<<<<<<<
 *         if outP2:
 *             outmask |= SWEEP_P2
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_P1);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1844
 *         cdef SweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0
 *         if outP1:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P1
 *         if outP2:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1846
 *         if outP1:
 *             outmask |= SWEEP_P1
 *         if outP2:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P2
 *         if outGen:
 */
  __pyx_t_1 = (__pyx_v_outP2 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1847
 *             outmask |= SWEEP_P1
 *         if outP2:
 *             outmask |= SWEEP_P2             # <<<<<<<<<<<<<<
 *         if outGen:
 *             outmask |= SWEEP_GEN
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_P2);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1846
 *         if outP1:
 *             outmask |= SWEEP_P1
 *         if outP2:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P2
 *         if outGen:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1848
 *         if outP2:
 *             outmask |= SWEEP_P2
 *         if outGen:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 */
  __pyx_t_1 = (__pyx_v_outGen != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1849
 *             outmask |= SWEEP_P2
 *         if outGen:
 *             outmask |= SWEEP_GEN             # <<<<<<<<<<<<<<
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_GEN);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1848
 *         if outP2:
 *             outmask |= SWEEP_P2
 *         if outGen:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1850
 *         if outGen:
 *             outmask |= SWEEP_GEN
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 */
  __pyx_t_1 = (__pyx_v_outPwr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1851
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS             # <<<<<<<<<<<<<<
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_PWRFLOWS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1850
 *         if outGen:
 *             outmask |= SWEEP_GEN
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1852
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 */
  __pyx_t_1 = (__pyx_v_outAbs != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1853
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:
 *             outmask |= SWEEP_ABS             # <<<<<<<<<<<<<<
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ABS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1852
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outAbs:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1854
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 * 
 */
  __pyx_t_1 = (__pyx_v_outEnh != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1855
 *             outmask |= SWEEP_ABS
 *         if outEnh:
 *             outmask |= SWEEP_ENH             # <<<<<<<<<<<<<<
 * 
 *         cdef TMMParamCpp param;
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ENH);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1854
 *         if outAbs:
 *             outmask |= SWEEP_ABS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1858
 * 
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;             # <<<<<<<<<<<<<<
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 */
  __pyx_v_paramLayer = -1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1859
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
  if (unlikely(__pyx_v_paramStr == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
    __PYX_ERR(0, 1859, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(__pyx_v_paramStr, __pyx_n_s_d_2, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1859, __pyx_L1_error)
  if ((__pyx_t_1 != 0)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1860
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D             # <<<<<<<<<<<<<<
 *             paramLayer = int(paramStr[2:])
 *         else:
 */
    __pyx_v_param = TMM::PARAM_LAYER_D;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1861
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])             # <<<<<<<<<<<<<<
 *         else:
 *             param = TmmParamFromStr(paramStr)
 */
    if (unlikely(__pyx_v_paramStr == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1861, __pyx_L1_error)
    }
    __pyx_t_2 = PySequence_GetSlice(__pyx_v_paramStr, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1861, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_paramLayer = __pyx_t_4;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1859
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
    goto __pyx_L9;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1863
 *             paramLayer = int(paramStr[2:])
 *         else:
 *             param = TmmParamFromStr(paramStr)             # <<<<<<<<<<<<<<
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 */
  /*else*/ {
    __pyx_v_param = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(__pyx_v_paramStr);
  }
  __pyx_L9:;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1865
 *             param = TmmParamFromStr(paramStr)
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)             # <<<<<<<<<<<<<<
 *         res = _SweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);
 */
  try {
    __pyx_t_5 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_valuesP1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1865, __pyx_L1_error)
  }
  try {
    __pyx_t_6 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_valuesP2));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1865, __pyx_L1_error)
  }
  try {
    __pyx_t_7 = __pyx_v_self->_thisptr->Sweep(__pyx_v_param, __pyx_t_5, __pyx_t_6, __pyx_v_outmask, __pyx_v_paramLayer, __pyx_v_layerNr, __pyx_v_layerZ);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1865, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_7;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1866
 * 
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 *         res = _SweepResultSecondOrderNLTMM()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp);
 *         return res
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1867
 *         resCpp = self._thisptr.Sweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 *         res = _SweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1868
 *         res = _SweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1796
 *         return res
 * 
 *     def Sweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, np.ndarray[double, ndim = 1] valuesP2, int layerNr = 0, double layerZ = 0.0, bool outPwr = True, bool outAbs = False, bool outEnh = False, bool outP1 = True, bool outP2 = True, bool outGen = True):             # <<<<<<<<<<<<<<
 *         """Sweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outAbs = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { 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_valuesP1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.Sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1870
 *         return res
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_17WaveGetPowerFlows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_16WaveGetPowerFlows[] = "WaveGetPowerFlows(layerNr, x0 = float(\"nan\"), x1 = float(\"nan\"), z = 0.0)\n        \n        Analogous to the :any:`GetIntensities`, but calculates the powers of the\n        beams instead of the intensities of the plane-waves. Only for the\n        calculation of the power of generated beam. For pump beams use the\n        same method of :any:`NonlinearTMM`.\n        \n        Parameters\n        ----------\n        layerNr : int\n            Specifies layer number where to calculate the power of the beam.\n        x0 : float\n            Specifies the starting point of the integration of the power in the\n            x-direction. By default this parameter is selected by the :any:`_Wave`\n            class.\n        x1 : float\n            Specifies the end point of the integration of the power in the\n            x-direction. By default this parameter is selected by the :any:`_Wave`\n            class.\n        z : float\n            Specifies the z-position of the line through which the integration\n            of the power of the beam is done.\n            \n        Returns\n        -------\n        tuple of floats (PB, PF)\n            PB is the power propageted into netagtive infinity and PF denotes\n            the power propagation to the positive direction of z-axis.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_17WaveGetPowerFlows(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_layerNr;
  double __pyx_v_x0;
  double __pyx_v_x1;
  double __pyx_v_z;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveGetPowerFlows (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_layerNr,&__pyx_n_s_x0,&__pyx_n_s_x1,&__pyx_n_s_z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveGetPowerFlows") < 0)) __PYX_ERR(0, 1870, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_layerNr = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_x0 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_x0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    } else {
      __pyx_v_x0 = __pyx_k__33;
    }
    if (values[2]) {
      __pyx_v_x1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_x1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    } else {
      __pyx_v_x1 = __pyx_k__34;
    }
    if (values[3]) {
      __pyx_v_z = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_z == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L3_error)
    } else {
      __pyx_v_z = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveGetPowerFlows", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1870, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveGetPowerFlows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_16WaveGetPowerFlows(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_layerNr, __pyx_v_x0, __pyx_v_x1, __pyx_v_z);

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_16WaveGetPowerFlows(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, int __pyx_v_layerNr, double __pyx_v_x0, double __pyx_v_x1, double __pyx_v_z) {
  std::pair<double,double>  __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  std::pair<double,double>  __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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("WaveGetPowerFlows", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1902
 *         """
 *         cdef pair[double, double] res;
 *         res = self._thisptr.WaveGetPowerFlows(layerNr, x0, x1, z)             # <<<<<<<<<<<<<<
 *         return (res.first, res.second)
 * 
 */
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->WaveGetPowerFlows(__pyx_v_layerNr, __pyx_v_x0, __pyx_v_x1, __pyx_v_z);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1902, __pyx_L1_error)
  }
  __pyx_v_res = __pyx_t_1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1903
 *         cdef pair[double, double] res;
 *         res = self._thisptr.WaveGetPowerFlows(layerNr, x0, x1, z)
 *         return (res.first, res.second)             # <<<<<<<<<<<<<<
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, \
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_res.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_res.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1870
 *         return res
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveGetPowerFlows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1905
 *         return (res.first, res.second)
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, \             # <<<<<<<<<<<<<<
 *             np.ndarray[double, ndim = 1] valuesP2,
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_19WaveSweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_18WaveSweep[] = "WaveSweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)\n        \n        Solves the structure for waves for series of :any:`valuesP1` and :any:`valuesP2` of param\n        :any:`paramStr`. Using this function is more confortable and faster than just\n        changing the params and solving the structure. Analogous to :any:`Sweep`.\n        \n        Parameters\n        ----------\n        paramStr : str\n            'wl':\n                Wavelength in meters\n            'beta':\n                normalized tangential wavevector\n            'I0':\n                intensity of the wave\n            'd_i':\n                thikness of layer i (0..N-1)\n            'w0':\n                waist size of the input beam\n        valuesP1 : ndarray of floats\n            Correspondig values of param :any:`paramStr` for :any:`P1`.\n        valuesP2 : ndarray of floats\n            Correspondig values of param :any:`paramStr` for :any:`P2`.\n        layerNr : int\n            Specifies layer, where electrical field enhancment is calculated.\n        layerZ : double\n            Specifies z-coordinate of enchncment calculation inside :any:`layerNr`.\n        outPwr : bool\n            Turns calculation of all powers on/off.\n        outR : bool\n            Turns calculation of reflected power on/off.\n        outT : bool\n            Turns calculation of transmitted power on/off.\n        outEnh : bool\n            Turns calculation of enhancment in layer layerNr at distance\n            :any:`layerZ` on/off.\n        outP1 : bool\n            Turns calculation of the :any:`P1` on/off.\n        outP2 : bool\n            Turns calculation of the :any:`P2` on/off.\n        outGen : bool\n            Turns calculation of the :any:`Gen` on/off.\n        \n        Returns\n        -------\n        :any:`_WaveSweepResultSecondOrderNLTMM`\n            Helper class to s""tore the result.\n            \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_19WaveSweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_paramStr = 0;
  PyArrayObject *__pyx_v_valuesP1 = 0;
  PyArrayObject *__pyx_v_valuesP2 = 0;
  int __pyx_v_layerNr;
  double __pyx_v_layerZ;
  bool __pyx_v_outPwr;
  bool __pyx_v_outR;
  bool __pyx_v_outT;
  bool __pyx_v_outEnh;
  bool __pyx_v_outP1;
  bool __pyx_v_outP2;
  bool __pyx_v_outGen;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveSweep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_paramStr,&__pyx_n_s_valuesP1,&__pyx_n_s_valuesP2,&__pyx_n_s_layerNr,&__pyx_n_s_layerZ,&__pyx_n_s_outPwr,&__pyx_n_s_outR,&__pyx_n_s_outT,&__pyx_n_s_outEnh,&__pyx_n_s_outP1,&__pyx_n_s_outP2,&__pyx_n_s_outGen,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_paramStr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuesP1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("WaveSweep", 0, 3, 12, 1); __PYX_ERR(0, 1905, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuesP2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("WaveSweep", 0, 3, 12, 2); __PYX_ERR(0, 1905, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerNr);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layerZ);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outPwr);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outR);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outT);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outEnh);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outP1);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outP2);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outGen);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveSweep") < 0)) __PYX_ERR(0, 1905, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_paramStr = ((PyObject*)values[0]);
    __pyx_v_valuesP1 = ((PyArrayObject *)values[1]);
    __pyx_v_valuesP2 = ((PyArrayObject *)values[2]);
    if (values[3]) {
      __pyx_v_layerNr = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_layerNr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1907, __pyx_L3_error)
    } else {
      __pyx_v_layerNr = ((int)0);
    }
    if (values[4]) {
      __pyx_v_layerZ = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_layerZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1907, __pyx_L3_error)
    } else {
      __pyx_v_layerZ = ((double)0.0);
    }
    if (values[5]) {
      __pyx_v_outPwr = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_outPwr == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1907, __pyx_L3_error)
    } else {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1907
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, \
 *             np.ndarray[double, ndim = 1] valuesP2,
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \             # <<<<<<<<<<<<<<
 *             bool outR = False, bool outT = False, bool outEnh = False, \
 *             bool outP1 = True, bool outP2 = True, bool outGen = True):
 */
      __pyx_v_outPwr = ((bool)1);
    }
    if (values[6]) {
      __pyx_v_outR = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_outR == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1908, __pyx_L3_error)
    } else {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1908
 *             np.ndarray[double, ndim = 1] valuesP2,
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False, \             # <<<<<<<<<<<<<<
 *             bool outP1 = True, bool outP2 = True, bool outGen = True):
 *         """WaveSweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)
 */
      __pyx_v_outR = ((bool)0);
    }
    if (values[7]) {
      __pyx_v_outT = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_outT == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1908, __pyx_L3_error)
    } else {
      __pyx_v_outT = ((bool)0);
    }
    if (values[8]) {
      __pyx_v_outEnh = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_outEnh == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1908, __pyx_L3_error)
    } else {
      __pyx_v_outEnh = ((bool)0);
    }
    if (values[9]) {
      __pyx_v_outP1 = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_outP1 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1909, __pyx_L3_error)
    } else {

      /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1909
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 *             bool outR = False, bool outT = False, bool outEnh = False, \
 *             bool outP1 = True, bool outP2 = True, bool outGen = True):             # <<<<<<<<<<<<<<
 *         """WaveSweep(paramStr, valuesP1, valuesP2, layerNr = 0, layerZ = 0.0, outPwr = True, outR = False, outT = False, outEnh = False, outP1 = True, outP2 = True, outGen = True)
 * 
 */
      __pyx_v_outP1 = ((bool)1);
    }
    if (values[10]) {
      __pyx_v_outP2 = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_outP2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1909, __pyx_L3_error)
    } else {
      __pyx_v_outP2 = ((bool)1);
    }
    if (values[11]) {
      __pyx_v_outGen = __Pyx_PyObject_IsTrue(values[11]); if (unlikely((__pyx_v_outGen == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1909, __pyx_L3_error)
    } else {
      __pyx_v_outGen = ((bool)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveSweep", 0, 3, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveSweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_paramStr), (&PyString_Type), 1, "paramStr", 1))) __PYX_ERR(0, 1905, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_valuesP1), __pyx_ptype_5numpy_ndarray, 1, "valuesP1", 0))) __PYX_ERR(0, 1905, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_valuesP2), __pyx_ptype_5numpy_ndarray, 1, "valuesP2", 0))) __PYX_ERR(0, 1906, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_18WaveSweep(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_paramStr, __pyx_v_valuesP1, __pyx_v_valuesP2, __pyx_v_layerNr, __pyx_v_layerZ, __pyx_v_outPwr, __pyx_v_outR, __pyx_v_outT, __pyx_v_outEnh, __pyx_v_outP1, __pyx_v_outP2, __pyx_v_outGen);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1905
 *         return (res.first, res.second)
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, \             # <<<<<<<<<<<<<<
 *             np.ndarray[double, ndim = 1] valuesP2,
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_18WaveSweep(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_paramStr, PyArrayObject *__pyx_v_valuesP1, PyArrayObject *__pyx_v_valuesP2, int __pyx_v_layerNr, double __pyx_v_layerZ, bool __pyx_v_outPwr, bool __pyx_v_outR, bool __pyx_v_outT, bool __pyx_v_outEnh, bool __pyx_v_outP1, bool __pyx_v_outP2, bool __pyx_v_outGen) {
  TMM::WaveSweepResultSecondOrderNLTMM *__pyx_v_resCpp;
  int __pyx_v_outmask;
  enum TMM::TMMParam __pyx_v_param;
  int __pyx_v_paramLayer;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_valuesP1;
  __Pyx_Buffer __pyx_pybuffer_valuesP1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_valuesP2;
  __Pyx_Buffer __pyx_pybuffer_valuesP2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_5;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_6;
  TMM::WaveSweepResultSecondOrderNLTMM *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WaveSweep", 0);
  __pyx_pybuffer_valuesP1.pybuffer.buf = NULL;
  __pyx_pybuffer_valuesP1.refcount = 0;
  __pyx_pybuffernd_valuesP1.data = NULL;
  __pyx_pybuffernd_valuesP1.rcbuffer = &__pyx_pybuffer_valuesP1;
  __pyx_pybuffer_valuesP2.pybuffer.buf = NULL;
  __pyx_pybuffer_valuesP2.refcount = 0;
  __pyx_pybuffernd_valuesP2.data = NULL;
  __pyx_pybuffernd_valuesP2.rcbuffer = &__pyx_pybuffer_valuesP2;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valuesP1.rcbuffer->pybuffer, (PyObject*)__pyx_v_valuesP1, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1905, __pyx_L1_error)
  }
  __pyx_pybuffernd_valuesP1.diminfo[0].strides = __pyx_pybuffernd_valuesP1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valuesP1.diminfo[0].shape = __pyx_pybuffernd_valuesP1.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer, (PyObject*)__pyx_v_valuesP2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1905, __pyx_L1_error)
  }
  __pyx_pybuffernd_valuesP2.diminfo[0].strides = __pyx_pybuffernd_valuesP2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valuesP2.diminfo[0].shape = __pyx_pybuffernd_valuesP2.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1961
 * 
 *         cdef WaveSweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0             # <<<<<<<<<<<<<<
 *         if outP1:
 *             outmask |= SWEEP_P1
 */
  __pyx_v_outmask = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1962
 *         cdef WaveSweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0
 *         if outP1:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P1
 *         if outP2:
 */
  __pyx_t_1 = (__pyx_v_outP1 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1963
 *         cdef int outmask = 0
 *         if outP1:
 *             outmask |= SWEEP_P1             # <<<<<<<<<<<<<<
 *         if outP2:
 *             outmask |= SWEEP_P2
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_P1);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1962
 *         cdef WaveSweepResultSecondOrderNLTMMCpp *resCpp;
 *         cdef int outmask = 0
 *         if outP1:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P1
 *         if outP2:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1964
 *         if outP1:
 *             outmask |= SWEEP_P1
 *         if outP2:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P2
 *         if outGen:
 */
  __pyx_t_1 = (__pyx_v_outP2 != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1965
 *             outmask |= SWEEP_P1
 *         if outP2:
 *             outmask |= SWEEP_P2             # <<<<<<<<<<<<<<
 *         if outGen:
 *             outmask |= SWEEP_GEN
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_P2);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1964
 *         if outP1:
 *             outmask |= SWEEP_P1
 *         if outP2:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_P2
 *         if outGen:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1966
 *         if outP2:
 *             outmask |= SWEEP_P2
 *         if outGen:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 */
  __pyx_t_1 = (__pyx_v_outGen != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1967
 *             outmask |= SWEEP_P2
 *         if outGen:
 *             outmask |= SWEEP_GEN             # <<<<<<<<<<<<<<
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_GEN);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1966
 *         if outP2:
 *             outmask |= SWEEP_P2
 *         if outGen:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1968
 *         if outGen:
 *             outmask |= SWEEP_GEN
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 */
  __pyx_t_1 = (__pyx_v_outPwr != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1969
 *             outmask |= SWEEP_GEN
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS             # <<<<<<<<<<<<<<
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_PWRFLOWS);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1968
 *         if outGen:
 *             outmask |= SWEEP_GEN
 *         if outPwr:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1970
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 *         if outR:
 */
  __pyx_t_1 = (__pyx_v_outEnh != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1971
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:
 *             outmask |= SWEEP_ENH             # <<<<<<<<<<<<<<
 *         if outR:
 *             outmask |= SWEEP_R
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_ENH);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1970
 *         if outPwr:
 *             outmask |= SWEEP_PWRFLOWS
 *         if outEnh:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_ENH
 *         if outR:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1972
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 *         if outR:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_R
 *         if outT:
 */
  __pyx_t_1 = (__pyx_v_outR != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1973
 *             outmask |= SWEEP_ENH
 *         if outR:
 *             outmask |= SWEEP_R             # <<<<<<<<<<<<<<
 *         if outT:
 *             outmask |= SWEEP_T
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_R);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1972
 *         if outEnh:
 *             outmask |= SWEEP_ENH
 *         if outR:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_R
 *         if outT:
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1974
 *         if outR:
 *             outmask |= SWEEP_R
 *         if outT:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_T
 * 
 */
  __pyx_t_1 = (__pyx_v_outT != 0);
  if (__pyx_t_1) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1975
 *             outmask |= SWEEP_R
 *         if outT:
 *             outmask |= SWEEP_T             # <<<<<<<<<<<<<<
 * 
 *         cdef TMMParamCpp param;
 */
    __pyx_v_outmask = (__pyx_v_outmask | TMM::SWEEP_T);

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1974
 *         if outR:
 *             outmask |= SWEEP_R
 *         if outT:             # <<<<<<<<<<<<<<
 *             outmask |= SWEEP_T
 * 
 */
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1978
 * 
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;             # <<<<<<<<<<<<<<
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 */
  __pyx_v_paramLayer = -1;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1979
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
  if (unlikely(__pyx_v_paramStr == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
    __PYX_ERR(0, 1979, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(__pyx_v_paramStr, __pyx_n_s_d_2, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1979, __pyx_L1_error)
  if ((__pyx_t_1 != 0)) {

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1980
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D             # <<<<<<<<<<<<<<
 *             paramLayer = int(paramStr[2:])
 *         else:
 */
    __pyx_v_param = TMM::PARAM_LAYER_D;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1981
 *         if (paramStr.startswith("d_")):
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])             # <<<<<<<<<<<<<<
 *         else:
 *             param = TmmParamFromStr(paramStr)
 */
    if (unlikely(__pyx_v_paramStr == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1981, __pyx_L1_error)
    }
    __pyx_t_2 = PySequence_GetSlice(__pyx_v_paramStr, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_paramLayer = __pyx_t_4;

    /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1979
 *         cdef TMMParamCpp param;
 *         cdef int paramLayer = -1;
 *         if (paramStr.startswith("d_")):             # <<<<<<<<<<<<<<
 *             param = PARAM_LAYER_D
 *             paramLayer = int(paramStr[2:])
 */
    goto __pyx_L10;
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1983
 *             paramLayer = int(paramStr[2:])
 *         else:
 *             param = TmmParamFromStr(paramStr)             # <<<<<<<<<<<<<<
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 */
  /*else*/ {
    __pyx_v_param = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_TmmParamFromStr(__pyx_v_paramStr);
  }
  __pyx_L10:;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1985
 *             param = TmmParamFromStr(paramStr)
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)             # <<<<<<<<<<<<<<
 *         res = _WaveSweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);
 */
  try {
    __pyx_t_5 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_valuesP1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1985, __pyx_L1_error)
  }
  try {
    __pyx_t_6 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_valuesP2));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1985, __pyx_L1_error)
  }
  try {
    __pyx_t_7 = __pyx_v_self->_thisptr->WaveSweep(__pyx_v_param, __pyx_t_5, __pyx_t_6, __pyx_v_outmask, __pyx_v_paramLayer, __pyx_v_layerNr, __pyx_v_layerZ);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 1985, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_7;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1986
 * 
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 *         res = _WaveSweepResultSecondOrderNLTMM()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp);
 *         return res
 */
  __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1987
 *         resCpp = self._thisptr.WaveSweep(param, Map[ArrayXd](valuesP1), Map[ArrayXd](valuesP2), outmask, paramLayer, layerNr, layerZ)
 *         res = _WaveSweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1988
 *         res = _WaveSweepResultSecondOrderNLTMM()
 *         res._Init(resCpp);
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1905
 *         return (res.first, res.second)
 * 
 *     def WaveSweep(self, str paramStr, np.ndarray[double, ndim = 1] valuesP1, \             # <<<<<<<<<<<<<<
 *             np.ndarray[double, ndim = 1] valuesP2,
 *             int layerNr = 0, double layerZ = 0.0, bool outPwr = True, \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  { 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_valuesP1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveSweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valuesP2.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1990
 *         return res
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \             # <<<<<<<<<<<<<<
 *                         np.ndarray[double, ndim = 1] xs, str dirStr = "total"):
 *         """WaveGetFields2D(zs, xs, dirStr = "total")
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_21WaveGetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_20WaveGetFields2D[] = "WaveGetFields2D(zs, xs, dirStr = \"total\")\n        \n        Calculates 2D electric and magnetic fields of beam propagating in the\n        structure. Analogous to the :any:`GetFields2D` of plane waves. Only for the\n        calculation of the power of generated beam. For pump beams use the\n        same method of :any:`NonlinearTMM`.\n        \n        Parameters\n        ----------\n        zs : ndarray of floats\n            Points on z-axis where to calculate the fields. The beginning of the\n            first layer is at z = 0.\n        xs : ndarray of floats\n            Points on x-axis where to calculate the fields.\n        dir : {'total', 'forward', 'backward'}\n            Specifies the components of the output fields.\n            \n        Returns\n        -------\n        :any:`_FieldsZX`\n            Helper class to store electric and magnetic fields in regular grid.\n        \n        ";
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_21WaveGetFields2D(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_zs = 0;
  PyArrayObject *__pyx_v_xs = 0;
  PyObject *__pyx_v_dirStr = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("WaveGetFields2D (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zs,&__pyx_n_s_xs,&__pyx_n_s_dirStr,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject*)__pyx_n_s_total);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("WaveGetFields2D", 0, 2, 3, 1); __PYX_ERR(0, 1990, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dirStr);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WaveGetFields2D") < 0)) __PYX_ERR(0, 1990, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_zs = ((PyArrayObject *)values[0]);
    __pyx_v_xs = ((PyArrayObject *)values[1]);
    __pyx_v_dirStr = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("WaveGetFields2D", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1990, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveGetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zs), __pyx_ptype_5numpy_ndarray, 1, "zs", 0))) __PYX_ERR(0, 1990, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xs), __pyx_ptype_5numpy_ndarray, 1, "xs", 0))) __PYX_ERR(0, 1991, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dirStr), (&PyString_Type), 1, "dirStr", 1))) __PYX_ERR(0, 1991, __pyx_L1_error)
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_20WaveGetFields2D(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), __pyx_v_zs, __pyx_v_xs, __pyx_v_dirStr);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_20WaveGetFields2D(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyArrayObject *__pyx_v_zs, PyArrayObject *__pyx_v_xs, PyObject *__pyx_v_dirStr) {
  TMM::FieldsZX *__pyx_v_resCpp;
  enum TMM::WaveDirection __pyx_v_direction;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *__pyx_v_res = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_xs;
  __Pyx_Buffer __pyx_pybuffer_xs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_zs;
  __Pyx_Buffer __pyx_pybuffer_zs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  eigency::Map<Eigen::ArrayXd>  __pyx_t_1;
  eigency::Map<Eigen::ArrayXd>  __pyx_t_2;
  TMM::FieldsZX *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("WaveGetFields2D", 0);
  __pyx_pybuffer_zs.pybuffer.buf = NULL;
  __pyx_pybuffer_zs.refcount = 0;
  __pyx_pybuffernd_zs.data = NULL;
  __pyx_pybuffernd_zs.rcbuffer = &__pyx_pybuffer_zs;
  __pyx_pybuffer_xs.pybuffer.buf = NULL;
  __pyx_pybuffer_xs.refcount = 0;
  __pyx_pybuffernd_xs.data = NULL;
  __pyx_pybuffernd_xs.rcbuffer = &__pyx_pybuffer_xs;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zs.rcbuffer->pybuffer, (PyObject*)__pyx_v_zs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1990, __pyx_L1_error)
  }
  __pyx_pybuffernd_zs.diminfo[0].strides = __pyx_pybuffernd_zs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zs.diminfo[0].shape = __pyx_pybuffernd_zs.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xs.rcbuffer->pybuffer, (PyObject*)__pyx_v_xs, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1990, __pyx_L1_error)
  }
  __pyx_pybuffernd_xs.diminfo[0].strides = __pyx_pybuffernd_xs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xs.diminfo[0].shape = __pyx_pybuffernd_xs.rcbuffer->pybuffer.shape[0];

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2017
 * 
 *         cdef FieldsZXCpp *resCpp;
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)             # <<<<<<<<<<<<<<
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()
 */
  __pyx_v_direction = __pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_WaveDirectionFromStr(__pyx_v_dirStr);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2018
 *         cdef FieldsZXCpp *resCpp;
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)             # <<<<<<<<<<<<<<
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 */
  try {
    __pyx_t_1 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_zs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2018, __pyx_L1_error)
  }
  try {
    __pyx_t_2 = eigency::Map<Eigen::ArrayXd> (((PyArrayObject *)__pyx_v_xs));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2018, __pyx_L1_error)
  }
  try {
    __pyx_t_3 = __pyx_v_self->_thisptr->WaveGetFields2D(__pyx_t_1, __pyx_t_2, __pyx_v_direction);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2018, __pyx_L1_error)
  }
  __pyx_v_resCpp = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2019
 *         cdef WaveDirectionCpp direction = WaveDirectionFromStr(dirStr)
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()             # <<<<<<<<<<<<<<
 *         res._Init(resCpp)
 *         return res
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_res = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2020
 *         resCpp = self._thisptr.WaveGetFields2D(Map[ArrayXd](zs), Map[ArrayXd](xs), direction)
 *         res = _FieldsZX()
 *         res._Init(resCpp)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_4 = ((struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)__pyx_v_res->__pyx_vtab)->_Init(__pyx_v_res, __pyx_v_resCpp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2021
 *         res = _FieldsZX()
 *         res._Init(resCpp)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     # Getter
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1990
 *         return res
 * 
 *     def WaveGetFields2D(self, np.ndarray[double, ndim = 1] zs, \             # <<<<<<<<<<<<<<
 *                         np.ndarray[double, ndim = 1] xs, str dirStr = "total"):
 *         """WaveGetFields2D(zs, xs, dirStr = "total")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  { 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_xs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.WaveGetFields2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zs.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2027
 * 
 *     @property
 *     def deltaWlSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDeltaWlSpdc()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2028
 *     @property
 *     def deltaWlSpdc(self):
 *         return self._thisptr.GetDeltaWlSpdc()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetDeltaWlSpdc();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2028, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2027
 * 
 *     @property
 *     def deltaWlSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDeltaWlSpdc()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.deltaWlSpdc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2042
 * 
 *     @deltaWlSpdc.setter
 *     def deltaWlSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDeltaWlSpdc(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2043
 *     @deltaWlSpdc.setter
 *     def deltaWlSpdc(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetDeltaWlSpdc(<double>value)             # <<<<<<<<<<<<<<
 * 
 *     @solidAngleSpdc.setter
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2043, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetDeltaWlSpdc(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2043, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2042
 * 
 *     @deltaWlSpdc.setter
 *     def deltaWlSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDeltaWlSpdc(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.deltaWlSpdc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2031
 * 
 *     @property
 *     def solidAngleSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetSolidAngleSpdc()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2032
 *     @property
 *     def solidAngleSpdc(self):
 *         return self._thisptr.GetSolidAngleSpdc()             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetSolidAngleSpdc();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2032, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2031
 * 
 *     @property
 *     def solidAngleSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetSolidAngleSpdc()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.solidAngleSpdc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2046
 * 
 *     @solidAngleSpdc.setter
 *     def solidAngleSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetSolidAngleSpdc(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2047
 *     @solidAngleSpdc.setter
 *     def solidAngleSpdc(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetSolidAngleSpdc(<double>value)             # <<<<<<<<<<<<<<
 * 
 *     @deltaThetaSpdc.setter
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2047, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetSolidAngleSpdc(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2047, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2046
 * 
 *     @solidAngleSpdc.setter
 *     def solidAngleSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetSolidAngleSpdc(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.solidAngleSpdc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2035
 * 
 *     @property
 *     def deltaThetaSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDeltaThetaSpdc()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2036
 *     @property
 *     def deltaThetaSpdc(self):
 *         return self._thisptr.GetDeltaThetaSpdc()             # <<<<<<<<<<<<<<
 * 
 *     # Setter
 */
  __Pyx_XDECREF(__pyx_r);
  try {
    __pyx_t_1 = __pyx_v_self->_thisptr->GetDeltaThetaSpdc();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2036, __pyx_L1_error)
  }
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2035
 * 
 *     @property
 *     def deltaThetaSpdc(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr.GetDeltaThetaSpdc()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.deltaThetaSpdc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2050
 * 
 *     @deltaThetaSpdc.setter
 *     def deltaThetaSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDeltaThetaSpdc(<double>value)
 * 
 */

/* Python wrapper */
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_2__set__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_2__set__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2051
 *     @deltaThetaSpdc.setter
 *     def deltaThetaSpdc(self, value):  # @DuplicatedSignature
 *         self._thisptr.SetDeltaThetaSpdc(<double>value)             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2051, __pyx_L1_error)
  try {
    __pyx_v_self->_thisptr->SetDeltaThetaSpdc(((double)__pyx_t_1));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 2051, __pyx_L1_error)
  }

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":2050
 * 
 *     @deltaThetaSpdc.setter
 *     def deltaThetaSpdc(self, value):  # @DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self._thisptr.SetDeltaThetaSpdc(<double>value)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.deltaThetaSpdc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1691
 *     cdef SecondOrderNLTMMCpp *_thisptr
 *     cdef list materialsCache
 *     cdef readonly object P1, P2, Gen             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self, str mode = "sfg", **kwargs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P1);
  __pyx_r = __pyx_v_self->P1;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->P2);
  __pyx_r = __pyx_v_self->P2;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen___get__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen___get__(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->Gen);
  __pyx_r = __pyx_v_self->Gen;
  goto __pyx_L0;

  /* 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_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_23__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_22__reduce_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__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("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.__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_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_25__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_24__setstate_cython__(((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  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("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":735
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":736
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":735
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":738
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":739
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":738
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":741
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":742
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":741
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":744
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":745
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":744
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":747
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":748
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":747
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":750
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":751
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":752
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":751
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":754
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":750
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":929
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":930
 * 
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
 */
  Py_INCREF(__pyx_v_base);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":931
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":929
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

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

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":933
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":934
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":935
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":936
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":935
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":937
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":933
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":941
 * # 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":942
 * # 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":943
 * 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(2, 943, __pyx_L3_error)

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":942
 * # 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":944
 *     try:
 *         __pyx_import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 944, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":945
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 945, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 945, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":942
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":941
 * # 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_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":947
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":948
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":949
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 949, __pyx_L3_error)

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":948
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":950
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 950, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":951
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 951, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 951, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":948
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":947
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":953
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":954
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":955
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 955, __pyx_L3_error)

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":954
 * 
 * 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":956
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 956, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":957
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 957, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 957, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":954
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":953
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":967
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
 */

static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":979
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":967
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
 */

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

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":982
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
 */

static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_datetime64_object", 0);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":994
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  goto __pyx_L0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":982
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
 */

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

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":997
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1004
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":997
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
 */

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

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1007
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1011
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1007
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
 */

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

/* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1014
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) 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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1018
 *     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-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1014
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;
  p->_parent = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)o;
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *)o;
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor[] = {
  {"Update", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_5Update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_4Update},
  {"GetChi2Tensor", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_7GetChi2Tensor, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_6GetChi2Tensor},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._Chi2Tensor", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "_Chi2Tensor()\n    \n    This class is helper class for Material to accommodate the second-order\n    susceptibility tensor. Allows setting nonlinearities by chi2- and by d-values.\n    Possible to rotate initial tensor around all three axes.\n    \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_Material(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)o);
  p->chi2 = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_Material(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->chi2);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_Material(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)o;
  if (p->chi2) {
    e = (*v)(p->chi2, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_Material(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material *)o;
  tmp = ((PyObject*)p->chi2);
  p->chi2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_chi2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_4chi2_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_Material[] = {
  {"GetN", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_7GetN, METH_O, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_6GetN},
  {"IsNonlinear", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_9IsNonlinear, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_8IsNonlinear},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_11__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_13__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_Material[] = {
  {(char *)"chi2", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_chi2, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython.Material", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_Material), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8Material_5__call__, /*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*/
  "Material(wls, ns)\n    \n    This class describes the optical parameters of nonlinear medium. Default\n    contructor takes arrays of wavelengths and complex refractive indices and\n    does linear interpolation. For shortcut __call__ is defined as GetN.\n    \n    Parameters\n    ----------\n    wls : ndarray of floats\n        Array of wavelengths (m)\n    ns : ndarray of complex floats\n        Corresponding complex refractive indices to the wls array.\n    \n    Attributes\n    ----------\n    chi2 : :class:`_Chi2Tensor`\n        Instance of the :class:`_Chi2Tensor` helper class to store second-order nonlinearity tensor.\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_Material, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_waveType(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_waveType(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8waveType_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_pwr(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_pwr(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3pwr_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_overrideE0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_overrideE0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_10overrideE0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_E0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_E0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2E0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_w0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_w0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2w0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_Ly(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_Ly(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_2Ly_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_a(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_1a_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_nPointsInteg(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_nPointsInteg(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12nPointsInteg_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxX(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxX(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4maxX_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxX(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxX(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_11dynamicMaxX_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXCoef(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXCoef(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_15dynamicMaxXCoef_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXAddition(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXAddition(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_19dynamicMaxXAddition_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxPhi(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxPhi(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6maxPhi_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_xRange(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_6xRange_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_betas(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5betas_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_phis(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4phis_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_kxs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kxs_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_kzs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_3kzs_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_fieldProfile(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_12fieldProfile_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_expansionCoefsKx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_16expansionCoefsKx_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_beamArea(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_8beamArea_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave[] = {
  {"SetParams", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_5SetParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_4SetParams},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_7__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_9__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave[] = {
  {(char *)"waveType", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_waveType, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_waveType, (char *)0, 0},
  {(char *)"pwr", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_pwr, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_pwr, (char *)0, 0},
  {(char *)"overrideE0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_overrideE0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_overrideE0, (char *)0, 0},
  {(char *)"E0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_E0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_E0, (char *)0, 0},
  {(char *)"w0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_w0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_w0, (char *)0, 0},
  {(char *)"Ly", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_Ly, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_Ly, (char *)0, 0},
  {(char *)"a", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_a, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_a, (char *)0, 0},
  {(char *)"nPointsInteg", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_nPointsInteg, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_nPointsInteg, (char *)0, 0},
  {(char *)"maxX", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxX, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxX, (char *)0, 0},
  {(char *)"dynamicMaxX", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxX, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxX, (char *)0, 0},
  {(char *)"dynamicMaxXCoef", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXCoef, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXCoef, (char *)0, 0},
  {(char *)"dynamicMaxXAddition", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXAddition, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_dynamicMaxXAddition, (char *)0, 0},
  {(char *)"maxPhi", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxPhi, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_maxPhi, (char *)0, 0},
  {(char *)"xRange", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_xRange, 0, (char *)0, 0},
  {(char *)"betas", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_betas, 0, (char *)0, 0},
  {(char *)"phis", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_phis, 0, (char *)0, 0},
  {(char *)"kxs", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_kxs, 0, (char *)0, 0},
  {(char *)"kzs", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_kzs, 0, (char *)0, 0},
  {(char *)"fieldProfile", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_fieldProfile, 0, (char *)0, 0},
  {(char *)"expansionCoefsKx", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_expansionCoefsKx, 0, (char *)0, 0},
  {(char *)"beamArea", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave_beamArea, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._Wave", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "_Wave()\n    \n    This is a helper class for using non plane waves as an input.\n        \n    Attributes\n    ----------\n    waveType : str\n        'planewave':\n            Usual plane wave\n        'gaussian':\n            Standard Gaussian beam with waist size w0\n        'tukey':\n            Rectangular wave with cosine tapered edges (Tukey window). The width\n            is given by :any:`w0` and the tapered region is determined by :any:`a`.\n        'spdc':\n            Wave used to represent vacuum fluctuations in case of SPDC calculation.\n        Default is 'planewave'.\n    pwr : float\n        Power of the wave (in watts). Default 1.0. The area of the beam is\n        calculated as w0 * Ly.\n    overrideE0 : bool\n        if True, then :any:`pwr` is ignored and :any:`E0` is used. Default False.\n    E0 : float\n        Maximum electrical field of the beam in vacuum.\n    w0 : float\n        Waist size of the beam (in meters). Dafualt is 0.1 mm.\n    Ly : float\n        Beam size in y-direction (in meters).\n        Default is 1 mm.\n    a : float\n        Parameter used for Tukey wave. If a = 1, then the wave is perfect\n        rectangle, if a = 0.5, then half of the profile is tapered by cosines.\n        Defualt is 0.7.\n    nPointsInteg : int\n        Number of points used to represenbt the profile of the wave.\n        Default is 100.\n    maxX : float\n        The wave profile is given in x-range (-maxX..maxX). Only used if\n        dynamicMaxX is False. Default is 1 mm.\n    dynamicMaxX : bool\n        Selects between dynamic determination of x-span of the wave (region\n        where :any:`nPointsInteg` samples are taken) or fixed span by :any:`maxX`.\n        Default is True.\n    dynamicMaxXCoef : float\n        Dynamic maxX equals to the beam width (corrected to the angle of\n        incidence) times :any:`dynamicMaxXCoef`. Default is 2.0.\n    dynamicMaxXAddition : float\n        Constant factor that is added to maxX if :any:`dynamicMaxX` ""is true.\n        Default is 0.0.\n    maxPhi : float\n        Determines the maximum angle of deviation form the direction of\n        propagation of the participating fields. Increases the range of x-span\n        (i.e :any:`maxX`) if it is neccesary to limit the angular distribution of the\n        participating plane waves. Default is 0.17 rad.\n    xRange : tuple of floats (xMin, xMax)\n        Current x-span calculated from :any:`maxX`, :any:`dynamicMaxXCoef` and :any:`maxPhi`.\n        The wave must be solved to access this quantity.\n    betas : ndarray of floats\n        Normalized tangential wave vectors of plane wave expansion. The wave\n        must be solved to access this quantity.\n    phis : ndarray of floats\n        Same information as in betas, but converted to angles in respect to the\n        direction of the propagation. The wave must be solved to access this\n        quantity.\n    kxs : ndarray of floats\n        Same information as in betas, but converted to the x-component of the\n        wave vector. The wave must be solved to access this quantity.\n    kzs : ndarray of floats\n        Same information as in betas, but converted to the z-component of the\n        wave vector. The wave must be solved to access this quantity.\n    fieldProfile : tuple(2,) of ndarray of floats (xs, fiedProfile)\n        The field profile of the input wave sample by :any:`nPointsInteg` points. The\n        wave must be solved to access this quantity.\n    expansionCoefsKx : ndarray of complex\n        Array of plane wave expansion coefs.\n                \n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_inc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3inc_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_r(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1r_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_t(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1t_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_I(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1I_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_R(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1R_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_1T_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities[] = {
  {(char *)"inc", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_inc, 0, (char *)0, 0},
  {(char *)"r", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_r, 0, (char *)0, 0},
  {(char *)"t", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_t, 0, (char *)0, 0},
  {(char *)"I", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_I, 0, (char *)0, 0},
  {(char *)"R", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_R, 0, (char *)0, 0},
  {(char *)"T", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities_T, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._Intensities", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Helper class to store intensities for :class:`NonlinearTMM`.\n    \n    Attributes\n    ----------\n    inc : complex\n        Electical field amplitute of the incident plane wave.\n    r : complex\n        Electical field amplitute of the reflected plane wave.\n    t : complex\n        Electrical field amplitute of the transmitted plane wave.\n    I : float\n        Intensity of the incident plane wave.\n    R : float\n        Intensity of the reflected plane wave.\n    T : float\n        Intensity of the transmitted plane wave.\n        \n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;
  p->inc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->r = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->t = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Ii = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Ir = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->It = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Ia = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->enh = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_parent = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->inc);
  Py_CLEAR(p->r);
  Py_CLEAR(p->t);
  Py_CLEAR(p->Ii);
  Py_CLEAR(p->Ir);
  Py_CLEAR(p->It);
  Py_CLEAR(p->Ia);
  Py_CLEAR(p->enh);
  Py_CLEAR(p->_parent);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)o;
  if (p->inc) {
    e = (*v)(((PyObject *)p->inc), a); if (e) return e;
  }
  if (p->r) {
    e = (*v)(((PyObject *)p->r), a); if (e) return e;
  }
  if (p->t) {
    e = (*v)(((PyObject *)p->t), a); if (e) return e;
  }
  if (p->Ii) {
    e = (*v)(((PyObject *)p->Ii), a); if (e) return e;
  }
  if (p->Ir) {
    e = (*v)(((PyObject *)p->Ir), a); if (e) return e;
  }
  if (p->It) {
    e = (*v)(((PyObject *)p->It), a); if (e) return e;
  }
  if (p->Ia) {
    e = (*v)(((PyObject *)p->Ia), a); if (e) return e;
  }
  if (p->enh) {
    e = (*v)(((PyObject *)p->enh), a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *)o;
  tmp = ((PyObject*)p->inc);
  p->inc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->r);
  p->r = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->t);
  p->t = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Ii);
  p->Ii = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Ir);
  p->Ir = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->It);
  p->It = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Ia);
  p->Ia = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->enh);
  p->enh = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_inc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3inc_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_r(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1r_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_t(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_1t_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ii(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ii_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ir(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ir_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_It(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2It_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ia(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_2Ia_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_enh(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_3enh_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM[] = {
  {(char *)"inc", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_inc, 0, (char *)0, 0},
  {(char *)"r", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_r, 0, (char *)0, 0},
  {(char *)"t", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_t, 0, (char *)0, 0},
  {(char *)"Ii", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ii, 0, (char *)0, 0},
  {(char *)"Ir", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ir, 0, (char *)0, 0},
  {(char *)"It", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_It, 0, (char *)0, 0},
  {(char *)"Ia", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_Ia, 0, (char *)0, 0},
  {(char *)"enh", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM_enh, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._SweepResultNonlinearTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Helper class to store the result of the :any:`NonlinearTMM.Sweep` method.\n    \n    Attributes\n    ----------\n    inc : ndarray of complex\n        The complex amplitutes of the incident plane waves.\n    r : ndarray of complex\n        The complex amplitutes of the reflected plane waves.\n    t : ndarray of complex\n        The complex amplitutes of the transmitted plane waves.\n    Ii : ndarray of double\n        The intensities of the incident plane waves.\n    Ir : ndarray of double\n        The intensities of the reflected plane waves.\n    It : ndarray of double\n        The intensities of the transmitted plane waves.\n    Ia : ndarray of double\n        The intensities of asborption in the structure.\n    enh : ndarray of double\n        The enhancment values of the electrical field norm.\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;
  p->Pi = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Pr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Pt = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->enh = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->beamArea = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_parent = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->Pi);
  Py_CLEAR(p->Pr);
  Py_CLEAR(p->Pt);
  Py_CLEAR(p->enh);
  Py_CLEAR(p->beamArea);
  Py_CLEAR(p->_parent);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)o;
  if (p->Pi) {
    e = (*v)(((PyObject *)p->Pi), a); if (e) return e;
  }
  if (p->Pr) {
    e = (*v)(((PyObject *)p->Pr), a); if (e) return e;
  }
  if (p->Pt) {
    e = (*v)(((PyObject *)p->Pt), a); if (e) return e;
  }
  if (p->enh) {
    e = (*v)(((PyObject *)p->enh), a); if (e) return e;
  }
  if (p->beamArea) {
    e = (*v)(((PyObject *)p->beamArea), a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *)o;
  tmp = ((PyObject*)p->Pi);
  p->Pi = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Pr);
  p->Pr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Pt);
  p->Pt = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->enh);
  p->enh = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->beamArea);
  p->beamArea = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pi(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pi_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pr(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pr_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_2Pt_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_enh(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_3enh_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_beamArea(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_8beamArea_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM[] = {
  {(char *)"Pi", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pi, 0, (char *)0, 0},
  {(char *)"Pr", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pr, 0, (char *)0, 0},
  {(char *)"Pt", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_Pt, 0, (char *)0, 0},
  {(char *)"enh", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_enh, 0, (char *)0, 0},
  {(char *)"beamArea", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM_beamArea, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultNonlinearTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    The helper class to store the results of `WaveSweep`.\n    \n    Attributes\n    ----------\n    Pi : ndarray of floats\n        The power of the incident beam.\n    Pr : ndarray of floats\n        The power of the reflected beam.\n    Pt : ndarray of floats\n        The power of the transmitted beam.\n    enh : ndarray of floats\n        The enhancment of the beam.\n    beamArea : ndarray of floats\n        The area of the beam with correction of angle of incidence.\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;
  p->E = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->H = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->E);
  Py_CLEAR(p->H);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)o;
  if (p->E) {
    e = (*v)(((PyObject *)p->E), a); if (e) return e;
  }
  if (p->H) {
    e = (*v)(((PyObject *)p->H), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *)o;
  tmp = ((PyObject*)p->E);
  p->E = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->H);
  p->H = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_E(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1E_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_H(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_1H_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ[] = {
  {(char *)"E", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_E, 0, (char *)0, 0},
  {(char *)"H", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ_H, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._FieldsZ", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Helper class to store the results of `GetFields`.\n    \n    Attributes\n    ----------\n    E : ndarray(N, 3) of complex\n        Electrical fields along z-coordinate. First index is determines the\n        z-coorinate and the second corrorrespond to the x-, y-, z-component\n        (0..2).\n    H : ndarray(N, 3) of complex\n        Magnetic fields along z-coordinate. First index is determines the\n        z-coorinate and the second corrorrespond to the x-, y-, z-component\n        (0..2).\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;
  p->Ex = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Ey = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Ez = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Hx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Hy = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->Hz = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->Ex);
  Py_CLEAR(p->Ey);
  Py_CLEAR(p->Ez);
  Py_CLEAR(p->Hx);
  Py_CLEAR(p->Hy);
  Py_CLEAR(p->Hz);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)o;
  if (p->Ex) {
    e = (*v)(((PyObject *)p->Ex), a); if (e) return e;
  }
  if (p->Ey) {
    e = (*v)(((PyObject *)p->Ey), a); if (e) return e;
  }
  if (p->Ez) {
    e = (*v)(((PyObject *)p->Ez), a); if (e) return e;
  }
  if (p->Hx) {
    e = (*v)(((PyObject *)p->Hx), a); if (e) return e;
  }
  if (p->Hy) {
    e = (*v)(((PyObject *)p->Hy), a); if (e) return e;
  }
  if (p->Hz) {
    e = (*v)(((PyObject *)p->Hz), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *)o;
  tmp = ((PyObject*)p->Ex);
  p->Ex = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Ey);
  p->Ey = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Ez);
  p->Ez = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Hx);
  p->Hx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Hy);
  p->Hy = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Hz);
  p->Hz = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_EN(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2EN_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_HN(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2HN_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ex(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ex_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ey(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ey_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ez(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Ez_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hx_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hy(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hy_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hz(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_2Hz_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX[] = {
  {(char *)"EN", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_EN, 0, (char *)0, 0},
  {(char *)"HN", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_HN, 0, (char *)0, 0},
  {(char *)"Ex", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ex, 0, (char *)0, 0},
  {(char *)"Ey", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ey, 0, (char *)0, 0},
  {(char *)"Ez", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Ez, 0, (char *)0, 0},
  {(char *)"Hx", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hx, 0, (char *)0, 0},
  {(char *)"Hy", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hy, 0, (char *)0, 0},
  {(char *)"Hz", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX_Hz, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._FieldsZX", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Helper class to store the result of `GetFields2D` and `WaveGetFields2D`.\n    \n    Attributes\n    ----------\n    Ex : ndarray(N, M) of complex\n        Electrical field x-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.\n    Ey : ndarray(N, M) of complex\n        Electrical field y-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.\n    Ez : ndarray(N, M) of complex\n        Electrical field z-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.    \n    EN : ndarray(N, M) of float\n        Electical field norm in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate. \n    Hx : ndarray(N, M) of complex\n        Magnetic field x-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.    \n    Hy : ndarray(N, M) of complex\n        Magnetic field y-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.\n    Hz : ndarray(N, M) of complex\n        Magnetic field z-component in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.\n    HN : ndarray(N, M) of float\n        Magnetic field norm in zx-plane. First index corresponds to\n        z-coorinate and the second to the x-coordinate.\n          \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_kzF(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3kzF_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_kx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2kx_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave[] = {
  {"GetMainFields", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_3GetMainFields, METH_O, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_2GetMainFields},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave[] = {
  {(char *)"kzF", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_kzF, 0, (char *)0, 0},
  {(char *)"kx", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave_kx, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._HomogeneousWave", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Helper class for `NonlinearLayer` to describe the parameters of the\n    homogeneous waves in the layer.\n    \n    Attributes\n    ----------\n    kzF : complex\n        Z-component of the wave vector.\n    kx : float\n        X-component of the wave vector.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;
  p->hw = Py_None; Py_INCREF(Py_None);
  p->_parent = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->hw);
  Py_CLEAR(p->_parent);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)o;
  if (p->hw) {
    e = (*v)(p->hw, a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *)o;
  tmp = ((PyObject*)p->hw);
  p->hw = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_d(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_d(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_1d_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_hw(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2hw_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer[] = {
  {"GetIntensity", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_3GetIntensity, METH_O, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_2GetIntensity},
  {"GetAbsorbedIntensity", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_5GetAbsorbedIntensity, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_4GetAbsorbedIntensity},
  {"GetSrcIntensity", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_7GetSrcIntensity, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_6GetSrcIntensity},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer[] = {
  {(char *)"d", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_d, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_d, (char *)0, 0},
  {(char *)"hw", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer_hw, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._NonlinearLayer", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n        Helper class for layer specific data and mathods.\n        \n        Attributes\n        ----------\n        d : float\n            The thikness of the layer.\n            \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;
  p->materialsCache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->layers = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_parent = Py_None; Py_INCREF(Py_None);
  p->wave = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->materialsCache);
  Py_CLEAR(p->layers);
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->wave);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)o;
  if (p->materialsCache) {
    e = (*v)(p->materialsCache, a); if (e) return e;
  }
  if (p->layers) {
    e = (*v)(p->layers, a); if (e) return e;
  }
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  if (p->wave) {
    e = (*v)(((PyObject *)p->wave), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *)o;
  tmp = ((PyObject*)p->materialsCache);
  p->materialsCache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->layers);
  p->layers = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->wave);
  p->wave = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wl(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wl(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2wl_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_beta(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_beta(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4beta_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_pol(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_pol(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_3pol_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_I0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_I0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2I0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_overrideE0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_overrideE0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10overrideE0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_E0(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_E0(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_2E0_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_mode(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_mode(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4mode_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_materialsCache(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14materialsCache_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_layers(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6layers_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wave(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4wave_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM[] = {
  {"AddLayer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_5AddLayer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_4AddLayer},
  {"SetParams", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_7SetParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_6SetParams},
  {"Solve", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_9Solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_8Solve},
  {"GetIntensities", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_11GetIntensities, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_10GetIntensities},
  {"Sweep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_13Sweep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_12Sweep},
  {"GetFields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_15GetFields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_14GetFields},
  {"GetFields2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_17GetFields2D, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_16GetFields2D},
  {"GetAbsorbedIntensity", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_19GetAbsorbedIntensity, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_18GetAbsorbedIntensity},
  {"GetEnhancement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_21GetEnhancement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_20GetEnhancement},
  {"WaveGetPowerFlows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_23WaveGetPowerFlows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_22WaveGetPowerFlows},
  {"WaveGetEnhancement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_25WaveGetEnhancement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_24WaveGetEnhancement},
  {"WaveSweep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_27WaveSweep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_26WaveSweep},
  {"WaveGetFields2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_29WaveGetFields2D, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_28WaveGetFields2D},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_31__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_33__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM[] = {
  {(char *)"wl", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wl, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wl, (char *)0, 0},
  {(char *)"beta", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_beta, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_beta, (char *)0, 0},
  {(char *)"pol", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_pol, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_pol, (char *)0, 0},
  {(char *)"I0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_I0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_I0, (char *)0, 0},
  {(char *)"overrideE0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_overrideE0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_overrideE0, (char *)0, 0},
  {(char *)"E0", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_E0, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_E0, (char *)0, 0},
  {(char *)"mode", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_mode, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_mode, (char *)0, 0},
  {(char *)"materialsCache", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_materialsCache, 0, (char *)0, 0},
  {(char *)"layers", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_layers, 0, (char *)0, 0},
  {(char *)"wave", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM_wave, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython.NonlinearTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "NonlinearTMM()\n    \n    This class is mainly used to calculate linear propagation of plane waves\n    in stratified medium. It can work like ordinary TMM and calculate the propagation\n    of the input waves. It is also capable of nonlinear calculations, but\n    for this purpose use specialized class :any:`SecondOrderNLTMM`.\n    \n    Default constructor takes no arguments.\n    \n    Attributes\n    ----------\n    E0 : complex\n        The amplitude of the input plane wave (given in vaccuum, not in the first layer).\n        Only used if :any:`overrideE0` is set to True (default is False), otherwise intensity\n        :any:`I0` is used instead.\n        Default: 1.0.\n    I0 : float\n        The intensity of the input beam in the first medium. Only used if\n        :any:`overrideE0` is set to False (default).\n        Default: 1.0.\n    beta : float\n        Normalized tangential wave vector. Determines the angle of incidence through\n        relation beta = sin(theta) * n_p, where theta is angle of incidence and \n        n_p is the refractive index of the prism.\n        Default: not defined.\n    layers : list of helper class :any:`_NonlinerLayer`  \n        Allows to access layers by index.\n    mode : str\n        By default \"incident\" which corresponds to Ordinary TMM. Other mode is, \n        \"nonlinear\" but it is automatically set by :any:`SecondOrderNLTMM` (i.e, this\n        parameter has to be modified only in special cases).\n    overrideE0 : bool\n        If True, then parameter :any:`E0` is used, otherwise intensity :any:`I0` is used.\n        Default: False.\n    pol : str\n        \"p\" or \"s\" corresponding to p- and s-polarization, respectively.\n        Default: Not defined.\n    wave : :any:`_Wave`\n        Innstance of helper class :any:`_Wave` for non plane wave calculations.\n    wl : float\n        Wavelength of calculations in meters.\n    \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;
  p->P1 = Py_None; Py_INCREF(Py_None);
  p->P2 = Py_None; Py_INCREF(Py_None);
  p->Gen = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->P1);
  Py_CLEAR(p->P2);
  Py_CLEAR(p->Gen);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)o;
  if (p->P1) {
    e = (*v)(p->P1, a); if (e) return e;
  }
  if (p->P2) {
    e = (*v)(p->P2, a); if (e) return e;
  }
  if (p->Gen) {
    e = (*v)(p->Gen, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *)o;
  tmp = ((PyObject*)p->P1);
  p->P1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->P2);
  p->P2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Gen);
  p->Gen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_P1(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P1_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_P2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_2P2_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_Gen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3Gen_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_3__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_5__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities[] = {
  {(char *)"P1", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_P1, 0, (char *)0, 0},
  {(char *)"P2", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_P2, 0, (char *)0, 0},
  {(char *)"Gen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities_Gen, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._SecondOrderNLIntensities", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "_SecondOrderNLIntensities()\n    This is a helper class for `SecondOrderNLTMM`. It stores the results of\n    `GetIntensities`.\n    \n    Attributes\n    ----------\n    P1 : :any:`_Intensities`\n        Instance of `_Intensities` class and holds the intensities of second\n        inuput wave.\n    P2 : :any:`_Intensities`\n        Instance of `_Intensities` class and holds the intensities of first\n        inuput wave.\n    Gen : :any:`_Intensities`\n        Instance of `_Intensities` class and holds the intensities of generated\n        wave.\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;
  p->P1 = Py_None; Py_INCREF(Py_None);
  p->P2 = Py_None; Py_INCREF(Py_None);
  p->Gen = Py_None; Py_INCREF(Py_None);
  p->wlsGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->betasGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->P1);
  Py_CLEAR(p->P2);
  Py_CLEAR(p->Gen);
  Py_CLEAR(p->wlsGen);
  Py_CLEAR(p->betasGen);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)o;
  if (p->P1) {
    e = (*v)(p->P1, a); if (e) return e;
  }
  if (p->P2) {
    e = (*v)(p->P2, a); if (e) return e;
  }
  if (p->Gen) {
    e = (*v)(p->Gen, a); if (e) return e;
  }
  if (p->wlsGen) {
    e = (*v)(((PyObject *)p->wlsGen), a); if (e) return e;
  }
  if (p->betasGen) {
    e = (*v)(((PyObject *)p->betasGen), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *)o;
  tmp = ((PyObject*)p->P1);
  p->P1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->P2);
  p->P2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Gen);
  p->Gen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->wlsGen);
  p->wlsGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->betasGen);
  p->betasGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_P1(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P1_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_P2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_2P2_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_Gen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_3Gen_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_wlsGen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_6wlsGen_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_betasGen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_8betasGen_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM[] = {
  {(char *)"P1", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_P1, 0, (char *)0, 0},
  {(char *)"P2", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_P2, 0, (char *)0, 0},
  {(char *)"Gen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_Gen, 0, (char *)0, 0},
  {(char *)"wlsGen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_wlsGen, 0, (char *)0, 0},
  {(char *)"betasGen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM_betasGen, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._SweepResultSecondOrderNLTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "_SweepResultSecondOrderNLTMM()\n    Helper class for `SecondOrderNLTMM`. Stores the results of `Sweep` method.\n    \n    Attributes\n    ----------\n    P1 : :any:`_SweepResultNonlinearTMM`\n        Sweep results for the first input wave.\n    P2 : :any:`_SweepResultNonlinearTMM`\n        Sweep results for the second input wave.\n    Gen : :any:`_SweepResultNonlinearTMM`\n        Sweep results for the generated wave.\n    wlsGen : ndarray of floats\n        Stores the wavelength of the generated wave.\n    betasGen : ndarray of floats\n        Stores the normalized tangential wave vector the generated wave.\n        \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)o);
  p->__pyx_vtab = __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;
  p->P1 = Py_None; Py_INCREF(Py_None);
  p->P2 = Py_None; Py_INCREF(Py_None);
  p->Gen = Py_None; Py_INCREF(Py_None);
  p->wlsGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->betasGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->P1);
  Py_CLEAR(p->P2);
  Py_CLEAR(p->Gen);
  Py_CLEAR(p->wlsGen);
  Py_CLEAR(p->betasGen);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)o;
  if (p->P1) {
    e = (*v)(p->P1, a); if (e) return e;
  }
  if (p->P2) {
    e = (*v)(p->P2, a); if (e) return e;
  }
  if (p->Gen) {
    e = (*v)(p->Gen, a); if (e) return e;
  }
  if (p->wlsGen) {
    e = (*v)(((PyObject *)p->wlsGen), a); if (e) return e;
  }
  if (p->betasGen) {
    e = (*v)(((PyObject *)p->betasGen), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *)o;
  tmp = ((PyObject*)p->P1);
  p->P1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->P2);
  p->P2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Gen);
  p->Gen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->wlsGen);
  p->wlsGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->betasGen);
  p->betasGen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_P1(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P1_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_P2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_2P2_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_Gen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_3Gen_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_wlsGen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_6wlsGen_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_betasGen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_8betasGen_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_5__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_7__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM[] = {
  {(char *)"P1", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_P1, 0, (char *)0, 0},
  {(char *)"P2", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_P2, 0, (char *)0, 0},
  {(char *)"Gen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_Gen, 0, (char *)0, 0},
  {(char *)"wlsGen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_wlsGen, 0, (char *)0, 0},
  {(char *)"betasGen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM_betasGen, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython._WaveSweepResultSecondOrderNLTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "_WaveSweepResultSecondOrderNLTMM()\n    Helper class for `SecondOrderNLTMM`. Stores the results of `WaveSweep`\n    method.\n    \n    Attributes\n    ----------\n    P1 : :any:`_WaveSweepResultNonlinearTMM`\n        The sweep result of the first input beam. \n    P1 : :any:`_WaveSweepResultNonlinearTMM`\n        The sweep result of the second input beam.\n    Gen : :any:`_WaveSweepResultNonlinearTMM`\n        The sweep result of the generated beam.\n    wlsGen : ndarray of floats\n        Stores the wavelength of the generated wave.\n    betasGen : ndarray of floats\n        Stores the normalized tangential wave vector the generated wave.\n    \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static PyObject *__pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)o);
  p->materialsCache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->P1 = Py_None; Py_INCREF(Py_None);
  p->P2 = Py_None; Py_INCREF(Py_None);
  p->Gen = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM(PyObject *o) {
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->materialsCache);
  Py_CLEAR(p->P1);
  Py_CLEAR(p->P2);
  Py_CLEAR(p->Gen);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)o;
  if (p->materialsCache) {
    e = (*v)(p->materialsCache, a); if (e) return e;
  }
  if (p->P1) {
    e = (*v)(p->P1, a); if (e) return e;
  }
  if (p->P2) {
    e = (*v)(p->P2, a); if (e) return e;
  }
  if (p->Gen) {
    e = (*v)(p->Gen, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *p = (struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM *)o;
  tmp = ((PyObject*)p->materialsCache);
  p->materialsCache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->P1);
  p->P1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->P2);
  p->P2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->Gen);
  p->Gen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaWlSpdc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaWlSpdc(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11deltaWlSpdc_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_solidAngleSpdc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_solidAngleSpdc(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14solidAngleSpdc_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaThetaSpdc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_1__get__(o);
}

static int __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaThetaSpdc(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14deltaThetaSpdc_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_P1(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P1_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_P2(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_2P2_1__get__(o);
}

static PyObject *__pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_Gen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_3Gen_1__get__(o);
}

static PyMethodDef __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM[] = {
  {"SetParams", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_5SetParams, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_4SetParams},
  {"AddLayer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_7AddLayer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_6AddLayer},
  {"Solve", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_9Solve, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_8Solve},
  {"UpdateGenParams", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_11UpdateGenParams, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_10UpdateGenParams},
  {"GetIntensities", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_13GetIntensities, METH_NOARGS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_12GetIntensities},
  {"Sweep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_15Sweep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_14Sweep},
  {"WaveGetPowerFlows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_17WaveGetPowerFlows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_16WaveGetPowerFlows},
  {"WaveSweep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_19WaveSweep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_18WaveSweep},
  {"WaveGetFields2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_21WaveGetFields2D, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_20WaveGetFields2D},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_23__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_25__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM[] = {
  {(char *)"deltaWlSpdc", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaWlSpdc, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaWlSpdc, (char *)0, 0},
  {(char *)"solidAngleSpdc", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_solidAngleSpdc, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_solidAngleSpdc, (char *)0, 0},
  {(char *)"deltaThetaSpdc", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaThetaSpdc, __pyx_setprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_deltaThetaSpdc, (char *)0, 0},
  {(char *)"P1", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_P1, 0, (char *)0, 0},
  {(char *)"P2", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_P2, 0, (char *)0, 0},
  {(char *)"Gen", __pyx_getprop_12NonlinearTMM_23_SecondOrderNLTMMCython_16SecondOrderNLTMM_Gen, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM = {
  PyVarObject_HEAD_INIT(0, 0)
  "NonlinearTMM._SecondOrderNLTMMCython.SecondOrderNLTMM", /*tp_name*/
  sizeof(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "SecondOrderNLTMM(mode)\n    \n    This class calculates second-order nonliner processes (e.g. sum-frequency,\n    difference frequency generation and SPDC) in layered structures. Relies on the\n    functionality of `NonlinearTMM` class.\n    \n    Parameters\n    ----------\n    mode : str {'sfg', 'dfg', 'spdc'}\n    \n    Attributes\n    ----------\n    P1 : :any:`NonlinearTMM`\n        The inctance of the first pump wave TMM.\n    P2 : :any:`NonlinearTMM`\n        The inctance of the second pump wave TMM.\n    Gen : :any:`NonlinearTMM`\n        The inctance of the generated wave TMM.\n    deltaWlSpdc : float\n        The spectral collection window (in nanometers) of the SPDC signal. \n        Only used if :any:`mode` is set to :any:`SPDC`\n        Default: NaN.\n    solidAngleSpdc : float\n        The collection solid angle (srad) of the detector (given in vacuum). \n        Only used if :any:`mode` is set to :any:`SPDC`\n        Default: NaN.\n    deltaThetaSpdc : float\n        The horizontal collection window (rad) of the detector (given in vacuum).\n        It is used to calculate the vertical span of the detector. \n        Only used if :any:`mode` is set to :any:`SPDC`\n        Default: NaN.\n    \n    ", /*tp_doc*/
  __pyx_tp_traverse_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_traverse*/
  __pyx_tp_clear_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec__SecondOrderNLTMMCython(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__SecondOrderNLTMMCython},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_SecondOrderNLTMMCython",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_AddLayer, __pyx_k_AddLayer, sizeof(__pyx_k_AddLayer), 0, 0, 1, 1},
  {&__pyx_kp_u_AddLayer_d_material_Adds_layer_t, __pyx_k_AddLayer_d_material_Adds_layer_t, sizeof(__pyx_k_AddLayer_d_material_Adds_layer_t), 0, 1, 0, 0},
  {&__pyx_n_s_Chi2Tensor, __pyx_k_Chi2Tensor, sizeof(__pyx_k_Chi2Tensor), 0, 0, 1, 1},
  {&__pyx_kp_u_Chi2Tensor_Update_line_114, __pyx_k_Chi2Tensor_Update_line_114, sizeof(__pyx_k_Chi2Tensor_Update_line_114), 0, 1, 0, 0},
  {&__pyx_n_s_E0, __pyx_k_E0, sizeof(__pyx_k_E0), 0, 0, 1, 1},
  {&__pyx_n_s_FieldsZ, __pyx_k_FieldsZ, sizeof(__pyx_k_FieldsZ), 0, 0, 1, 1},
  {&__pyx_n_s_FieldsZX, __pyx_k_FieldsZX, sizeof(__pyx_k_FieldsZX), 0, 0, 1, 1},
  {&__pyx_n_s_GetN, __pyx_k_GetN, sizeof(__pyx_k_GetN), 0, 0, 1, 1},
  {&__pyx_kp_u_GetN_wl_Returns_refractive_index, __pyx_k_GetN_wl_Returns_refractive_index, sizeof(__pyx_k_GetN_wl_Returns_refractive_index), 0, 1, 0, 0},
  {&__pyx_n_s_HomogeneousWave, __pyx_k_HomogeneousWave, sizeof(__pyx_k_HomogeneousWave), 0, 0, 1, 1},
  {&__pyx_n_s_I0, __pyx_k_I0, sizeof(__pyx_k_I0), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_Intensities, __pyx_k_Intensities, sizeof(__pyx_k_Intensities), 0, 0, 1, 1},
  {&__pyx_n_s_Ly, __pyx_k_Ly, sizeof(__pyx_k_Ly), 0, 0, 1, 1},
  {&__pyx_n_s_Material, __pyx_k_Material, sizeof(__pyx_k_Material), 0, 0, 1, 1},
  {&__pyx_kp_u_Material_GetN_line_250, __pyx_k_Material_GetN_line_250, sizeof(__pyx_k_Material_GetN_line_250), 0, 1, 0, 0},
  {&__pyx_n_s_NonlinearLayer, __pyx_k_NonlinearLayer, sizeof(__pyx_k_NonlinearLayer), 0, 0, 1, 1},
  {&__pyx_n_s_NonlinearTMM, __pyx_k_NonlinearTMM, sizeof(__pyx_k_NonlinearTMM), 0, 0, 1, 1},
  {&__pyx_kp_u_NonlinearTMM_AddLayer_line_1042, __pyx_k_NonlinearTMM_AddLayer_line_1042, sizeof(__pyx_k_NonlinearTMM_AddLayer_line_1042), 0, 1, 0, 0},
  {&__pyx_kp_u_NonlinearTMM_Solve_line_1087, __pyx_k_NonlinearTMM_Solve_line_1087, sizeof(__pyx_k_NonlinearTMM_Solve_line_1087), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_SecondOrderNLIntensities, __pyx_k_SecondOrderNLIntensities, sizeof(__pyx_k_SecondOrderNLIntensities), 0, 0, 1, 1},
  {&__pyx_n_s_SecondOrderNLTMM, __pyx_k_SecondOrderNLTMM, sizeof(__pyx_k_SecondOrderNLTMM), 0, 0, 1, 1},
  {&__pyx_n_s_SetParams, __pyx_k_SetParams, sizeof(__pyx_k_SetParams), 0, 0, 1, 1},
  {&__pyx_kp_u_Solve_kwargs_Solves_the_structur, __pyx_k_Solve_kwargs_Solves_the_structur, sizeof(__pyx_k_Solve_kwargs_Solves_the_structur), 0, 1, 0, 0},
  {&__pyx_n_s_SweepResultNonlinearTMM, __pyx_k_SweepResultNonlinearTMM, sizeof(__pyx_k_SweepResultNonlinearTMM), 0, 0, 1, 1},
  {&__pyx_n_s_SweepResultSecondOrderNLTMM, __pyx_k_SweepResultSecondOrderNLTMM, sizeof(__pyx_k_SweepResultSecondOrderNLTMM), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Unknown_kwarg_s, __pyx_k_Unknown_kwarg_s, sizeof(__pyx_k_Unknown_kwarg_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unknown_polarization, __pyx_k_Unknown_polarization, sizeof(__pyx_k_Unknown_polarization), 0, 0, 1, 0},
  {&__pyx_kp_u_Update_kwargs_This_method_change, __pyx_k_Update_kwargs_This_method_change, sizeof(__pyx_k_Update_kwargs_This_method_change), 0, 1, 0, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Wave, __pyx_k_Wave, sizeof(__pyx_k_Wave), 0, 0, 1, 1},
  {&__pyx_n_s_WaveSweepResultNonlinearTMM, __pyx_k_WaveSweepResultNonlinearTMM, sizeof(__pyx_k_WaveSweepResultNonlinearTMM), 0, 0, 1, 1},
  {&__pyx_n_s_WaveSweepResultSecondOrderNLTMM, __pyx_k_WaveSweepResultSecondOrderNLTMM, sizeof(__pyx_k_WaveSweepResultSecondOrderNLTMM), 0, 0, 1, 1},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_backward, __pyx_k_backward, sizeof(__pyx_k_backward), 0, 0, 1, 1},
  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
  {&__pyx_n_s_chi, __pyx_k_chi, sizeof(__pyx_k_chi), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_d_2, __pyx_k_d_2, sizeof(__pyx_k_d_2), 0, 0, 1, 1},
  {&__pyx_n_s_deltaThetaSpdc, __pyx_k_deltaThetaSpdc, sizeof(__pyx_k_deltaThetaSpdc), 0, 0, 1, 1},
  {&__pyx_n_s_deltaWlSpdc, __pyx_k_deltaWlSpdc, sizeof(__pyx_k_deltaWlSpdc), 0, 0, 1, 1},
  {&__pyx_n_s_dfg, __pyx_k_dfg, sizeof(__pyx_k_dfg), 0, 0, 1, 1},
  {&__pyx_n_s_dir, __pyx_k_dir, sizeof(__pyx_k_dir), 0, 0, 1, 1},
  {&__pyx_n_s_dirStr, __pyx_k_dirStr, sizeof(__pyx_k_dirStr), 0, 0, 1, 1},
  {&__pyx_n_s_distinctFields, __pyx_k_distinctFields, sizeof(__pyx_k_distinctFields), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_dynamicMaxX, __pyx_k_dynamicMaxX, sizeof(__pyx_k_dynamicMaxX), 0, 0, 1, 1},
  {&__pyx_n_s_dynamicMaxXAddition, __pyx_k_dynamicMaxXAddition, sizeof(__pyx_k_dynamicMaxXAddition), 0, 0, 1, 1},
  {&__pyx_n_s_dynamicMaxXCoef, __pyx_k_dynamicMaxXCoef, sizeof(__pyx_k_dynamicMaxXCoef), 0, 0, 1, 1},
  {&__pyx_n_s_forward, __pyx_k_forward, sizeof(__pyx_k_forward), 0, 0, 1, 1},
  {&__pyx_n_s_gaussian, __pyx_k_gaussian, sizeof(__pyx_k_gaussian), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_incident, __pyx_k_incident, sizeof(__pyx_k_incident), 0, 0, 1, 1},
  {&__pyx_n_s_initStruct, __pyx_k_initStruct, sizeof(__pyx_k_initStruct), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_layerNr, __pyx_k_layerNr, sizeof(__pyx_k_layerNr), 0, 0, 1, 1},
  {&__pyx_n_s_layerZ, __pyx_k_layerZ, sizeof(__pyx_k_layerZ), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
  {&__pyx_n_s_maxPhi, __pyx_k_maxPhi, sizeof(__pyx_k_maxPhi), 0, 0, 1, 1},
  {&__pyx_n_s_maxX, __pyx_k_maxX, sizeof(__pyx_k_maxX), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_nPointsInteg, __pyx_k_nPointsInteg, sizeof(__pyx_k_nPointsInteg), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_nonlinear, __pyx_k_nonlinear, sizeof(__pyx_k_nonlinear), 0, 0, 1, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_ns, __pyx_k_ns, sizeof(__pyx_k_ns), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  {&__pyx_n_s_outAbs, __pyx_k_outAbs, sizeof(__pyx_k_outAbs), 0, 0, 1, 1},
  {&__pyx_n_s_outEnh, __pyx_k_outEnh, sizeof(__pyx_k_outEnh), 0, 0, 1, 1},
  {&__pyx_n_s_outGen, __pyx_k_outGen, sizeof(__pyx_k_outGen), 0, 0, 1, 1},
  {&__pyx_n_s_outP1, __pyx_k_outP1, sizeof(__pyx_k_outP1), 0, 0, 1, 1},
  {&__pyx_n_s_outP2, __pyx_k_outP2, sizeof(__pyx_k_outP2), 0, 0, 1, 1},
  {&__pyx_n_s_outPwr, __pyx_k_outPwr, sizeof(__pyx_k_outPwr), 0, 0, 1, 1},
  {&__pyx_n_s_outR, __pyx_k_outR, sizeof(__pyx_k_outR), 0, 0, 1, 1},
  {&__pyx_n_s_outT, __pyx_k_outT, sizeof(__pyx_k_outT), 0, 0, 1, 1},
  {&__pyx_n_s_overrideE0, __pyx_k_overrideE0, sizeof(__pyx_k_overrideE0), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_paramStr, __pyx_k_paramStr, sizeof(__pyx_k_paramStr), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_phiX, __pyx_k_phiX, sizeof(__pyx_k_phiX), 0, 0, 1, 1},
  {&__pyx_n_s_phiY, __pyx_k_phiY, sizeof(__pyx_k_phiY), 0, 0, 1, 1},
  {&__pyx_n_s_phiZ, __pyx_k_phiZ, sizeof(__pyx_k_phiZ), 0, 0, 1, 1},
  {&__pyx_n_s_planewave, __pyx_k_planewave, sizeof(__pyx_k_planewave), 0, 0, 1, 1},
  {&__pyx_n_s_pol, __pyx_k_pol, sizeof(__pyx_k_pol), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_ps, __pyx_k_ps, sizeof(__pyx_k_ps), 0, 0, 1, 1},
  {&__pyx_n_s_pwr, __pyx_k_pwr, sizeof(__pyx_k_pwr), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_sfg, __pyx_k_sfg, sizeof(__pyx_k_sfg), 0, 0, 1, 1},
  {&__pyx_n_s_solidAngleSpdc, __pyx_k_solidAngleSpdc, sizeof(__pyx_k_solidAngleSpdc), 0, 0, 1, 1},
  {&__pyx_n_s_spdc, __pyx_k_spdc, sizeof(__pyx_k_spdc), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_squeeze, __pyx_k_squeeze, sizeof(__pyx_k_squeeze), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_total, __pyx_k_total, sizeof(__pyx_k_total), 0, 0, 1, 1},
  {&__pyx_n_s_tukey, __pyx_k_tukey, sizeof(__pyx_k_tukey), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_valuesP1, __pyx_k_valuesP1, sizeof(__pyx_k_valuesP1), 0, 0, 1, 1},
  {&__pyx_n_s_valuesP2, __pyx_k_valuesP2, sizeof(__pyx_k_valuesP2), 0, 0, 1, 1},
  {&__pyx_n_s_w0, __pyx_k_w0, sizeof(__pyx_k_w0), 0, 0, 1, 1},
  {&__pyx_n_s_waveType, __pyx_k_waveType, sizeof(__pyx_k_waveType), 0, 0, 1, 1},
  {&__pyx_n_s_wl, __pyx_k_wl, sizeof(__pyx_k_wl), 0, 0, 1, 1},
  {&__pyx_n_s_wls, __pyx_k_wls, sizeof(__pyx_k_wls), 0, 0, 1, 1},
  {&__pyx_n_s_x0, __pyx_k_x0, sizeof(__pyx_k_x0), 0, 0, 1, 1},
  {&__pyx_n_s_x1, __pyx_k_x1, sizeof(__pyx_k_x1), 0, 0, 1, 1},
  {&__pyx_n_s_xs, __pyx_k_xs, sizeof(__pyx_k_xs), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {&__pyx_n_s_zs, __pyx_k_zs, sizeof(__pyx_k_zs), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 14, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 32, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 202, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 945, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":790
 *             self.Ez = None
 *         else:
 *             raise ValueError("Unknown polarization.")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Unknown_polarization); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1704
 * 
 *         # Wrapper classes
 *         cdef NonlinearTMM tmmP1Py = NonlinearTMM(False)             # <<<<<<<<<<<<<<
 *         cdef NonlinearTMM tmmP2Py = NonlinearTMM(False)
 *         cdef NonlinearTMM tmmGenPy = NonlinearTMM(False)
 */
  __pyx_tuple__32 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":945
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(2, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":951
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(2, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict = Py_None; Py_INCREF(Py_None);
  __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDictSecondOrderNLTMM = Py_None; Py_INCREF(Py_None);
  __pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_waveParamsSet = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor *, TMM::Chi2Tensor *, PyObject *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_11_Chi2Tensor__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Chi2Tensor, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Chi2Tensor;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Material, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_Material = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_Material;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave *, TMM::Wave *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_5_Wave__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Wave, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Wave;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities *, TMM::Intensities *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12_Intensities__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Intensities, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities) < 0) __PYX_ERR(0, 554, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__Intensities;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM *, TMM::SweepResultNonlinearTMM *, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init *__pyx_optional_args))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_24_SweepResultNonlinearTMM__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SweepResultNonlinearTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultNonlinearTMM;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM *, TMM::WaveSweepResultNonlinearTMM *, struct __pyx_opt_args_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init *__pyx_optional_args))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_WaveSweepResultNonlinearTMM__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM) < 0) __PYX_ERR(0, 649, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM) < 0) __PYX_ERR(0, 649, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_WaveSweepResultNonlinearTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM) < 0) __PYX_ERR(0, 649, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM) < 0) __PYX_ERR(0, 649, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultNonlinearTMM;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ *, TMM::FieldsZ *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_8_FieldsZ__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FieldsZ, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZ;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX *, TMM::FieldsZX *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_9_FieldsZX__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FieldsZX, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__FieldsZX;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave *, TMM::HomogeneousWave *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_16_HomogeneousWave__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HomogeneousWave, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__HomogeneousWave;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer *, TMM::NonlinearLayer *, int, PyObject *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_15_NonlinearLayer__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer) < 0) __PYX_ERR(0, 872, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer) < 0) __PYX_ERR(0, 872, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_NonlinearLayer, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer) < 0) __PYX_ERR(0, 872, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer) < 0) __PYX_ERR(0, 872, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__NonlinearLayer;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM *, TMM::NonlinearTMM *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_12NonlinearTMM__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_NonlinearTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_NonlinearTMM;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities *, TMM::SecondOrderNLIntensities *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_25_SecondOrderNLIntensities__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SecondOrderNLIntensities, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SecondOrderNLIntensities;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM *, TMM::SweepResultSecondOrderNLTMM *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_28_SweepResultSecondOrderNLTMM__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SweepResultSecondOrderNLTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__SweepResultSecondOrderNLTMM;
  __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM = &__pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;
  __pyx_vtable_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM._Init = (PyObject *(*)(struct __pyx_obj_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM *, TMM::WaveSweepResultSecondOrderNLTMM *))__pyx_f_12NonlinearTMM_23_SecondOrderNLTMMCython_32_WaveSweepResultSecondOrderNLTMM__Init;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1602, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM.tp_dict, __pyx_vtabptr_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1602, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_WaveSweepResultSecondOrderNLTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1602, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM) < 0) __PYX_ERR(0, 1602, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython__WaveSweepResultSecondOrderNLTMM;
  if (PyType_Ready(&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM) < 0) __PYX_ERR(0, 1655, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM.tp_dictoffset && __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SecondOrderNLTMM, (PyObject *)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM) < 0) __PYX_ERR(0, 1655, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM) < 0) __PYX_ERR(0, 1655, __pyx_L1_error)
  __pyx_ptype_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM = &__pyx_type_12NonlinearTMM_23_SecondOrderNLTMMCython_SecondOrderNLTMM;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 200, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 223, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 227, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 771, __pyx_L1_error)
  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 773, __pyx_L1_error)
  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 775, __pyx_L1_error)
  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 777, __pyx_L1_error)
  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 779, __pyx_L1_error)
  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 781, __pyx_L1_error)
  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 783, __pyx_L1_error)
  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 785, __pyx_L1_error)
  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 787, __pyx_L1_error)
  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 789, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC init_SecondOrderNLTMMCython(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC init_SecondOrderNLTMMCython(void)
#else
__Pyx_PyMODINIT_FUNC PyInit__SecondOrderNLTMMCython(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__SecondOrderNLTMMCython(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec__SecondOrderNLTMMCython(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  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 '_SecondOrderNLTMMCython' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__SecondOrderNLTMMCython(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("_SecondOrderNLTMMCython", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_NonlinearTMM___SecondOrderNLTMMCython) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "NonlinearTMM._SecondOrderNLTMMCython")) {
      if (unlikely(PyDict_SetItemString(modules, "NonlinearTMM._SecondOrderNLTMMCython", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1
 * import numpy as np             # <<<<<<<<<<<<<<
 * from CppSecondOrderNLTMM cimport *
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":56
 *         raise NotImplementedError()
 * 
 * cdef paramDict = {"wl": PARAM_WL, \             # <<<<<<<<<<<<<<
 *                   "beta": PARAM_BETA, \
 *                   "pol": PARAM_POL, \
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_WL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_wl, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":57
 * 
 * cdef paramDict = {"wl": PARAM_WL, \
 *                   "beta": PARAM_BETA, \             # <<<<<<<<<<<<<<
 *                   "pol": PARAM_POL, \
 *                   "I0": PARAM_I0, \
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_BETA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_beta, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":58
 * cdef paramDict = {"wl": PARAM_WL, \
 *                   "beta": PARAM_BETA, \
 *                   "pol": PARAM_POL, \             # <<<<<<<<<<<<<<
 *                   "I0": PARAM_I0, \
 *                   "overrideE0": PARAM_OVERRIDE_E0, \
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_POL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pol, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":59
 *                   "beta": PARAM_BETA, \
 *                   "pol": PARAM_POL, \
 *                   "I0": PARAM_I0, \             # <<<<<<<<<<<<<<
 *                   "overrideE0": PARAM_OVERRIDE_E0, \
 *                   "E0": PARAM_E0, \
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_I0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_I0, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":60
 *                   "pol": PARAM_POL, \
 *                   "I0": PARAM_I0, \
 *                   "overrideE0": PARAM_OVERRIDE_E0, \             # <<<<<<<<<<<<<<
 *                   "E0": PARAM_E0, \
 *                   "mode": PARAM_MODE,
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_OVERRIDE_E0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_overrideE0, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":61
 *                   "I0": PARAM_I0, \
 *                   "overrideE0": PARAM_OVERRIDE_E0, \
 *                   "E0": PARAM_E0, \             # <<<<<<<<<<<<<<
 *                   "mode": PARAM_MODE,
 *                   "w0": PARAM_WAVE_W0}
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_E0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_E0, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":62
 *                   "overrideE0": PARAM_OVERRIDE_E0, \
 *                   "E0": PARAM_E0, \
 *                   "mode": PARAM_MODE,             # <<<<<<<<<<<<<<
 *                   "w0": PARAM_WAVE_W0}
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_MODE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mode, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":63
 *                   "E0": PARAM_E0, \
 *                   "mode": PARAM_MODE,
 *                   "w0": PARAM_WAVE_W0}             # <<<<<<<<<<<<<<
 * 
 * cdef paramDictSecondOrderNLTMM = set(["deltaWlSpdc",
 */
  __pyx_t_2 = __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(TMM::PARAM_WAVE_W0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_w0, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_XGOTREF(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict);
  __Pyx_DECREF_SET(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDict, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":65
 *                   "w0": PARAM_WAVE_W0}
 * 
 * cdef paramDictSecondOrderNLTMM = set(["deltaWlSpdc",             # <<<<<<<<<<<<<<
 *                                       "solidAngleSpdc",
 *                                       "deltaThetaSpdc"])
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PySet_Add(__pyx_t_1, __pyx_n_s_deltaWlSpdc) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_solidAngleSpdc) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_deltaThetaSpdc) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDictSecondOrderNLTMM);
  __Pyx_DECREF_SET(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_paramDictSecondOrderNLTMM, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":69
 *                                       "deltaThetaSpdc"])
 * 
 * cdef waveParamsSet = set(["waveType",             # <<<<<<<<<<<<<<
 *                 "pwr",
 *                 "overrideE0",
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PySet_Add(__pyx_t_1, __pyx_n_s_waveType) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_pwr) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_overrideE0) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_E0) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_w0) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_Ly) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_a) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_nPointsInteg) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_maxX) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_dynamicMaxX) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_dynamicMaxXCoef) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_dynamicMaxXAddition) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_maxPhi) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_XGOTREF(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_waveParamsSet);
  __Pyx_DECREF_SET(__pyx_v_12NonlinearTMM_23_SecondOrderNLTMMCython_waveParamsSet, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1286
 *     # Waves
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_n_s_nan); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L1_error)
  __pyx_k__22 = __pyx_t_3;
  __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_n_s_nan); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L1_error)
  __pyx_k__23 = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1870
 *         return res
 * 
 *     def WaveGetPowerFlows(self, int layerNr, double x0 = float("nan"), double x1 = float("nan"), double z = 0.0):             # <<<<<<<<<<<<<<
 *         """WaveGetPowerFlows(layerNr, x0 = float("nan"), x1 = float("nan"), z = 0.0)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_n_s_nan); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L1_error)
  __pyx_k__33 = __pyx_t_3;
  __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_n_s_nan); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1870, __pyx_L1_error)
  __pyx_k__34 = __pyx_t_3;

  /* "NonlinearTMM/src/SecondOrderNLTMM.pyx":1
 * import numpy as np             # <<<<<<<<<<<<<<
 * from CppSecondOrderNLTMM cimport *
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_Chi2Tensor_Update_line_114, __pyx_kp_u_Update_kwargs_This_method_change) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_Material_GetN_line_250, __pyx_kp_u_GetN_wl_Returns_refractive_index) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_NonlinearTMM_AddLayer_line_1042, __pyx_kp_u_AddLayer_d_material_Adds_layer_t) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_NonlinearTMM_Solve_line_1087, __pyx_kp_u_Solve_kwargs_Solves_the_structur) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../../../tmp/build-env-x9vuoiup/lib/python3.10/site-packages/numpy/__init__.pxd":1014
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init NonlinearTMM._SecondOrderNLTMMCython", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init NonlinearTMM._SecondOrderNLTMMCython");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_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 */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG)
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
    else state = (PyGILState_STATE)0;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

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

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *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)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            #else
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            #endif
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *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)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* py_dict_pop */
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3
    if ((1)) {
        return _PyDict_Pop(d, key, default_value);
    } else
#endif
    if (default_value) {
        return __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_pop, d, key, default_value);
    } else {
        return __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_pop, d, key);
    }
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* IsLittleEndian */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t <= '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case '?': 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 "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    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 NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case '?': 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)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* BufferGetAndValidate */
  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (unlikely(info->buf == NULL)) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static int __Pyx__GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  buf->buf = NULL;
  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
    __Pyx_ZeroBuffer(buf);
    return -1;
  }
  if (unlikely(buf->ndim != nd)) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if (unlikely((size_t)buf->itemsize != dtype->size)) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_SafeReleaseBuffer(buf);
  return -1;
}

/* IterFinish */
  static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* PyObjectGetMethod */
  static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

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

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

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

/* RaiseNoneIterError */
  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
  static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
  static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
  static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* bytes_tailmatch */
  static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
                                         Py_ssize_t start, Py_ssize_t end, int direction) {
    const char* self_ptr = PyBytes_AS_STRING(self);
    Py_ssize_t self_len = PyBytes_GET_SIZE(self);
    const char* sub_ptr;
    Py_ssize_t sub_len;
    int retval;
    Py_buffer view;
    view.obj = NULL;
    if ( PyBytes_Check(arg) ) {
        sub_ptr = PyBytes_AS_STRING(arg);
        sub_len = PyBytes_GET_SIZE(arg);
    }
#if PY_MAJOR_VERSION < 3
    else if ( PyUnicode_Check(arg) ) {
        return (int) PyUnicode_Tailmatch(self, arg, start, end, direction);
    }
#endif
    else {
        if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
            return -1;
        sub_ptr = (const char*) view.buf;
        sub_len = view.len;
    }
    if (end > self_len)
        end = self_len;
    else if (end < 0)
        end += self_len;
    if (end < 0)
        end = 0;
    if (start < 0)
        start += self_len;
    if (start < 0)
        start = 0;
    if (direction > 0) {
        if (end-sub_len > start)
            start = end - sub_len;
    }
    if (start + sub_len <= end)
        retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
    else
        retval = 0;
    if (view.obj)
        PyBuffer_Release(&view);
    return retval;
}
static int __Pyx_PyBytes_TailmatchTuple(PyObject* self, PyObject* substrings,
                                        Py_ssize_t start, Py_ssize_t end, int direction) {
    Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
    for (i = 0; i < count; i++) {
        int result;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substrings, i),
                                               start, end, direction);
#else
        PyObject* sub = PySequence_ITEM(substrings, i);
        if (unlikely(!sub)) return -1;
        result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction);
        Py_DECREF(sub);
#endif
        if (result) {
            return result;
        }
    }
    return 0;
}
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
                                   Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        return __Pyx_PyBytes_TailmatchTuple(self, substr, start, end, direction);
    }
    return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
}

/* unicode_tailmatch */
  static int __Pyx_PyUnicode_TailmatchTuple(PyObject* s, PyObject* substrings,
                                          Py_ssize_t start, Py_ssize_t end, int direction) {
    Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
    for (i = 0; i < count; i++) {
        Py_ssize_t result;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substrings, i),
                                     start, end, direction);
#else
        PyObject* sub = PySequence_ITEM(substrings, i);
        if (unlikely(!sub)) return -1;
        result = PyUnicode_Tailmatch(s, sub, start, end, direction);
        Py_DECREF(sub);
#endif
        if (result) {
            return (int) result;
        }
    }
    return 0;
}
static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        return __Pyx_PyUnicode_TailmatchTuple(s, substr, start, end, direction);
    }
    return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
}

/* str_tailmatch */
  static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction)
{
    if (PY_MAJOR_VERSION < 3)
        return __Pyx_PyBytes_Tailmatch(self, arg, start, end, direction);
    else
        return __Pyx_PyUnicode_Tailmatch(self, arg, start, end, direction);
}

/* GetTopmostException */
  #if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
  #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
  #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
  #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyObject_GenericGetAttrNoDict */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
  static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* PyObjectGetAttrStrNoError */
  static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    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;
}

/* SetupReduce */
  static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  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_n_s_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_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_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_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_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_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())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_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;
}

/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* Import */
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* pyobject_as_double */
  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if ((0)) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
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 PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        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;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    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_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);
}

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = (double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = (double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        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

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


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

/* FromPy */
  static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
    Py_complex cval;
#if !CYTHON_COMPILING_IN_PYPY
    if (PyComplex_CheckExact(o))
        cval = ((PyComplexObject *)o)->cval;
    else
#endif
        cval = PyComplex_AsCComplex(o);
    return __pyx_t_double_complex_from_parts(
               (double)cval.real,
               (double)cval.imag);
}

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = (float)(1.0) / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = (float)(1.0) / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        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

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__TMM_3a__3a_TMMParam(enum TMM::TMMParam value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum TMM::TMMParam neg_one = (enum TMM::TMMParam) -1, const_zero = (enum TMM::TMMParam) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum TMM::TMMParam) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum TMM::TMMParam) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum TMM::TMMParam) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum TMM::TMMParam) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum TMM::TMMParam) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum TMM::TMMParam),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE enum TMM::TMMParam __Pyx_PyInt_As_enum__TMM_3a__3a_TMMParam(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const enum TMM::TMMParam neg_one = (enum TMM::TMMParam) -1, const_zero = (enum TMM::TMMParam) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(enum TMM::TMMParam) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (enum TMM::TMMParam) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum TMM::TMMParam) 0;
                case  1: __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, digit, digits[0])
                case 2:
                    if (8 * sizeof(enum TMM::TMMParam) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) >= 2 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((((enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum TMM::TMMParam) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) >= 3 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((((((enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum TMM::TMMParam) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, 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(enum TMM::TMMParam) >= 4 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((((((((enum TMM::TMMParam)digits[3]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (enum TMM::TMMParam) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(enum TMM::TMMParam) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum TMM::TMMParam, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum TMM::TMMParam) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum TMM::TMMParam, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (enum TMM::TMMParam) 0;
                case -1: __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(enum TMM::TMMParam) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) - 1 > 2 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((enum TMM::TMMParam)-1)*(((((enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(enum TMM::TMMParam) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) - 1 > 2 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) ((((((enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(enum TMM::TMMParam) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) - 1 > 3 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((enum TMM::TMMParam)-1)*(((((((enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(enum TMM::TMMParam) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(enum TMM::TMMParam) - 1 > 3 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) ((((((((enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(enum TMM::TMMParam) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, 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(enum TMM::TMMParam) - 1 > 4 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) (((enum TMM::TMMParam)-1)*(((((((((enum TMM::TMMParam)digits[3]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(enum TMM::TMMParam) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(enum TMM::TMMParam, 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(enum TMM::TMMParam) - 1 > 4 * PyLong_SHIFT) {
                            return (enum TMM::TMMParam) ((((((((((enum TMM::TMMParam)digits[3]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[2]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[1]) << PyLong_SHIFT) | (enum TMM::TMMParam)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(enum TMM::TMMParam) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum TMM::TMMParam, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(enum TMM::TMMParam) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(enum TMM::TMMParam, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            enum TMM::TMMParam val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (enum TMM::TMMParam) -1;
        }
    } else {
        enum TMM::TMMParam val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (enum TMM::TMMParam) -1;
        val = __Pyx_PyInt_As_enum__TMM_3a__3a_TMMParam(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to enum TMM::TMMParam");
    return (enum TMM::TMMParam) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to enum TMM::TMMParam");
    return (enum TMM::TMMParam) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_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 PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_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 PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
  #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(void) {
    char ctversion[5];
    int same=1, i, found_dot;
    const char* rt_from_call = Py_GetVersion();
    PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    found_dot = 0;
    for (i = 0; i < 4; i++) {
        if (!ctversion[i]) {
            same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
            break;
        }
        if (rt_from_call[i] != ctversion[i]) {
            same = 0;
            break;
        }
    }
    if (!same) {
        char rtversion[5] = {'\0'};
        char message[200];
        for (i=0; i<4; ++i) {
            if (rt_from_call[i] == '.') {
                if (found_dot) break;
                found_dot = 1;
            } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
                break;
            }
            rtversion[i] = rt_from_call[i];
        }
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE 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);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
