/* Generated by Cython 0.29.34 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h",
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h",
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h",
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h",
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h"
        ],
        "extra_compile_args": [
            "-O3"
        ],
        "include_dirs": [
            "/private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/core/include"
        ],
        "name": "causalml.inference.tree.uplift",
        "sources": [
            "causalml/inference/tree/uplift.pyx"
        ]
    },
    "module_name": "causalml.inference.tree.uplift"
}
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_34"
#define CYTHON_HEX_VERSION 0x001D22F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #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 (PY_VERSION_HEX < 0x030C00A5)
  #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) && (PY_VERSION_HEX < 0x030C00A5))
  #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 CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #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__causalml__inference__tree__uplift
#define __PYX_HAVE_API__causalml__inference__tree__uplift
/* 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 "math.h"
#include "pythread.h"
#include <stdlib.h>
#include "pystate.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
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[] = {
  "causalml/inference/tree/uplift.pyx",
  "__init__.pxd",
  "stringsource",
  "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;

/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])

/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
#define __pyx_atomic_int_type int
#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
                    (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
    #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL
    #include <intrin.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type long
    #pragma intrinsic (_InterlockedExchangeAdd)
    #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
    #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

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

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


/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":689
 * # 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":690
 * 
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/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
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":692
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":696
 * #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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":697
 * 
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/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
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":699
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":703
 * #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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":704
 * 
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":713
 * # 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":714
 * # 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":715
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":717
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":718
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":719
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":721
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":722
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":724
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":725
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":726
 * 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;

/* "causalml/inference/tree/uplift.pyx":47
 * P_TYPE = np.float64
 * 
 * ctypedef np.int32_t N_TYPE_t             # <<<<<<<<<<<<<<
 * ctypedef np.int8_t TR_TYPE_t
 * ctypedef np.int8_t Y_TYPE_t
 */
typedef __pyx_t_5numpy_int32_t __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t;

/* "causalml/inference/tree/uplift.pyx":48
 * 
 * ctypedef np.int32_t N_TYPE_t
 * ctypedef np.int8_t TR_TYPE_t             # <<<<<<<<<<<<<<
 * ctypedef np.int8_t Y_TYPE_t
 * ctypedef np.float64_t P_TYPE_t
 */
typedef __pyx_t_5numpy_int8_t __pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t;

/* "causalml/inference/tree/uplift.pyx":49
 * ctypedef np.int32_t N_TYPE_t
 * ctypedef np.int8_t TR_TYPE_t
 * ctypedef np.int8_t Y_TYPE_t             # <<<<<<<<<<<<<<
 * ctypedef np.float64_t P_TYPE_t
 * 
 */
typedef __pyx_t_5numpy_int8_t __pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t;

/* "causalml/inference/tree/uplift.pyx":50
 * ctypedef np.int8_t TR_TYPE_t
 * ctypedef np.int8_t Y_TYPE_t
 * ctypedef np.float64_t P_TYPE_t             # <<<<<<<<<<<<<<
 * 
 * MAX_INT = np.iinfo(np.int32).max
 */
typedef __pyx_t_5numpy_float64_t __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

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


/*--- Type declarations ---*/
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify;
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit;
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr;
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict;
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":728
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":729
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":730
 * 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;

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":732
 * 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_8causalml_9inference_4tree_6uplift_entropyH;

/* "causalml/inference/tree/uplift.pyx":100
 * 
 * @cython.cfunc
 * def entropyH(p: cython.float, q: cython.float=-1.) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Entropy
 */
struct __pyx_opt_args_8causalml_9inference_4tree_6uplift_entropyH {
  int __pyx_n;
  float q;
};

/* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify {
  PyObject_HEAD
  PyObject *__pyx_v_classifyWithMissingData;
  PyObject *__pyx_v_classifyWithoutMissingData;
};


/* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit {
  PyObject_HEAD
  PyObject *__pyx_v_X;
  PyObject *__pyx_v_X_val;
  PyObject *__pyx_v_self;
  PyObject *__pyx_v_treatment;
  PyObject *__pyx_v_treatment_val;
  PyObject *__pyx_v_y;
  PyObject *__pyx_v_y_val;
};


/* "causalml/inference/tree/uplift.pyx":2521
 *         self.uplift_forest = (
 *             Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *             (delayed(self.bootstrap)(X, treatment, y, X_val, treatment_val, y_val, tree) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *__pyx_outer_scope;
  PyObject *__pyx_v_tree;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict {
  PyObject_HEAD
  PyObject *__pyx_v_X;
  PyObject *__pyx_v_self;
};


/* "causalml/inference/tree/uplift.pyx":2578
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *             ) / len(self.uplift_forest)
 *         else:
 */
struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *__pyx_outer_scope;
  PyObject *__pyx_v_tree;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


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


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


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


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



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

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


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

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


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

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

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

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

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

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

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

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

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

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

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
/* 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

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

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

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

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

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

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

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

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

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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

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

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

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

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

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

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

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

/* 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
#if __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#endif
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*)
#endif
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, size_t alignment, enum __Pyx_ImportType_CheckSize check_size);
#endif

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

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

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

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

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

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

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


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

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

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

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

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

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

/* MemviewSliceValidateAndInit.proto */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

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

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

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

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

/* MemviewSliceCopyTemplate.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value);

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

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

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

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

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

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

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/

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

/* 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 'causalml.inference.tree.uplift' */
static PyTypeObject *__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify = 0;
static PyTypeObject *__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit = 0;
static PyTypeObject *__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr = 0;
static PyTypeObject *__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict = 0;
static PyTypeObject *__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static float __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(float, float); /*proto*/
static float __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(float, struct __pyx_opt_args_8causalml_9inference_4tree_6uplift_entropyH *__pyx_optional_args); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
static void *__pyx_align_pointer(void *, size_t); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t = { "TR_TYPE_t", NULL, sizeof(__pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t = { "Y_TYPE_t", NULL, sizeof(__pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t = { "N_TYPE_t", NULL, sizeof(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t = { "P_TYPE_t", NULL, sizeof(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t), { 0 }, 0, 'R', 0, 0 };
#define __Pyx_MODULE_NAME "causalml.inference.tree.uplift"
extern int __pyx_module_is_main_causalml__inference__tree__uplift;
int __pyx_module_is_main_causalml__inference__tree__uplift = 0;

/* Implementation of 'causalml.inference.tree.uplift' */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_FutureWarning;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static const char __pyx_k_O[] = "O";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "%d";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_3f[] = "%.3f";
static const char __pyx_k_ED[] = "ED";
static const char __pyx_k_IT[] = "IT";
static const char __pyx_k_KL[] = "KL";
static const char __pyx_k__4[] = "";
static const char __pyx_k__5[] = " ";
static const char __pyx_k__6[] = ": ";
static const char __pyx_k_fr[] = "fr";
static const char __pyx_k_fw[] = "fw";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_mp[] = "mp";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_pc[] = "pc";
static const char __pyx_k_pd[] = "pd";
static const char __pyx_k_tr[] = "tr";
static const char __pyx_k_tv[] = "tv";
static const char __pyx_k_tw[] = "tw";
static const char __pyx_k_yv[] = "yv";
static const char __pyx_k_CIT[] = "CIT";
static const char __pyx_k_CTS[] = "CTS";
static const char __pyx_k_Chi[] = "Chi";
static const char __pyx_k_DDP[] = "DDP";
static const char __pyx_k_X_l[] = "X_l";
static const char __pyx_k_X_r[] = "X_r";
static const char __pyx_k__32[] = "*";
static const char __pyx_k__62[] = "_";
static const char __pyx_k_abs[] = "abs";
static const char __pyx_k_cdf[] = "cdf";
static const char __pyx_k_col[] = "col";
static const char __pyx_k_dcY[] = "dcY";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_fit[] = "fit";
static const char __pyx_k_g_s[] = "g_s";
static const char __pyx_k_imp[] = "imp";
static const char __pyx_k_int[] = "int";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_lrt[] = "lrt";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_n_1[] = "n_1";
static const char __pyx_k_n_2[] = "n_2";
static const char __pyx_k_n_3[] = "n_3";
static const char __pyx_k_n_4[] = "n_4";
static const char __pyx_k_n_c[] = "n_c";
static const char __pyx_k_n_t[] = "n_t";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_p_c[] = "p_c";
static const char __pyx_k_p_t[] = "p_t";
static const char __pyx_k_res[] = "res";
static const char __pyx_k_s_1[] = "s_1";
static const char __pyx_k_s_2[] = "s_2";
static const char __pyx_k_s_3[] = "s_3";
static const char __pyx_k_s_4[] = "s_4";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_w_1[] = "w_1";
static const char __pyx_k_w_2[] = "w_2";
static const char __pyx_k_w_3[] = "w_3";
static const char __pyx_k_w_4[] = "w_4";
static const char __pyx_k_w_l[] = "w_l";
static const char __pyx_k_w_r[] = "w_r";
static const char __pyx_k_y_l[] = "y_l";
static const char __pyx_k_y_r[] = "y_r";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_IDDP[] = "IDDP";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_diff[] = "diff";
static const char __pyx_k_fill[] = "fill";
static const char __pyx_k_filt[] = "filt";
static const char __pyx_k_gain[] = "gain";
static const char __pyx_k_i_tr[] = "i_tr";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_int8[] = "int8";
static const char __pyx_k_list[] = "list";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mean[] = "mean";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_norm[] = "norm";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_pc_a[] = "pc_a";
static const char __pyx_k_pt_a[] = "pt_a";
static const char __pyx_k_rule[] = "rule";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sign[] = "sign";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_stat[] = "stat";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tree[] = "tree";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_T_est[] = "T_est";
static const char __pyx_k_X_est[] = "X_est";
static const char __pyx_k_X_val[] = "X_val";
static const char __pyx_k_Y_est[] = "Y_est";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_apply[] = "apply";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_d_res[] = "d_res";
static const char __pyx_k_delta[] = "delta_";
static const char __pyx_k_depth[] = "depth";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_float[] = "float";
static const char __pyx_k_i_row[] = "i_row";
static const char __pyx_k_i_tau[] = "i_tau";
static const char __pyx_k_iinfo[] = "iinfo";
static const char __pyx_k_int32[] = "int32";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_len_X[] = "len_X";
static const char __pyx_k_n_l_t[] = "n_l_t";
static const char __pyx_k_n_pos[] = "n_pos";
static const char __pyx_k_n_r_t[] = "n_r_t";
static const char __pyx_k_n_reg[] = "n_reg";
static const char __pyx_k_n_t_0[] = "n_t_0";
static const char __pyx_k_n_t_1[] = "n_t_1";
static const char __pyx_k_normI[] = "normI";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_parse[] = "parse";
static const char __pyx_k_power[] = "power";
static const char __pyx_k_prune[] = "prune";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_sigma[] = "sigma";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_stats[] = "stats";
static const char __pyx_k_sum_n[] = "sum_n";
static const char __pyx_k_t_est[] = "t_est";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_y_est[] = "y_est";
static const char __pyx_k_y_l_0[] = "y_l_0";
static const char __pyx_k_y_l_1[] = "y_l_1";
static const char __pyx_k_y_r_0[] = "y_r_0";
static const char __pyx_k_y_r_1[] = "y_r_1";
static const char __pyx_k_y_val[] = "y_val";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_0_22_0[] = "0.22.0";
static const char __pyx_k_N_TYPE[] = "N_TYPE";
static const char __pyx_k_P_TYPE[] = "P_TYPE";
static const char __pyx_k_Y_TYPE[] = "Y_TYPE";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_argmax[] = "argmax";
static const char __pyx_k_astype[] = "astype";
static const char __pyx_k_branch[] = "branch";
static const char __pyx_k_choice[] = "choice";
static const char __pyx_k_column[] = "column";
static const char __pyx_k_counts[] = "counts";
static const char __pyx_k_df_res[] = "df_res";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_fcount[] = "fcount";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_joblib[] = "joblib";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_n_jobs[] = "n_jobs";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_pandas[] = "pandas";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_prefer[] = "prefer";
static const char __pyx_k_pt_a_i[] = "pt_a_i";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_return[] = "return";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_tcount[] = "tcount";
static const char __pyx_k_unique[] = "unique";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_MAX_INT[] = "MAX_INT";
static const char __pyx_k_TR_TYPE[] = "TR_TYPE";
static const char __pyx_k_X_val_l[] = "X_val_l";
static const char __pyx_k_X_val_r[] = "X_val_r";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_classes[] = "classes_";
static const char __pyx_k_columns[] = "columns";
static const char __pyx_k_delayed[] = "delayed";
static const char __pyx_k_diff_sq[] = "diff_sq";
static const char __pyx_k_float64[] = "float64";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_honesty[] = "honesty";
static const char __pyx_k_i_tau_l[] = "i_tau_l";
static const char __pyx_k_i_tau_r[] = "i_tau_r";
static const char __pyx_k_len_X_l[] = "len_X_l";
static const char __pyx_k_len_X_r[] = "len_X_r";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_maxDiff[] = "maxDiff";
static const char __pyx_k_memview[] = "memview";
static const char __pyx_k_minGain[] = "minGain";
static const char __pyx_k_n_class[] = "n_class";
static const char __pyx_k_n_l_t_0[] = "n_l_t_0";
static const char __pyx_k_n_l_t_1[] = "n_l_t_1";
static const char __pyx_k_n_r_t_0[] = "n_r_t_0";
static const char __pyx_k_n_r_t_1[] = "n_r_t_1";
static const char __pyx_k_n_reg_p[] = "n_reg_p";
static const char __pyx_k_out_arr[] = "out_arr";
static const char __pyx_k_p_value[] = "p_value";
static const char __pyx_k_predict[] = "predict";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_randint[] = "randint";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_results[] = "results";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_shuffle[] = "shuffle";
static const char __pyx_k_sklearn[] = "sklearn";
static const char __pyx_k_sse_tau[] = "sse_tau";
static const char __pyx_k_sum_n_t[] = "sum_n_t";
static const char __pyx_k_summary[] = "summary";
static const char __pyx_k_threads[] = "threads";
static const char __pyx_k_unicode[] = "unicode";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_w_val_l[] = "w_val_l";
static const char __pyx_k_w_val_r[] = "w_val_r";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_y_val_l[] = "y_val_l";
static const char __pyx_k_y_val_r[] = "y_val_r";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_Parallel[] = "Parallel";
static const char __pyx_k_bestGain[] = "bestGain";
static const char __pyx_k_best_col[] = "best_col";
static const char __pyx_k_bt_index[] = "bt_index";
static const char __pyx_k_category[] = "category";
static const char __pyx_k_causalml[] = "causalml";
static const char __pyx_k_classify[] = "classify";
static const char __pyx_k_col_vals[] = "col_vals";
static const char __pyx_k_fillTree[] = "fillTree";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_impurity[] = "impurity";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_lsUnique[] = "lsUnique";
static const char __pyx_k_n_c_left[] = "n_c_left";
static const char __pyx_k_n_t_left[] = "n_t_left";
static const char __pyx_k_node_mst[] = "node_mst";
static const char __pyx_k_norm_res[] = "norm_res";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_stratify[] = "stratify";
static const char __pyx_k_x_val_bt[] = "x_val_bt";
static const char __pyx_k_y_val_bt[] = "y_val_bt";
static const char __pyx_k_DataFrame[] = "DataFrame";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_arr_normI[] = "arr_normI";
static const char __pyx_k_bootstrap[] = "bootstrap";
static const char __pyx_k_check_X_y[] = "check_X_y";
static const char __pyx_k_cpu_count[] = "cpu_count";
static const char __pyx_k_divideSet[] = "divideSet";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_is_passed[] = " is passed";
static const char __pyx_k_len_X_val[] = "len_X_val";
static const char __pyx_k_max_delta[] = "max_delta";
static const char __pyx_k_max_depth[] = "max_depth";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_packaging[] = "packaging";
static const char __pyx_k_pred_leaf[] = "pred_leaf";
static const char __pyx_k_pruneTree[] = "pruneTree";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_sse_tau_l[] = "sse_tau_l";
static const char __pyx_k_sse_tau_r[] = "sse_tau_r";
static const char __pyx_k_test_size[] = "test_size";
static const char __pyx_k_treatment[] = "treatment";
static const char __pyx_k_version_2[] = "__version__";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_bestUplift[] = "bestUplift";
static const char __pyx_k_best_value[] = "best_value";
static const char __pyx_k_delta_cols[] = "delta_cols";
static const char __pyx_k_group_size[] = "group_size";
static const char __pyx_k_issubdtype[] = "issubdtype";
static const char __pyx_k_leftScore1[] = "leftScore1";
static const char __pyx_k_matchScore[] = "matchScore";
static const char __pyx_k_maxAbsDiff[] = "maxAbsDiff";
static const char __pyx_k_max_eps_pc[] = "max_eps_pc";
static const char __pyx_k_n_min_sams[] = "n_min_sams";
static const char __pyx_k_percentile[] = "percentile";
static const char __pyx_k_pred_nodes[] = "pred_nodes";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_trueBranch[] = "trueBranch";
static const char __pyx_k_trueScoreD[] = "trueScoreD";
static const char __pyx_k_x_train_bt[] = "x_train_bt";
static const char __pyx_k_y_train_bt[] = "y_train_bt";
static const char __pyx_k_zeros_like[] = "zeros_like";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_bestGainImp[] = "bestGainImp";
static const char __pyx_k_check_array[] = "check_array";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_columnCount[] = "columnCount";
static const char __pyx_k_dataMissing[] = "dataMissing";
static const char __pyx_k_defaultdict[] = "defaultdict";
static const char __pyx_k_evaluate_ED[] = "evaluate_ED";
static const char __pyx_k_evaluate_IT[] = "evaluate_IT";
static const char __pyx_k_evaluate_KL[] = "evaluate_KL";
static const char __pyx_k_falseBranch[] = "falseBranch";
static const char __pyx_k_falseScoreD[] = "falseScoreD";
static const char __pyx_k_full_output[] = "full_output";
static const char __pyx_k_len_X_val_l[] = "len_X_val_l";
static const char __pyx_k_maxDiffSign[] = "maxDiffSign";
static const char __pyx_k_nodeSummary[] = "nodeSummary";
static const char __pyx_k_norm_factor[] = "norm_factor";
static const char __pyx_k_num_samples[] = "num_samples";
static const char __pyx_k_out_arr_len[] = "out_arr_len";
static const char __pyx_k_rightScore2[] = "rightScore2";
static const char __pyx_k_scipy_stats[] = "scipy.stats";
static const char __pyx_k_upliftScore[] = "upliftScore";
static const char __pyx_k_DecisionTree[] = "DecisionTree";
static const char __pyx_k_bt_val_index[] = "bt_val_index";
static const char __pyx_k_columnValues[] = "columnValues";
static const char __pyx_k_control_name[] = "control_name";
static const char __pyx_k_currentScore[] = "currentScore";
static const char __pyx_k_evaluate_CIT[] = "evaluate_CIT";
static const char __pyx_k_evaluate_CTS[] = "evaluate_CTS";
static const char __pyx_k_evaluate_Chi[] = "evaluate_Chi";
static const char __pyx_k_evaluate_DDP[] = "evaluate_DDP";
static const char __pyx_k_gain_for_imp[] = "gain_for_imp";
static const char __pyx_k_lspercentile[] = "lspercentile";
static const char __pyx_k_max_eps_1_pc[] = "max_eps_1_pc";
static const char __pyx_k_max_features[] = "max_features";
static const char __pyx_k_n_estimators[] = "n_estimators";
static const char __pyx_k_observations[] = "observations";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_random_state[] = "random_state";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_sum_n_t_left[] = "sum_n_t_left";
static const char __pyx_k_FutureWarning[] = "FutureWarning";
static const char __pyx_k_arr_eval_func[] = "arr_eval_func";
static const char __pyx_k_backupResults[] = "backupResults";
static const char __pyx_k_bestAttribute[] = "bestAttribute";
static const char __pyx_k_bestTreatment[] = "bestTreatment";
static const char __pyx_k_best_set_left[] = "best_set_left";
static const char __pyx_k_buf_count_arr[] = "buf_count_arr";
static const char __pyx_k_cur_summary_n[] = "cur_summary_n";
static const char __pyx_k_cur_summary_p[] = "cur_summary_p";
static const char __pyx_k_currentScoreD[] = "currentScoreD";
static const char __pyx_k_divideSet_len[] = "divideSet_len";
static const char __pyx_k_evaluate_IDDP[] = "evaluate_IDDP";
static const char __pyx_k_joblib_prefer[] = "joblib_prefer";
static const char __pyx_k_normalization[] = "normalization";
static const char __pyx_k_out_summary_n[] = "out_summary_n";
static const char __pyx_k_out_summary_p[] = "out_summary_p";
static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_sklearn_utils[] = "sklearn.utils";
static const char __pyx_k_threshold_val[] = "threshold_val";
static const char __pyx_k_treatment_idx[] = "treatment_idx";
static const char __pyx_k_treatment_val[] = "treatment_val";
static const char __pyx_k_uplift_forest[] = "uplift_forest";
static const char __pyx_k_best_set_right[] = "best_set_right";
static const char __pyx_k_honestApproach[] = "honestApproach";
static const char __pyx_k_is_split_by_gt[] = "is_split_by_gt";
static const char __pyx_k_left_count_arr[] = "left_count_arr";
static const char __pyx_k_left_summary_n[] = "left_summary_n";
static const char __pyx_k_left_summary_p[] = "left_summary_p";
static const char __pyx_k_node_summary_n[] = "node_summary_n";
static const char __pyx_k_node_summary_p[] = "node_summary_p";
static const char __pyx_k_random_state_2[] = "random_state_";
static const char __pyx_k_treatment_left[] = "treatment_left";
static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
static const char __pyx_k_all_importances[] = "all_importances";
static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
static const char __pyx_k_arr_evaluate_ED[] = "arr_evaluate_ED";
static const char __pyx_k_arr_evaluate_IT[] = "arr_evaluate_IT";
static const char __pyx_k_arr_evaluate_KL[] = "arr_evaluate_KL";
static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
static const char __pyx_k_group_count_arr[] = "group_count_arr";
static const char __pyx_k_ignore_warnings[] = "ignore_warnings";
static const char __pyx_k_leftNodeSummary[] = "leftNodeSummary";
static const char __pyx_k_multiprocessing[] = "multiprocessing";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_right_count_arr[] = "right_count_arr";
static const char __pyx_k_right_summary_n[] = "right_summary_n";
static const char __pyx_k_right_summary_p[] = "right_summary_p";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_suboptTreatment[] = "suboptTreatment";
static const char __pyx_k_total_count_arr[] = "total_count_arr";
static const char __pyx_k_treatment_group[] = "treatment_group";
static const char __pyx_k_treatment_right[] = "treatment_right";
static const char __pyx_k_trueNodeSummary[] = "trueNodeSummary";
static const char __pyx_k_y_pred_ensemble[] = "y_pred_ensemble";
static const char __pyx_k_arr_evaluate_CIT[] = "arr_evaluate_CIT";
static const char __pyx_k_arr_evaluate_CTS[] = "arr_evaluate_CTS";
static const char __pyx_k_arr_evaluate_Chi[] = "arr_evaluate_Chi";
static const char __pyx_k_arr_evaluate_DDP[] = "arr_evaluate_DDP";
static const char __pyx_k_falseNodeSummary[] = "falseNodeSummary";
static const char __pyx_k_feature_imp_dict[] = "feature_imp_dict";
static const char __pyx_k_maxDiffTreatment[] = "maxDiffTreatment";
static const char __pyx_k_min_samples_leaf[] = "min_samples_leaf";
static const char __pyx_k_modifyEstimation[] = "modifyEstimation";
static const char __pyx_k_parent_summary_p[] = "parent_summary_p";
static const char __pyx_k_rightNodeSummary[] = "rightNodeSummary";
static const char __pyx_k_train_test_split[] = "train_test_split";
static const char __pyx_k_treatment_groups[] = "treatment_groups";
static const char __pyx_k_treatment_val_bt[] = "treatment_val_bt";
static const char __pyx_k_arr_evaluate_IDDP[] = "arr_evaluate_IDDP";
static const char __pyx_k_c_cat_percentiles[] = "c_cat_percentiles";
static const char __pyx_k_c_num_percentiles[] = "c_num_percentiles";
static const char __pyx_k_currentDivergence[] = "currentDivergence";
static const char __pyx_k_parentNodeSummary[] = "parentNodeSummary";
static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
static const char __pyx_k_treatment_idx_est[] = "treatment_idx_est";
static const char __pyx_k_treatment_val_idx[] = "treatment_val_idx";
static const char __pyx_k_tree_node_summary[] = "tree_node_summary";
static const char __pyx_k_check_random_state[] = "check_random_state";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_cur_node_summary_n[] = "cur_node_summary_n";
static const char __pyx_k_cur_node_summary_p[] = "cur_node_summary_p";
static const char __pyx_k_currentNodeSummary[] = "currentNodeSummary";
static const char __pyx_k_evaluationFunction[] = "evaluationFunction";
static const char __pyx_k_fitted_uplift_tree[] = "fitted_uplift_tree";
static const char __pyx_k_group_uniqueCounts[] = "group_uniqueCounts";
static const char __pyx_k_has_parent_summary[] = "has_parent_summary";
static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
static const char __pyx_k_treatment_train_bt[] = "treatment_train_bt";
static const char __pyx_k_val_left_count_arr[] = "val_left_count_arr";
static const char __pyx_k_val_left_summary_n[] = "val_left_summary_n";
static const char __pyx_k_val_left_summary_p[] = "val_left_summary_p";
static const char __pyx_k_DecisionTree___init[] = "DecisionTree.__init__";
static const char __pyx_k_early_stopping_flag[] = "early_stopping_flag";
static const char __pyx_k_feature_importances[] = "feature_importances_";
static const char __pyx_k_left_node_summary_n[] = "left_node_summary_n";
static const char __pyx_k_left_node_summary_p[] = "left_node_summary_p";
static const char __pyx_k_parentNodeSummary_p[] = "parentNodeSummary_p";
static const char __pyx_k_val_right_count_arr[] = "val_right_count_arr";
static const char __pyx_k_val_right_summary_n[] = "val_right_summary_n";
static const char __pyx_k_val_right_summary_p[] = "val_right_summary_p";
static const char __pyx_k_val_total_count_arr[] = "val_total_count_arr";
static const char __pyx_k_UpliftTreeClassifier[] = "UpliftTreeClassifier";
static const char __pyx_k_growDecisionTreeFrom[] = "growDecisionTreeFrom";
static const char __pyx_k_right_node_summary_n[] = "right_node_summary_n";
static const char __pyx_k_right_node_summary_p[] = "right_node_summary_p";
static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
static const char __pyx_k_min_samples_treatment[] = "min_samples_treatment";
static const char __pyx_k_recommended_treatment[] = "recommended_treatment";
static const char __pyx_k_sklearn_utils_testing[] = "sklearn.utils.testing";
static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
static const char __pyx_k_estimation_sample_size[] = "estimation_sample_size";
static const char __pyx_k_group_counts_by_divide[] = "group_counts_by_divide";
static const char __pyx_k_sklearn_utils__testing[] = "sklearn.utils._testing";
static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
static const char __pyx_k_classifyWithMissingData[] = "classifyWithMissingData";
static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
static const char __pyx_k_sklearn_model_selection[] = "sklearn.model_selection";
static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
static const char __pyx_k_UpliftTreeClassifier_fit[] = "UpliftTreeClassifier.fit";
static const char __pyx_k_tree_node_summary_to_arr[] = "tree_node_summary_to_arr";
static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
static const char __pyx_k_UpliftTreeClassifier_fill[] = "UpliftTreeClassifier.fill";
static const char __pyx_k_group_uniqueCounts_to_arr[] = "group_uniqueCounts_to_arr";
static const char __pyx_k_UpliftTreeClassifier_normI[] = "UpliftTreeClassifier.normI";
static const char __pyx_k_UpliftTreeClassifier_prune[] = "UpliftTreeClassifier.prune";
static const char __pyx_k_classifyWithoutMissingData[] = "classifyWithoutMissingData";
static const char __pyx_k_UpliftTreeClassifier___init[] = "UpliftTreeClassifier.__init__";
static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
static const char __pyx_k_UpliftRandomForestClassifier[] = "UpliftRandomForestClassifier";
static const char __pyx_k_UpliftTreeClassifier_predict[] = "UpliftTreeClassifier.predict";
static const char __pyx_k_UpliftTreeClassifier_classify[] = "UpliftTreeClassifier.classify";
static const char __pyx_k_UpliftTreeClassifier_fillTree[] = "UpliftTreeClassifier.fillTree";
static const char __pyx_k_tree_node_summary_from_counts[] = "tree_node_summary_from_counts";
static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
static const char __pyx_k_uplift_classification_results[] = "uplift_classification_results";
static const char __pyx_k_Forest_of_trees_based_ensemble[] = "\nForest of trees-based ensemble methods for Uplift modeling on Classification\nProblem. Those methods include random forests and extremely randomized trees.\n\nThe module structure is the following:\n- The ``UpliftRandomForestClassifier`` base class implements different\n  variants of uplift models based on random forest, with 'fit' and 'predict'\n  method.\n- The ``UpliftTreeClassifier`` base class implements the uplift trees (without\n  Bootstrapping for random forest), this class is called within\n  ``UpliftRandomForestClassifier`` for constructing random forest.\n\n";
static const char __pyx_k_UpliftTreeClassifier_arr_normI[] = "UpliftTreeClassifier.arr_normI";
static const char __pyx_k_UpliftTreeClassifier_divideSet[] = "UpliftTreeClassifier.divideSet";
static const char __pyx_k_UpliftTreeClassifier_pruneTree[] = "UpliftTreeClassifier.pruneTree";
static const char __pyx_k_causalml_inference_tree_uplift[] = "causalml.inference.tree.uplift";
static const char __pyx_k_early_stopping_eval_diff_scale[] = "early_stopping_eval_diff_scale";
static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
static const char __pyx_k_Data_length_must_be_equal_for_X[] = "Data length must be equal for X, treatment, and y.";
static const char __pyx_k_Tree_Node_Class_Tree_node_class[] = " Tree Node Class\n\n    Tree node class to contain all the statistics of the tree node.\n\n    Parameters\n    ----------\n    classes_ : list of str\n        A list of the control and treatment group names.\n\n    col : int, optional (default = -1)\n        The column index for splitting the tree node to children nodes.\n\n    value : float, optional (default = None)\n        The value of the feature column to split the tree node to children nodes.\n\n    trueBranch : object of DecisionTree\n        The true branch tree node (feature > value).\n\n    falseBranch : object of DecisionTree\n        The false branch tree node (feature > value).\n\n    results : list of float\n        The classification probability P(Y=1|T) for each of the control and treatment groups\n        in the tree node.\n\n    summary : list of list\n        Summary statistics of the tree nodes, including impurity, sample size, uplift score, etc.\n\n    maxDiffTreatment : int\n        The treatment index generating the maximum difference between the treatment and control groups.\n\n    maxDiffSign : float\n        The sign of the maximum difference (1. or -1.).\n\n    nodeSummary : list of list\n        Summary statistics of the tree nodes [P(Y=1|T), N(T)], where y_mean stands for the target metric mean\n        and n is the sample size.\n\n    backupResults : list of float\n        The positive probabilities in each of the control and treatment groups in the parent node. The parent node\n        information is served as a backup for the children node, in case no valid statistics can be calculated from the\n        children node, the parent node information will be used in certain cases.\n\n    bestTreatment : int\n        The treatment index providing the best uplift (treatment effect).\n\n    upliftScore : list\n        The uplift score of this node: [max_Diff, p_value], where max_Diff stands for the maximum treatment effect, and\n        p_value stands for the p_value of the treatment effect.""\n\n    matchScore : float\n        The uplift score by filling a trained tree with validation dataset or testing dataset.\n\n    ";
static const char __pyx_k_Uplift_Random_Forest_for_Classi[] = " Uplift Random Forest for Classification Task.\n\n    Parameters\n    ----------\n    n_estimators : integer, optional (default=10)\n        The number of trees in the uplift random forest.\n\n    evaluationFunction : string\n        Choose from one of the models: 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', 'IDDP'.\n\n    max_features: int, optional (default=10)\n        The number of features to consider when looking for the best split.\n\n    random_state: int, RandomState instance or None (default=None)\n        A random seed or `np.random.RandomState` to control randomness in building the trees and forest.\n\n    max_depth: int, optional (default=5)\n        The maximum depth of the tree.\n\n    min_samples_leaf: int, optional (default=100)\n        The minimum number of samples required to be split at a leaf node.\n\n    min_samples_treatment: int, optional (default=10)\n        The minimum number of samples required of the experiment group to be split at a leaf node.\n\n    n_reg: int, optional (default=10)\n        The regularization parameter defined in Rzepakowski et al. 2012, the\n        weight (in terms of sample size) of the parent node influence on the\n        child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n\n    early_stopping_eval_diff_scale: float, optional (default=1)\n        If train and valid uplift score diff bigger than \n        min(train_uplift_score,valid_uplift_score)/early_stopping_eval_diff_scale, stop.\n\n    control_name: string\n        The name of the control group (other experiment groups will be regarded as treatment groups)\n\n    normalization: boolean, optional (default=True)\n        The normalization factor defined in Rzepakowski et al. 2012,\n        correcting for tests with large number of splits and imbalanced\n        treatment and control splits\n\n    honesty: bool (default=False)\n     True if the honest approach based on \"Athey, S., & Imbens, G. (2016). Recursive partitioning for\n     heterogene""ous causal effects.\" shall be used.\n\n    estimation_sample_size: float (default=0.5)\n         Sample size for estimating the CATE score in the leaves if honesty == True.\n\n    n_jobs: int, optional (default=-1)\n        The parallelization parameter to define how many parallel jobs need to be created.\n        This is passed on to joblib library for parallelizing uplift-tree creation and prediction.\n\n    joblib_prefer: str, optional (default=\"threads\")\n        The preferred backend for joblib (passed as `prefer` to joblib.Parallel). See the joblib\n        documentation for valid values.\n\n    Outputs\n    ----------\n    df_res: pandas dataframe\n        A user-level results dataframe containing the estimated individual treatment effect.\n    ";
static const char __pyx_k_Uplift_Tree_Classifier_for_Clas[] = " Uplift Tree Classifier for Classification Task.\n\n    A uplift tree classifier estimates the individual treatment effect by modifying the loss function in the\n    classification trees.\n\n    The uplift tree classifier is used in uplift random forest to construct the trees in the forest.\n\n    Parameters\n    ----------\n\n    evaluationFunction : string\n        Choose from one of the models: 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', 'IDDP'.\n\n    max_features: int, optional (default=None)\n        The number of features to consider when looking for the best split.\n\n    max_depth: int, optional (default=3)\n        The maximum depth of the tree.\n\n    min_samples_leaf: int, optional (default=100)\n        The minimum number of samples required to be split at a leaf node.\n\n    min_samples_treatment: int, optional (default=10)\n        The minimum number of samples required of the experiment group to be split at a leaf node.\n\n    n_reg: int, optional (default=100)\n        The regularization parameter defined in Rzepakowski et al. 2012, the weight (in terms of sample size) of the\n        parent node influence on the child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n    \n    early_stopping_eval_diff_scale: float, optional (default=1)\n        If train and valid uplift score diff bigger than \n        min(train_uplift_score,valid_uplift_score)/early_stopping_eval_diff_scale, stop.\n\n    control_name: string\n        The name of the control group (other experiment groups will be regarded as treatment groups).\n\n    normalization: boolean, optional (default=True)\n        The normalization factor defined in Rzepakowski et al. 2012, correcting for tests with large number of splits\n        and imbalanced treatment and control splits.\n\n    honesty: bool (default=False)\n         True if the honest approach based on \"Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects.\"\n         shall be used. If '""IDDP' is used as evaluation function, this parameter is automatically set to true.\n\n    estimation_sample_size: float (default=0.5)\n         Sample size for estimating the CATE score in the leaves if honesty == True.\n\n    random_state: int, RandomState instance or None (default=None)\n        A random seed or `np.random.RandomState` to control randomness in building a tree.\n\n    ";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
static const char __pyx_k_Stratified_sampling_failed_Falli[] = "Stratified sampling failed. Falling back to random sampling.";
static const char __pyx_k_The_DDP_IDDP_IT_and_CIT_approach[] = "The DDP, IDDP, IT, and CIT approach can only cope with two class problems, that is two different treatment options (e.g., control vs treatment). Please select another approach or only use a dataset which employs two treatment options.";
static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
static const char __pyx_k_UpliftRandomForestClassifier___i[] = "UpliftRandomForestClassifier.__init__";
static const char __pyx_k_UpliftRandomForestClassifier_boo[] = "UpliftRandomForestClassifier.bootstrap";
static const char __pyx_k_UpliftRandomForestClassifier_fit[] = "UpliftRandomForestClassifier.fit.<locals>.genexpr";
static const char __pyx_k_UpliftRandomForestClassifier_pre[] = "UpliftRandomForestClassifier.predict.<locals>.genexpr";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat[] = "UpliftTreeClassifier.arr_evaluate_KL";
static const char __pyx_k_UpliftTreeClassifier_classify_lo[] = "UpliftTreeClassifier.classify.<locals>.classifyWithoutMissingData";
static const char __pyx_k_UpliftTreeClassifier_divideSet_l[] = "UpliftTreeClassifier.divideSet_len";
static const char __pyx_k_UpliftTreeClassifier_evaluate_CI[] = "UpliftTreeClassifier.evaluate_CIT";
static const char __pyx_k_UpliftTreeClassifier_evaluate_CT[] = "UpliftTreeClassifier.evaluate_CTS";
static const char __pyx_k_UpliftTreeClassifier_evaluate_Ch[] = "UpliftTreeClassifier.evaluate_Chi";
static const char __pyx_k_UpliftTreeClassifier_evaluate_DD[] = "UpliftTreeClassifier.evaluate_DDP";
static const char __pyx_k_UpliftTreeClassifier_evaluate_ED[] = "UpliftTreeClassifier.evaluate_ED";
static const char __pyx_k_UpliftTreeClassifier_evaluate_ID[] = "UpliftTreeClassifier.evaluate_IDDP";
static const char __pyx_k_UpliftTreeClassifier_evaluate_IT[] = "UpliftTreeClassifier.evaluate_IT";
static const char __pyx_k_UpliftTreeClassifier_evaluate_KL[] = "UpliftTreeClassifier.evaluate_KL";
static const char __pyx_k_UpliftTreeClassifier_group_uniqu[] = "UpliftTreeClassifier.group_uniqueCounts";
static const char __pyx_k_UpliftTreeClassifier_growDecisio[] = "UpliftTreeClassifier.growDecisionTreeFrom";
static const char __pyx_k_UpliftTreeClassifier_honestAppro[] = "UpliftTreeClassifier.honestApproach";
static const char __pyx_k_UpliftTreeClassifier_modifyEstim[] = "UpliftTreeClassifier.modifyEstimation";
static const char __pyx_k_UpliftTreeClassifier_tree_node_s[] = "UpliftTreeClassifier.tree_node_summary";
static const char __pyx_k_UpliftTreeClassifier_uplift_clas[] = "UpliftTreeClassifier.uplift_classification_results";
static const char __pyx_k_causalml_inference_tree_uplift_p[] = "causalml/inference/tree/uplift.pyx";
static const char __pyx_k_control_group_should_be_string_b[] = "control_group should be string but ";
static const char __pyx_k_evaluationFunction_should_be_eit[] = "evaluationFunction should be either 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', or 'IDDP' but ";
static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
static const char __pyx_k_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 const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
static const char __pyx_k_Data_length_must_be_equal_for_X_2[] = "Data length must be equal for X_val, treatment_val, and y_val.";
static const char __pyx_k_UpliftRandomForestClassifier_fit_2[] = "UpliftRandomForestClassifier.fit";
static const char __pyx_k_UpliftRandomForestClassifier_pre_2[] = "UpliftRandomForestClassifier.predict";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_2[] = "UpliftTreeClassifier.arr_evaluate_ED";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_3[] = "UpliftTreeClassifier.arr_evaluate_Chi";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_4[] = "UpliftTreeClassifier.arr_evaluate_DDP";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_5[] = "UpliftTreeClassifier.arr_evaluate_IT";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_6[] = "UpliftTreeClassifier.arr_evaluate_CIT";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_7[] = "UpliftTreeClassifier.arr_evaluate_IDDP";
static const char __pyx_k_UpliftTreeClassifier_arr_evaluat_8[] = "UpliftTreeClassifier.arr_evaluate_CTS";
static const char __pyx_k_UpliftTreeClassifier_classify_lo_2[] = "UpliftTreeClassifier.classify.<locals>.classifyWithMissingData";
static const char __pyx_k_UpliftTreeClassifier_tree_node_s_2[] = "UpliftTreeClassifier.tree_node_summary_to_arr";
static const char __pyx_k_UpliftTreeClassifier_tree_node_s_3[] = "UpliftTreeClassifier.tree_node_summary_from_counts";
static PyObject *__pyx_kp_u_0_22_0;
static PyObject *__pyx_kp_u_3f;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
static PyObject *__pyx_n_u_CIT;
static PyObject *__pyx_n_u_CTS;
static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
static PyObject *__pyx_n_u_Chi;
static PyObject *__pyx_n_u_DDP;
static PyObject *__pyx_n_s_DataFrame;
static PyObject *__pyx_kp_u_Data_length_must_be_equal_for_X;
static PyObject *__pyx_kp_u_Data_length_must_be_equal_for_X_2;
static PyObject *__pyx_n_s_DecisionTree;
static PyObject *__pyx_n_s_DecisionTree___init;
static PyObject *__pyx_n_u_ED;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
static PyObject *__pyx_n_s_FutureWarning;
static PyObject *__pyx_n_u_IDDP;
static PyObject *__pyx_n_u_IT;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
static PyObject *__pyx_n_u_KL;
static PyObject *__pyx_n_s_MAX_INT;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
static PyObject *__pyx_kp_s_MemoryView_of_r_object;
static PyObject *__pyx_n_s_N_TYPE;
static PyObject *__pyx_n_b_O;
static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
static PyObject *__pyx_n_s_P_TYPE;
static PyObject *__pyx_n_s_Parallel;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_u_Stratified_sampling_failed_Falli;
static PyObject *__pyx_n_s_TR_TYPE;
static PyObject *__pyx_n_s_T_est;
static PyObject *__pyx_kp_u_The_DDP_IDDP_IT_and_CIT_approach;
static PyObject *__pyx_kp_s_Tree_Node_Class_Tree_node_class;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier___i;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier_boo;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier_fit;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier_fit_2;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier_pre;
static PyObject *__pyx_n_s_UpliftRandomForestClassifier_pre_2;
static PyObject *__pyx_n_s_UpliftTreeClassifier;
static PyObject *__pyx_n_s_UpliftTreeClassifier___init;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_2;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_3;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_4;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_5;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_6;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_7;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_evaluat_8;
static PyObject *__pyx_n_s_UpliftTreeClassifier_arr_normI;
static PyObject *__pyx_n_s_UpliftTreeClassifier_classify;
static PyObject *__pyx_n_s_UpliftTreeClassifier_classify_lo;
static PyObject *__pyx_n_s_UpliftTreeClassifier_classify_lo_2;
static PyObject *__pyx_n_s_UpliftTreeClassifier_divideSet;
static PyObject *__pyx_n_s_UpliftTreeClassifier_divideSet_l;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_CI;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_CT;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_Ch;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_DD;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_ED;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_ID;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_IT;
static PyObject *__pyx_n_s_UpliftTreeClassifier_evaluate_KL;
static PyObject *__pyx_n_s_UpliftTreeClassifier_fill;
static PyObject *__pyx_n_s_UpliftTreeClassifier_fillTree;
static PyObject *__pyx_n_s_UpliftTreeClassifier_fit;
static PyObject *__pyx_n_s_UpliftTreeClassifier_group_uniqu;
static PyObject *__pyx_n_s_UpliftTreeClassifier_growDecisio;
static PyObject *__pyx_n_s_UpliftTreeClassifier_honestAppro;
static PyObject *__pyx_n_s_UpliftTreeClassifier_modifyEstim;
static PyObject *__pyx_n_s_UpliftTreeClassifier_normI;
static PyObject *__pyx_n_s_UpliftTreeClassifier_predict;
static PyObject *__pyx_n_s_UpliftTreeClassifier_prune;
static PyObject *__pyx_n_s_UpliftTreeClassifier_pruneTree;
static PyObject *__pyx_n_s_UpliftTreeClassifier_tree_node_s;
static PyObject *__pyx_n_s_UpliftTreeClassifier_tree_node_s_2;
static PyObject *__pyx_n_s_UpliftTreeClassifier_tree_node_s_3;
static PyObject *__pyx_n_s_UpliftTreeClassifier_uplift_clas;
static PyObject *__pyx_kp_s_Uplift_Random_Forest_for_Classi;
static PyObject *__pyx_kp_s_Uplift_Tree_Classifier_for_Clas;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_View_MemoryView;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_X_est;
static PyObject *__pyx_n_s_X_l;
static PyObject *__pyx_n_s_X_r;
static PyObject *__pyx_n_s_X_val;
static PyObject *__pyx_n_s_X_val_l;
static PyObject *__pyx_n_s_X_val_r;
static PyObject *__pyx_n_s_Y_TYPE;
static PyObject *__pyx_n_s_Y_est;
static PyObject *__pyx_n_s__32;
static PyObject *__pyx_kp_u__4;
static PyObject *__pyx_kp_u__5;
static PyObject *__pyx_kp_u__6;
static PyObject *__pyx_n_s__62;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_abs;
static PyObject *__pyx_n_s_all_importances;
static PyObject *__pyx_n_s_allocate_buffer;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_apply;
static PyObject *__pyx_n_s_argmax;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_arr_eval_func;
static PyObject *__pyx_n_s_arr_evaluate_CIT;
static PyObject *__pyx_n_s_arr_evaluate_CTS;
static PyObject *__pyx_n_s_arr_evaluate_Chi;
static PyObject *__pyx_n_s_arr_evaluate_DDP;
static PyObject *__pyx_n_s_arr_evaluate_ED;
static PyObject *__pyx_n_s_arr_evaluate_IDDP;
static PyObject *__pyx_n_s_arr_evaluate_IT;
static PyObject *__pyx_n_s_arr_evaluate_KL;
static PyObject *__pyx_n_s_arr_normI;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_backupResults;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_bestAttribute;
static PyObject *__pyx_n_s_bestGain;
static PyObject *__pyx_n_s_bestGainImp;
static PyObject *__pyx_n_s_bestTreatment;
static PyObject *__pyx_n_u_bestUplift;
static PyObject *__pyx_n_s_best_col;
static PyObject *__pyx_n_s_best_set_left;
static PyObject *__pyx_n_s_best_set_right;
static PyObject *__pyx_n_s_best_value;
static PyObject *__pyx_n_s_bootstrap;
static PyObject *__pyx_n_s_branch;
static PyObject *__pyx_n_s_bt_index;
static PyObject *__pyx_n_s_bt_val_index;
static PyObject *__pyx_n_s_buf_count_arr;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_u_c;
static PyObject *__pyx_n_s_c_cat_percentiles;
static PyObject *__pyx_n_s_c_num_percentiles;
static PyObject *__pyx_n_s_category;
static PyObject *__pyx_n_u_causalml;
static PyObject *__pyx_n_s_causalml_inference_tree_uplift;
static PyObject *__pyx_kp_s_causalml_inference_tree_uplift_p;
static PyObject *__pyx_n_s_cdf;
static PyObject *__pyx_n_s_check_X_y;
static PyObject *__pyx_n_s_check_array;
static PyObject *__pyx_n_s_check_random_state;
static PyObject *__pyx_n_s_choice;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_classes;
static PyObject *__pyx_n_s_classify;
static PyObject *__pyx_n_s_classifyWithMissingData;
static PyObject *__pyx_n_s_classifyWithoutMissingData;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_col;
static PyObject *__pyx_n_s_col_vals;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_column;
static PyObject *__pyx_n_s_columnCount;
static PyObject *__pyx_n_s_columnValues;
static PyObject *__pyx_n_s_columns;
static PyObject *__pyx_kp_s_contiguous_and_direct;
static PyObject *__pyx_kp_s_contiguous_and_indirect;
static PyObject *__pyx_kp_u_control_group_should_be_string_b;
static PyObject *__pyx_n_s_control_name;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_counts;
static PyObject *__pyx_n_s_cpu_count;
static PyObject *__pyx_n_s_cur_node_summary_n;
static PyObject *__pyx_n_s_cur_node_summary_p;
static PyObject *__pyx_n_s_cur_summary_n;
static PyObject *__pyx_n_s_cur_summary_p;
static PyObject *__pyx_n_s_currentDivergence;
static PyObject *__pyx_n_s_currentNodeSummary;
static PyObject *__pyx_n_s_currentScore;
static PyObject *__pyx_n_s_currentScoreD;
static PyObject *__pyx_kp_u_d;
static PyObject *__pyx_n_s_d_res;
static PyObject *__pyx_n_s_dataMissing;
static PyObject *__pyx_n_s_dcY;
static PyObject *__pyx_n_s_defaultdict;
static PyObject *__pyx_n_s_delayed;
static PyObject *__pyx_n_u_delta;
static PyObject *__pyx_n_s_delta_cols;
static PyObject *__pyx_n_s_depth;
static PyObject *__pyx_n_s_df_res;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_diff;
static PyObject *__pyx_n_s_diff_sq;
static PyObject *__pyx_n_s_divideSet;
static PyObject *__pyx_n_s_divideSet_len;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_dtype_is_object;
static PyObject *__pyx_n_s_early_stopping_eval_diff_scale;
static PyObject *__pyx_n_s_early_stopping_flag;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_estimation_sample_size;
static PyObject *__pyx_n_s_evaluate_CIT;
static PyObject *__pyx_n_s_evaluate_CTS;
static PyObject *__pyx_n_s_evaluate_Chi;
static PyObject *__pyx_n_s_evaluate_DDP;
static PyObject *__pyx_n_s_evaluate_ED;
static PyObject *__pyx_n_s_evaluate_IDDP;
static PyObject *__pyx_n_s_evaluate_IT;
static PyObject *__pyx_n_s_evaluate_KL;
static PyObject *__pyx_n_s_evaluationFunction;
static PyObject *__pyx_kp_u_evaluationFunction_should_be_eit;
static PyObject *__pyx_n_s_falseBranch;
static PyObject *__pyx_n_s_falseNodeSummary;
static PyObject *__pyx_n_s_falseScoreD;
static PyObject *__pyx_n_s_fcount;
static PyObject *__pyx_n_s_feature_imp_dict;
static PyObject *__pyx_n_s_feature_importances;
static PyObject *__pyx_n_s_fill;
static PyObject *__pyx_n_s_fillTree;
static PyObject *__pyx_n_s_filt;
static PyObject *__pyx_n_s_fit;
static PyObject *__pyx_n_s_fitted_uplift_tree;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_u_float;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fortran;
static PyObject *__pyx_n_u_fortran;
static PyObject *__pyx_n_s_fr;
static PyObject *__pyx_n_s_full_output;
static PyObject *__pyx_n_s_fw;
static PyObject *__pyx_n_s_g_s;
static PyObject *__pyx_n_s_gain;
static PyObject *__pyx_n_s_gain_for_imp;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
static PyObject *__pyx_n_s_group_count_arr;
static PyObject *__pyx_n_s_group_counts_by_divide;
static PyObject *__pyx_n_u_group_size;
static PyObject *__pyx_n_s_group_uniqueCounts;
static PyObject *__pyx_n_s_group_uniqueCounts_to_arr;
static PyObject *__pyx_n_s_growDecisionTreeFrom;
static PyObject *__pyx_n_s_has_parent_summary;
static PyObject *__pyx_n_s_honestApproach;
static PyObject *__pyx_n_s_honesty;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_i_row;
static PyObject *__pyx_n_s_i_tau;
static PyObject *__pyx_n_s_i_tau_l;
static PyObject *__pyx_n_s_i_tau_r;
static PyObject *__pyx_n_s_i_tr;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_ignore_warnings;
static PyObject *__pyx_n_s_iinfo;
static PyObject *__pyx_n_s_imp;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_u_impurity;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_u_int;
static PyObject *__pyx_n_s_int32;
static PyObject *__pyx_n_s_int8;
static PyObject *__pyx_kp_u_is_passed;
static PyObject *__pyx_n_s_is_split_by_gt;
static PyObject *__pyx_n_s_issubdtype;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
static PyObject *__pyx_n_s_joblib;
static PyObject *__pyx_n_s_joblib_prefer;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_leftNodeSummary;
static PyObject *__pyx_n_s_leftScore1;
static PyObject *__pyx_n_s_left_count_arr;
static PyObject *__pyx_n_s_left_node_summary_n;
static PyObject *__pyx_n_s_left_node_summary_p;
static PyObject *__pyx_n_s_left_summary_n;
static PyObject *__pyx_n_s_left_summary_p;
static PyObject *__pyx_n_s_len_X;
static PyObject *__pyx_n_s_len_X_l;
static PyObject *__pyx_n_s_len_X_r;
static PyObject *__pyx_n_s_len_X_val;
static PyObject *__pyx_n_s_len_X_val_l;
static PyObject *__pyx_n_u_list;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_lrt;
static PyObject *__pyx_n_s_lsUnique;
static PyObject *__pyx_n_s_lspercentile;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matchScore;
static PyObject *__pyx_n_u_matchScore;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_maxAbsDiff;
static PyObject *__pyx_n_u_maxAbsDiff;
static PyObject *__pyx_n_s_maxDiff;
static PyObject *__pyx_n_s_maxDiffSign;
static PyObject *__pyx_n_s_maxDiffTreatment;
static PyObject *__pyx_n_u_max_delta;
static PyObject *__pyx_n_s_max_depth;
static PyObject *__pyx_n_s_max_eps_1_pc;
static PyObject *__pyx_n_s_max_eps_pc;
static PyObject *__pyx_n_s_max_features;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_n_s_memview;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_minGain;
static PyObject *__pyx_n_s_min_samples_leaf;
static PyObject *__pyx_n_s_min_samples_treatment;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_modifyEstimation;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_mp;
static PyObject *__pyx_n_s_multiprocessing;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_n_1;
static PyObject *__pyx_n_s_n_2;
static PyObject *__pyx_n_s_n_3;
static PyObject *__pyx_n_s_n_4;
static PyObject *__pyx_n_s_n_c;
static PyObject *__pyx_n_s_n_c_left;
static PyObject *__pyx_n_s_n_class;
static PyObject *__pyx_n_s_n_estimators;
static PyObject *__pyx_n_s_n_jobs;
static PyObject *__pyx_n_s_n_l_t;
static PyObject *__pyx_n_s_n_l_t_0;
static PyObject *__pyx_n_s_n_l_t_1;
static PyObject *__pyx_n_s_n_min_sams;
static PyObject *__pyx_n_s_n_pos;
static PyObject *__pyx_n_s_n_r_t;
static PyObject *__pyx_n_s_n_r_t_0;
static PyObject *__pyx_n_s_n_r_t_1;
static PyObject *__pyx_n_s_n_reg;
static PyObject *__pyx_n_s_n_reg_p;
static PyObject *__pyx_n_s_n_t;
static PyObject *__pyx_n_s_n_t_0;
static PyObject *__pyx_n_s_n_t_1;
static PyObject *__pyx_n_s_n_t_left;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_nodeSummary;
static PyObject *__pyx_n_s_node_mst;
static PyObject *__pyx_n_s_node_summary_n;
static PyObject *__pyx_n_s_node_summary_p;
static PyObject *__pyx_n_s_norm;
static PyObject *__pyx_n_s_normI;
static PyObject *__pyx_n_s_norm_factor;
static PyObject *__pyx_n_s_norm_res;
static PyObject *__pyx_n_s_normalization;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_num_samples;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_observations;
static PyObject *__pyx_n_s_out_arr;
static PyObject *__pyx_n_s_out_arr_len;
static PyObject *__pyx_n_s_out_summary_n;
static PyObject *__pyx_n_s_out_summary_p;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_p_c;
static PyObject *__pyx_n_s_p_t;
static PyObject *__pyx_n_s_p_value;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_packaging;
static PyObject *__pyx_n_s_pandas;
static PyObject *__pyx_n_s_parentNodeSummary;
static PyObject *__pyx_n_s_parentNodeSummary_p;
static PyObject *__pyx_n_s_parent_summary_p;
static PyObject *__pyx_n_s_parse;
static PyObject *__pyx_n_s_pc;
static PyObject *__pyx_n_s_pc_a;
static PyObject *__pyx_n_s_pd;
static PyObject *__pyx_n_s_percentile;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_power;
static PyObject *__pyx_n_s_pred_leaf;
static PyObject *__pyx_n_s_pred_nodes;
static PyObject *__pyx_n_s_predict;
static PyObject *__pyx_n_s_prefer;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prune;
static PyObject *__pyx_n_s_pruneTree;
static PyObject *__pyx_n_s_pt_a;
static PyObject *__pyx_n_s_pt_a_i;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_getbuffer;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Enum;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_randint;
static PyObject *__pyx_n_s_random_state;
static PyObject *__pyx_n_s_random_state_2;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_u_recommended_treatment;
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_replace;
static PyObject *__pyx_n_s_res;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_results;
static PyObject *__pyx_n_s_return;
static PyObject *__pyx_n_s_rightNodeSummary;
static PyObject *__pyx_n_s_rightScore2;
static PyObject *__pyx_n_s_right_count_arr;
static PyObject *__pyx_n_s_right_node_summary_n;
static PyObject *__pyx_n_s_right_node_summary_p;
static PyObject *__pyx_n_s_right_summary_n;
static PyObject *__pyx_n_s_right_summary_p;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_n_s_rule;
static PyObject *__pyx_n_s_s_1;
static PyObject *__pyx_n_s_s_2;
static PyObject *__pyx_n_s_s_3;
static PyObject *__pyx_n_s_s_4;
static PyObject *__pyx_n_u_samples;
static PyObject *__pyx_n_s_scipy_stats;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_shuffle;
static PyObject *__pyx_n_s_sigma;
static PyObject *__pyx_n_s_sign;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sklearn;
static PyObject *__pyx_n_s_sklearn_model_selection;
static PyObject *__pyx_n_s_sklearn_utils;
static PyObject *__pyx_n_s_sklearn_utils__testing;
static PyObject *__pyx_n_s_sklearn_utils_testing;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_sse_tau;
static PyObject *__pyx_n_s_sse_tau_l;
static PyObject *__pyx_n_s_sse_tau_r;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_stat;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_stats;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_stratify;
static PyObject *__pyx_kp_s_strided_and_direct;
static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
static PyObject *__pyx_kp_s_strided_and_indirect;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_suboptTreatment;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_sum_n;
static PyObject *__pyx_n_s_sum_n_t;
static PyObject *__pyx_n_s_sum_n_t_left;
static PyObject *__pyx_n_s_summary;
static PyObject *__pyx_n_s_t_est;
static PyObject *__pyx_n_s_tcount;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_size;
static PyObject *__pyx_n_u_threads;
static PyObject *__pyx_n_s_threshold_val;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_total_count_arr;
static PyObject *__pyx_n_s_tr;
static PyObject *__pyx_n_s_train_test_split;
static PyObject *__pyx_n_s_treatment;
static PyObject *__pyx_n_s_treatment_group;
static PyObject *__pyx_n_s_treatment_groups;
static PyObject *__pyx_n_s_treatment_idx;
static PyObject *__pyx_n_s_treatment_idx_est;
static PyObject *__pyx_n_s_treatment_left;
static PyObject *__pyx_n_s_treatment_right;
static PyObject *__pyx_n_s_treatment_train_bt;
static PyObject *__pyx_n_s_treatment_val;
static PyObject *__pyx_n_s_treatment_val_bt;
static PyObject *__pyx_n_s_treatment_val_idx;
static PyObject *__pyx_n_s_tree;
static PyObject *__pyx_n_s_tree_node_summary;
static PyObject *__pyx_n_s_tree_node_summary_from_counts;
static PyObject *__pyx_n_s_tree_node_summary_to_arr;
static PyObject *__pyx_n_s_trueBranch;
static PyObject *__pyx_n_s_trueNodeSummary;
static PyObject *__pyx_n_s_trueScoreD;
static PyObject *__pyx_n_s_tv;
static PyObject *__pyx_n_s_tw;
static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
static PyObject *__pyx_n_u_unicode;
static PyObject *__pyx_n_s_unique;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upliftScore;
static PyObject *__pyx_n_u_upliftScore;
static PyObject *__pyx_n_s_uplift_classification_results;
static PyObject *__pyx_n_s_uplift_forest;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_val_left_count_arr;
static PyObject *__pyx_n_s_val_left_summary_n;
static PyObject *__pyx_n_s_val_left_summary_p;
static PyObject *__pyx_n_s_val_right_count_arr;
static PyObject *__pyx_n_s_val_right_summary_n;
static PyObject *__pyx_n_s_val_right_summary_p;
static PyObject *__pyx_n_s_val_total_count_arr;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_version_2;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_w_1;
static PyObject *__pyx_n_s_w_2;
static PyObject *__pyx_n_s_w_3;
static PyObject *__pyx_n_s_w_4;
static PyObject *__pyx_n_s_w_l;
static PyObject *__pyx_n_s_w_r;
static PyObject *__pyx_n_s_w_val_l;
static PyObject *__pyx_n_s_w_val_r;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_x_train_bt;
static PyObject *__pyx_n_s_x_val_bt;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_y_est;
static PyObject *__pyx_n_s_y_l;
static PyObject *__pyx_n_s_y_l_0;
static PyObject *__pyx_n_s_y_l_1;
static PyObject *__pyx_n_s_y_pred_ensemble;
static PyObject *__pyx_n_s_y_r;
static PyObject *__pyx_n_s_y_r_0;
static PyObject *__pyx_n_s_y_r_1;
static PyObject *__pyx_n_s_y_train_bt;
static PyObject *__pyx_n_s_y_val;
static PyObject *__pyx_n_s_y_val_bt;
static PyObject *__pyx_n_s_y_val_l;
static PyObject *__pyx_n_s_y_val_r;
static PyObject *__pyx_n_s_yv;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_n_s_zeros_like;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_12DecisionTree___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_classes_, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_trueBranch, PyObject *__pyx_v_falseBranch, PyObject *__pyx_v_results, PyObject *__pyx_v_summary, PyObject *__pyx_v_maxDiffTreatment, PyObject *__pyx_v_maxDiffSign, PyObject *__pyx_v_nodeSummary, PyObject *__pyx_v_backupResults, PyObject *__pyx_v_bestTreatment, PyObject *__pyx_v_upliftScore, PyObject *__pyx_v_matchScore); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_group_uniqueCounts_to_arr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_arr); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_2group_counts_by_divide(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_col_vals, PyObject *__pyx_v_threshold_val, PyObject *__pyx_v_is_split_by_gt, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_arr); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_name, PyObject *__pyx_v_max_features, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_evaluationFunction, PyObject *__pyx_v_normalization, PyObject *__pyx_v_honesty, PyObject *__pyx_v_estimation_sample_size, PyObject *__pyx_v_random_state); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_2fit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_4prune(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_minGain, PyObject *__pyx_v_rule); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_6honestApproach(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_est, PyObject *__pyx_v_T_est, PyObject *__pyx_v_Y_est); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8modifyEstimation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_est, PyObject *__pyx_v_t_est, PyObject *__pyx_v_y_est, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_10pruneTree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_tree, PyObject *__pyx_v_rule, PyObject *__pyx_v_minGain, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_12fill(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_14fillTree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_16predict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_18divideSet(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_column, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_20divideSet_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_column, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_22group_uniqueCounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_24evaluate_KL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_26arr_evaluate_KL(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_28evaluate_ED(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_30arr_evaluate_ED(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_32evaluate_Chi(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_34arr_evaluate_Chi(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_36evaluate_DDP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_38arr_evaluate_DDP(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_40evaluate_IT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_leftNodeSummary, PyObject *__pyx_v_rightNodeSummary, CYTHON_UNUSED PyObject *__pyx_v_w_l, CYTHON_UNUSED PyObject *__pyx_v_w_r); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_42arr_evaluate_IT(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_node_summary_p, PyArrayObject *__pyx_v_left_node_summary_n, PyArrayObject *__pyx_v_right_node_summary_p, PyArrayObject *__pyx_v_right_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_44evaluate_CIT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_currentNodeSummary, PyObject *__pyx_v_leftNodeSummary, PyObject *__pyx_v_rightNodeSummary, PyObject *__pyx_v_y_l, PyObject *__pyx_v_y_r, PyObject *__pyx_v_w_l, PyObject *__pyx_v_w_r, PyObject *__pyx_v_y, PyObject *__pyx_v_w); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_46arr_evaluate_CIT(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_cur_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_cur_node_summary_n, PyArrayObject *__pyx_v_left_node_summary_p, PyArrayObject *__pyx_v_left_node_summary_n, PyArrayObject *__pyx_v_right_node_summary_p, PyArrayObject *__pyx_v_right_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_48evaluate_IDDP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_50arr_evaluate_IDDP(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_52evaluate_CTS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_54arr_evaluate_CTS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_56normI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_n_c, int __pyx_v_n_c_left, PyObject *__pyx_v_n_t, PyObject *__pyx_v_n_t_left, float __pyx_v_alpha, float __pyx_v_currentDivergence); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_58arr_normI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cur_node_summary_n, PyObject *__pyx_v_left_node_summary_n, float __pyx_v_alpha, float __pyx_v_currentDivergence); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_60tree_node_summary(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_62tree_node_summary_to_arr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_summary_p, PyArrayObject *__pyx_v_out_summary_n, PyArrayObject *__pyx_v_buf_count_arr, PyArrayObject *__pyx_v_parentNodeSummary_p, int __pyx_v_has_parent_summary, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_64tree_node_summary_from_counts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_group_count_arr, PyArrayObject *__pyx_v_out_summary_p, PyArrayObject *__pyx_v_out_summary_n, PyArrayObject *__pyx_v_parentNodeSummary_p, int __pyx_v_has_parent_summary, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_66uplift_classification_results(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_68growDecisionTreeFrom(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val_idx, PyObject *__pyx_v_y_val, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_depth, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary_p); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData(PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_70classify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree, PyObject *__pyx_v_dataMissing); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_name, PyObject *__pyx_v_n_estimators, PyObject *__pyx_v_max_features, PyObject *__pyx_v_random_state, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_evaluationFunction, PyObject *__pyx_v_normalization, PyObject *__pyx_v_honesty, CYTHON_UNUSED PyObject *__pyx_v_estimation_sample_size, PyObject *__pyx_v_n_jobs, PyObject *__pyx_v_joblib_prefer); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_2fit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_4bootstrap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val, PyObject *__pyx_v_tree); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_6predict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_full_output); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_0_;
static PyObject *__pyx_float_1_;
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_0_1;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_0_9;
static PyObject *__pyx_float_0_0001;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_30;
static PyObject *__pyx_int_50;
static PyObject *__pyx_int_70;
static PyObject *__pyx_int_80;
static PyObject *__pyx_int_90;
static PyObject *__pyx_int_95;
static PyObject *__pyx_int_97;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_112105877;
static PyObject *__pyx_int_136983863;
static PyObject *__pyx_int_184977713;
static PyObject *__pyx_int_neg_1;
static float __pyx_k_;
static PyObject *__pyx_slice__3;
static PyObject *__pyx_slice__7;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
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__22;
static PyObject *__pyx_tuple__23;
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__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__43;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__59;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__86;
static PyObject *__pyx_codeobj__88;
static PyObject *__pyx_codeobj__90;
static PyObject *__pyx_codeobj__92;
static PyObject *__pyx_codeobj__94;
static PyObject *__pyx_codeobj__96;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__104;
static PyObject *__pyx_codeobj__106;
static PyObject *__pyx_codeobj__108;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__131;
static PyObject *__pyx_codeobj__133;
static PyObject *__pyx_codeobj__141;
/* Late includes */

/* "causalml/inference/tree/uplift.pyx":62
 * 
 * @cython.cfunc
 * def kl_divergence(pk: cython.float, qk: cython.float) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Calculate KL Divergence for binary classification.
 */

static float __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(float __pyx_v_pk, float __pyx_v_qk) {
  float __pyx_v_eps;
  float __pyx_v_S;
  float __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  float __pyx_t_2;
  float __pyx_t_3;
  float __pyx_t_4;
  float __pyx_t_5;
  __Pyx_RefNannySetupContext("kl_divergence", 0);

  /* "causalml/inference/tree/uplift.pyx":81
 *     '''
 * 
 *     eps: cython.float = 1e-6             # <<<<<<<<<<<<<<
 *     S: cython.float
 * 
 */
  __pyx_v_eps = 1e-6;

  /* "causalml/inference/tree/uplift.pyx":84
 *     S: cython.float
 * 
 *     if qk == 0.:             # <<<<<<<<<<<<<<
 *         return 0.
 * 
 */
  __pyx_t_1 = ((__pyx_v_qk == 0.) != 0);
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":85
 * 
 *     if qk == 0.:
 *         return 0.             # <<<<<<<<<<<<<<
 * 
 *     qk = min(max(qk, eps), 1 - eps)
 */
    __pyx_r = 0.;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":84
 *     S: cython.float
 * 
 *     if qk == 0.:             # <<<<<<<<<<<<<<
 *         return 0.
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":87
 *         return 0.
 * 
 *     qk = min(max(qk, eps), 1 - eps)             # <<<<<<<<<<<<<<
 * 
 *     if pk == 0.:
 */
  __pyx_t_2 = (1.0 - __pyx_v_eps);
  __pyx_t_3 = __pyx_v_eps;
  __pyx_t_4 = __pyx_v_qk;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_t_3 = __pyx_t_5;
  if (((__pyx_t_2 < __pyx_t_3) != 0)) {
    __pyx_t_5 = __pyx_t_2;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  __pyx_v_qk = __pyx_t_5;

  /* "causalml/inference/tree/uplift.pyx":89
 *     qk = min(max(qk, eps), 1 - eps)
 * 
 *     if pk == 0.:             # <<<<<<<<<<<<<<
 *         S = -log(1 - qk)
 *     elif pk == 1.:
 */
  __pyx_t_1 = ((__pyx_v_pk == 0.) != 0);
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":90
 * 
 *     if pk == 0.:
 *         S = -log(1 - qk)             # <<<<<<<<<<<<<<
 *     elif pk == 1.:
 *         S = -log(qk)
 */
    __pyx_v_S = (-log((1.0 - __pyx_v_qk)));

    /* "causalml/inference/tree/uplift.pyx":89
 *     qk = min(max(qk, eps), 1 - eps)
 * 
 *     if pk == 0.:             # <<<<<<<<<<<<<<
 *         S = -log(1 - qk)
 *     elif pk == 1.:
 */
    goto __pyx_L4;
  }

  /* "causalml/inference/tree/uplift.pyx":91
 *     if pk == 0.:
 *         S = -log(1 - qk)
 *     elif pk == 1.:             # <<<<<<<<<<<<<<
 *         S = -log(qk)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_pk == 1.) != 0);
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":92
 *         S = -log(1 - qk)
 *     elif pk == 1.:
 *         S = -log(qk)             # <<<<<<<<<<<<<<
 *     else:
 *         S = pk * log(pk / qk) + (1 - pk) * log((1 - pk) / (1 - qk))
 */
    __pyx_v_S = (-log(__pyx_v_qk));

    /* "causalml/inference/tree/uplift.pyx":91
 *     if pk == 0.:
 *         S = -log(1 - qk)
 *     elif pk == 1.:             # <<<<<<<<<<<<<<
 *         S = -log(qk)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "causalml/inference/tree/uplift.pyx":94
 *         S = -log(qk)
 *     else:
 *         S = pk * log(pk / qk) + (1 - pk) * log((1 - pk) / (1 - qk))             # <<<<<<<<<<<<<<
 * 
 *     return S
 */
  /*else*/ {
    __pyx_v_S = ((__pyx_v_pk * log((__pyx_v_pk / __pyx_v_qk))) + ((1.0 - __pyx_v_pk) * log(((1.0 - __pyx_v_pk) / (1.0 - __pyx_v_qk)))));
  }
  __pyx_L4:;

  /* "causalml/inference/tree/uplift.pyx":96
 *         S = pk * log(pk / qk) + (1 - pk) * log((1 - pk) / (1 - qk))
 * 
 *     return S             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_S;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":62
 * 
 * @cython.cfunc
 * def kl_divergence(pk: cython.float, qk: cython.float) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Calculate KL Divergence for binary classification.
 */

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

/* "causalml/inference/tree/uplift.pyx":100
 * 
 * @cython.cfunc
 * def entropyH(p: cython.float, q: cython.float=-1.) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Entropy
 */

static float __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(float __pyx_v_p, struct __pyx_opt_args_8causalml_9inference_4tree_6uplift_entropyH *__pyx_optional_args) {
  float __pyx_v_q = __pyx_k_;
  float __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("entropyH", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_q = __pyx_optional_args->q;
    }
  }

  /* "causalml/inference/tree/uplift.pyx":119
 *     '''
 * 
 *     if q == -1. and p > 0.:             # <<<<<<<<<<<<<<
 *         return -p * log(p)
 *     elif q > 0.:
 */
  __pyx_t_2 = ((__pyx_v_q == -1.) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_p > 0.) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":120
 * 
 *     if q == -1. and p > 0.:
 *         return -p * log(p)             # <<<<<<<<<<<<<<
 *     elif q > 0.:
 *         return -p * log(q)
 */
    __pyx_r = ((-__pyx_v_p) * log(__pyx_v_p));
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":119
 *     '''
 * 
 *     if q == -1. and p > 0.:             # <<<<<<<<<<<<<<
 *         return -p * log(p)
 *     elif q > 0.:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":121
 *     if q == -1. and p > 0.:
 *         return -p * log(p)
 *     elif q > 0.:             # <<<<<<<<<<<<<<
 *         return -p * log(q)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_q > 0.) != 0);
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":122
 *         return -p * log(p)
 *     elif q > 0.:
 *         return -p * log(q)             # <<<<<<<<<<<<<<
 *     else:
 *         return 0.
 */
    __pyx_r = ((-__pyx_v_p) * log(__pyx_v_q));
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":121
 *     if q == -1. and p > 0.:
 *         return -p * log(p)
 *     elif q > 0.:             # <<<<<<<<<<<<<<
 *         return -p * log(q)
 *     else:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":124
 *         return -p * log(q)
 *     else:
 *         return 0.             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_r = 0.;
    goto __pyx_L0;
  }

  /* "causalml/inference/tree/uplift.pyx":100
 * 
 * @cython.cfunc
 * def entropyH(p: cython.float, q: cython.float=-1.) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Entropy
 */

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

/* "causalml/inference/tree/uplift.pyx":183
 *     """
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,             # <<<<<<<<<<<<<<
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_12DecisionTree_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_12DecisionTree_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_12DecisionTree_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_12DecisionTree_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_classes_ = 0;
  PyObject *__pyx_v_col = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_trueBranch = 0;
  PyObject *__pyx_v_falseBranch = 0;
  PyObject *__pyx_v_results = 0;
  PyObject *__pyx_v_summary = 0;
  PyObject *__pyx_v_maxDiffTreatment = 0;
  PyObject *__pyx_v_maxDiffSign = 0;
  PyObject *__pyx_v_nodeSummary = 0;
  PyObject *__pyx_v_backupResults = 0;
  PyObject *__pyx_v_bestTreatment = 0;
  PyObject *__pyx_v_upliftScore = 0;
  PyObject *__pyx_v_matchScore = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_classes,&__pyx_n_s_col,&__pyx_n_s_value,&__pyx_n_s_trueBranch,&__pyx_n_s_falseBranch,&__pyx_n_s_results,&__pyx_n_s_summary,&__pyx_n_s_maxDiffTreatment,&__pyx_n_s_maxDiffSign,&__pyx_n_s_nodeSummary,&__pyx_n_s_backupResults,&__pyx_n_s_bestTreatment,&__pyx_n_s_upliftScore,&__pyx_n_s_matchScore,0};
    PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)__pyx_int_neg_1));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    values[7] = ((PyObject *)((PyObject *)Py_None));

    /* "causalml/inference/tree/uplift.pyx":184
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,             # <<<<<<<<<<<<<<
 *                   upliftScore=None, matchScore=None):
 *         self.classes_ = classes_
 */
    values[8] = ((PyObject *)((PyObject *)Py_None));
    values[9] = ((PyObject *)((PyObject*)__pyx_float_1_));
    values[10] = ((PyObject *)((PyObject *)Py_None));
    values[11] = ((PyObject *)((PyObject *)Py_None));
    values[12] = ((PyObject *)((PyObject *)Py_None));

    /* "causalml/inference/tree/uplift.pyx":185
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):             # <<<<<<<<<<<<<<
 *         self.classes_ = classes_
 *         self.col = col
 */
    values[13] = ((PyObject *)((PyObject *)Py_None));
    values[14] = ((PyObject *)((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 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_classes)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 15, 1); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_col);
          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_value);
          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_trueBranch);
          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_falseBranch);
          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_results);
          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_summary);
          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_maxDiffTreatment);
          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_maxDiffSign);
          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_nodeSummary);
          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_backupResults);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bestTreatment);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_upliftScore);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_matchScore);
          if (value) { values[14] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 183, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_self = values[0];
    __pyx_v_classes_ = values[1];
    __pyx_v_col = values[2];
    __pyx_v_value = values[3];
    __pyx_v_trueBranch = values[4];
    __pyx_v_falseBranch = values[5];
    __pyx_v_results = values[6];
    __pyx_v_summary = values[7];
    __pyx_v_maxDiffTreatment = values[8];
    __pyx_v_maxDiffSign = values[9];
    __pyx_v_nodeSummary = values[10];
    __pyx_v_backupResults = values[11];
    __pyx_v_bestTreatment = values[12];
    __pyx_v_upliftScore = values[13];
    __pyx_v_matchScore = values[14];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.DecisionTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_12DecisionTree___init__(__pyx_self, __pyx_v_self, __pyx_v_classes_, __pyx_v_col, __pyx_v_value, __pyx_v_trueBranch, __pyx_v_falseBranch, __pyx_v_results, __pyx_v_summary, __pyx_v_maxDiffTreatment, __pyx_v_maxDiffSign, __pyx_v_nodeSummary, __pyx_v_backupResults, __pyx_v_bestTreatment, __pyx_v_upliftScore, __pyx_v_matchScore);

  /* "causalml/inference/tree/uplift.pyx":183
 *     """
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,             # <<<<<<<<<<<<<<
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 */

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_12DecisionTree___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_classes_, PyObject *__pyx_v_col, PyObject *__pyx_v_value, PyObject *__pyx_v_trueBranch, PyObject *__pyx_v_falseBranch, PyObject *__pyx_v_results, PyObject *__pyx_v_summary, PyObject *__pyx_v_maxDiffTreatment, PyObject *__pyx_v_maxDiffSign, PyObject *__pyx_v_nodeSummary, PyObject *__pyx_v_backupResults, PyObject *__pyx_v_bestTreatment, PyObject *__pyx_v_upliftScore, PyObject *__pyx_v_matchScore) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "causalml/inference/tree/uplift.pyx":186
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 *         self.classes_ = classes_             # <<<<<<<<<<<<<<
 *         self.col = col
 *         self.value = value
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_classes, __pyx_v_classes_) < 0) __PYX_ERR(0, 186, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":187
 *                   upliftScore=None, matchScore=None):
 *         self.classes_ = classes_
 *         self.col = col             # <<<<<<<<<<<<<<
 *         self.value = value
 *         self.trueBranch = trueBranch
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_col, __pyx_v_col) < 0) __PYX_ERR(0, 187, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":188
 *         self.classes_ = classes_
 *         self.col = col
 *         self.value = value             # <<<<<<<<<<<<<<
 *         self.trueBranch = trueBranch
 *         self.falseBranch = falseBranch
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_value) < 0) __PYX_ERR(0, 188, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":189
 *         self.col = col
 *         self.value = value
 *         self.trueBranch = trueBranch             # <<<<<<<<<<<<<<
 *         self.falseBranch = falseBranch
 *         self.results = results  # None for nodes, not None for leaves
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_trueBranch, __pyx_v_trueBranch) < 0) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":190
 *         self.value = value
 *         self.trueBranch = trueBranch
 *         self.falseBranch = falseBranch             # <<<<<<<<<<<<<<
 *         self.results = results  # None for nodes, not None for leaves
 *         self.summary = summary
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_falseBranch, __pyx_v_falseBranch) < 0) __PYX_ERR(0, 190, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":191
 *         self.trueBranch = trueBranch
 *         self.falseBranch = falseBranch
 *         self.results = results  # None for nodes, not None for leaves             # <<<<<<<<<<<<<<
 *         self.summary = summary
 *         # the treatment with max( |p(y|treatment) - p(y|control)| )
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_results, __pyx_v_results) < 0) __PYX_ERR(0, 191, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":192
 *         self.falseBranch = falseBranch
 *         self.results = results  # None for nodes, not None for leaves
 *         self.summary = summary             # <<<<<<<<<<<<<<
 *         # the treatment with max( |p(y|treatment) - p(y|control)| )
 *         self.maxDiffTreatment = maxDiffTreatment
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_summary, __pyx_v_summary) < 0) __PYX_ERR(0, 192, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":194
 *         self.summary = summary
 *         # the treatment with max( |p(y|treatment) - p(y|control)| )
 *         self.maxDiffTreatment = maxDiffTreatment             # <<<<<<<<<<<<<<
 *         # the sign for p(y|maxDiffTreatment) - p(y|control)
 *         self.maxDiffSign = maxDiffSign
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_maxDiffTreatment, __pyx_v_maxDiffTreatment) < 0) __PYX_ERR(0, 194, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":196
 *         self.maxDiffTreatment = maxDiffTreatment
 *         # the sign for p(y|maxDiffTreatment) - p(y|control)
 *         self.maxDiffSign = maxDiffSign             # <<<<<<<<<<<<<<
 *         self.nodeSummary = nodeSummary
 *         self.backupResults = backupResults
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_maxDiffSign, __pyx_v_maxDiffSign) < 0) __PYX_ERR(0, 196, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":197
 *         # the sign for p(y|maxDiffTreatment) - p(y|control)
 *         self.maxDiffSign = maxDiffSign
 *         self.nodeSummary = nodeSummary             # <<<<<<<<<<<<<<
 *         self.backupResults = backupResults
 *         self.bestTreatment = bestTreatment
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nodeSummary, __pyx_v_nodeSummary) < 0) __PYX_ERR(0, 197, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":198
 *         self.maxDiffSign = maxDiffSign
 *         self.nodeSummary = nodeSummary
 *         self.backupResults = backupResults             # <<<<<<<<<<<<<<
 *         self.bestTreatment = bestTreatment
 *         self.upliftScore = upliftScore
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_backupResults, __pyx_v_backupResults) < 0) __PYX_ERR(0, 198, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":199
 *         self.nodeSummary = nodeSummary
 *         self.backupResults = backupResults
 *         self.bestTreatment = bestTreatment             # <<<<<<<<<<<<<<
 *         self.upliftScore = upliftScore
 *         # match actual treatment for validation and testing
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bestTreatment, __pyx_v_bestTreatment) < 0) __PYX_ERR(0, 199, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":200
 *         self.backupResults = backupResults
 *         self.bestTreatment = bestTreatment
 *         self.upliftScore = upliftScore             # <<<<<<<<<<<<<<
 *         # match actual treatment for validation and testing
 *         self.matchScore = matchScore
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_upliftScore, __pyx_v_upliftScore) < 0) __PYX_ERR(0, 200, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":202
 *         self.upliftScore = upliftScore
 *         # match actual treatment for validation and testing
 *         self.matchScore = matchScore             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_matchScore, __pyx_v_matchScore) < 0) __PYX_ERR(0, 202, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":183
 *     """
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,             # <<<<<<<<<<<<<<
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.DecisionTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":205
 * 
 * 
 * def group_uniqueCounts_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                               np.ndarray[Y_TYPE_t, ndim=1] y,
 *                               np.ndarray[N_TYPE_t, ndim=1] out_arr):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_1group_uniqueCounts_to_arr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_group_uniqueCounts_to_arr[] = "\n        Count sample size by experiment group.\n\n        Args\n        ----\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n            Should be of type numpy.int8\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n            Should be of type numpy.int8\n        out_arr : array-like, shape = [2 * n_class]\n            An array to store the output counts, should have type numpy.int32\n\n    Returns\n    -------\n\n    No return value, but modified the out_arr to hold the negative and positive\n    outcome sample sizes for each of the control and treatment groups.\n        out_arr[2*i] is N(Y = 0, T = i) for i = 0, ..., n_class\n        out_arr[2*i+1] is N(Y = 1, T = i) for i = 0, ..., n_class\n    ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_1group_uniqueCounts_to_arr = {"group_uniqueCounts_to_arr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_1group_uniqueCounts_to_arr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_group_uniqueCounts_to_arr};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_1group_uniqueCounts_to_arr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_treatment_idx = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out_arr = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_uniqueCounts_to_arr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_out_arr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 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_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_uniqueCounts_to_arr", 1, 3, 3, 1); __PYX_ERR(0, 205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_arr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_uniqueCounts_to_arr", 1, 3, 3, 2); __PYX_ERR(0, 205, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_uniqueCounts_to_arr") < 0)) __PYX_ERR(0, 205, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_treatment_idx = ((PyArrayObject *)values[0]);
    __pyx_v_y = ((PyArrayObject *)values[1]);
    __pyx_v_out_arr = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_uniqueCounts_to_arr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 205, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.group_uniqueCounts_to_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_treatment_idx), __pyx_ptype_5numpy_ndarray, 1, "treatment_idx", 0))) __PYX_ERR(0, 205, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) __PYX_ERR(0, 206, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_arr), __pyx_ptype_5numpy_ndarray, 1, "out_arr", 0))) __PYX_ERR(0, 207, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_group_uniqueCounts_to_arr(__pyx_self, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_out_arr);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_group_uniqueCounts_to_arr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_arr) {
  int __pyx_v_out_arr_len;
  int __pyx_v_n_class;
  int __pyx_v_num_samples;
  CYTHON_UNUSED int __pyx_v_yv;
  int __pyx_v_tv;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_arr;
  __Pyx_Buffer __pyx_pybuffer_out_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_treatment_idx;
  __Pyx_Buffer __pyx_pybuffer_treatment_idx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_uniqueCounts_to_arr", 0);
  __pyx_pybuffer_treatment_idx.pybuffer.buf = NULL;
  __pyx_pybuffer_treatment_idx.refcount = 0;
  __pyx_pybuffernd_treatment_idx.data = NULL;
  __pyx_pybuffernd_treatment_idx.rcbuffer = &__pyx_pybuffer_treatment_idx;
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_out_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_out_arr.refcount = 0;
  __pyx_pybuffernd_out_arr.data = NULL;
  __pyx_pybuffernd_out_arr.rcbuffer = &__pyx_pybuffer_out_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_treatment_idx, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 205, __pyx_L1_error)
  }
  __pyx_pybuffernd_treatment_idx.diminfo[0].strides = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_treatment_idx.diminfo[0].shape = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 205, __pyx_L1_error)
  }
  __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 205, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_arr.diminfo[0].strides = __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_arr.diminfo[0].shape = __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":230
 *         out_arr[2*i+1] is N(Y = 1, T = i) for i = 0, ..., n_class
 *     '''
 *     cdef int out_arr_len = out_arr.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]
 */
  __pyx_v_out_arr_len = (__pyx_v_out_arr->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":231
 *     '''
 *     cdef int out_arr_len = out_arr.shape[0]
 *     cdef int n_class = out_arr_len / 2             # <<<<<<<<<<<<<<
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0
 */
  __pyx_v_n_class = (((long)__pyx_v_out_arr_len) / 2);

  /* "causalml/inference/tree/uplift.pyx":232
 *     cdef int out_arr_len = out_arr.shape[0]
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int yv = 0
 *     cdef int tv = 0
 */
  __pyx_v_num_samples = (__pyx_v_treatment_idx->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":233
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0             # <<<<<<<<<<<<<<
 *     cdef int tv = 0
 *     cdef int i = 0
 */
  __pyx_v_yv = 0;

  /* "causalml/inference/tree/uplift.pyx":234
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0
 *     cdef int tv = 0             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     # first clear the output
 */
  __pyx_v_tv = 0;

  /* "causalml/inference/tree/uplift.pyx":235
 *     cdef int yv = 0
 *     cdef int tv = 0
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     # first clear the output
 *     for i in range(out_arr_len):
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":237
 *     cdef int i = 0
 *     # first clear the output
 *     for i in range(out_arr_len):             # <<<<<<<<<<<<<<
 *         out_arr[i] = 0
 *     # then loop through treatment_idx and y, sum the counts
 */
  __pyx_t_1 = __pyx_v_out_arr_len;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":238
 *     # first clear the output
 *     for i in range(out_arr_len):
 *         out_arr[i] = 0             # <<<<<<<<<<<<<<
 *     # then loop through treatment_idx and y, sum the counts
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 */
    __pyx_t_4 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides) = 0;
  }

  /* "causalml/inference/tree/uplift.pyx":241
 *     # then loop through treatment_idx and y, sum the counts
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 *     for i in range(num_samples):             # <<<<<<<<<<<<<<
 *         tv = treatment_idx[i]
 *         # assume treatment index is in range
 */
  __pyx_t_1 = __pyx_v_num_samples;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":242
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 *     for i in range(num_samples):
 *         tv = treatment_idx[i]             # <<<<<<<<<<<<<<
 *         # assume treatment index is in range
 *         out_arr[2*tv] += 1
 */
    __pyx_t_4 = __pyx_v_i;
    __pyx_v_tv = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t *, __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_treatment_idx.diminfo[0].strides));

    /* "causalml/inference/tree/uplift.pyx":244
 *         tv = treatment_idx[i]
 *         # assume treatment index is in range
 *         out_arr[2*tv] += 1             # <<<<<<<<<<<<<<
 *         # assume y should be either 0 or 1, so this is summing
 *         out_arr[2*tv + 1] += y[i]
 */
    __pyx_t_4 = (2 * __pyx_v_tv);
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides) += 1;

    /* "causalml/inference/tree/uplift.pyx":246
 *         out_arr[2*tv] += 1
 *         # assume y should be either 0 or 1, so this is summing
 *         out_arr[2*tv + 1] += y[i]             # <<<<<<<<<<<<<<
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):
 */
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = ((2 * __pyx_v_tv) + 1);
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_out_arr.diminfo[0].strides) += (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_y.diminfo[0].strides));
  }

  /* "causalml/inference/tree/uplift.pyx":248
 *         out_arr[2*tv + 1] += y[i]
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):             # <<<<<<<<<<<<<<
 *         out_arr[2*i] -= out_arr[2*i + 1]
 *     # done, modified out_arr, so no need to return it
 */
  __pyx_t_1 = __pyx_v_n_class;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":249
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):
 *         out_arr[2*i] -= out_arr[2*i + 1]             # <<<<<<<<<<<<<<
 *     # done, modified out_arr, so no need to return it
 * 
 */
    __pyx_t_4 = ((2 * __pyx_v_i) + 1);
    __pyx_t_5 = (2 * __pyx_v_i);
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_out_arr.diminfo[0].strides) -= (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides));
  }

  /* "causalml/inference/tree/uplift.pyx":205
 * 
 * 
 * def group_uniqueCounts_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                               np.ndarray[Y_TYPE_t, ndim=1] y,
 *                               np.ndarray[N_TYPE_t, ndim=1] out_arr):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.group_uniqueCounts_to_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":252
 *     # done, modified out_arr, so no need to return it
 * 
 * def group_counts_by_divide(             # <<<<<<<<<<<<<<
 *         col_vals, threshold_val, is_split_by_gt,
 *         np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_3group_counts_by_divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_2group_counts_by_divide[] = "\n    Count sample size by experiment group for the left branch,\n    after splitting col_vals by threshold_val.\n    If is_split_by_gt, the left branch is (col_vals >= threshold_val),\n    otherwise the left branch is (col_vals == threshold_val).\n\n    This aims to combine the previous divideSet_len and\n    group_uniqueCounts_to_arr into one function, so as to reduce the\n    number of intermediate objects.\n\n    Args\n    ----\n    col_vals : array-like, shape = [num_samples]\n        An array containing one column of x values.\n    threshold_val : compatible value with col_vals\n        A value for splitting col_vals.\n        If is_split_by_gt, the left branch is (col_vals >= threshold_val),\n        otherwise the left branch is (col_vals == threshold_val).\n    is_split_by_gt : bool\n        Whether to split by (col_vals >= threshold_val).\n        If False, will split by (col_vals == threshold_val).\n    treatment_idx : array-like, shape = [num_samples]\n        An array containing the treatment group index for each unit.\n        Should be of type numpy.int8\n    y : array-like, shape = [num_samples]\n        An array containing the outcome of interest for each unit.\n        Should be of type numpy.int8\n    out_arr : array-like, shape = [2 * n_class]\n        An array to store the output counts, should have type numpy.int32\n\n    Returns\n    -------\n    len_X_l: the number of samples in the left branch.\n    Also modify the out_arr to hold the negative and positive\n    outcome sample sizes for each of the control and treatment groups.\n        out_arr[2*i] is N(Y = 0, T = i) for i = 0, ..., n_class\n        out_arr[2*i+1] is N(Y = 1, T = i) for i = 0, ..., n_class\n    ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_3group_counts_by_divide = {"group_counts_by_divide", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_3group_counts_by_divide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_2group_counts_by_divide};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_3group_counts_by_divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_col_vals = 0;
  PyObject *__pyx_v_threshold_val = 0;
  PyObject *__pyx_v_is_split_by_gt = 0;
  PyArrayObject *__pyx_v_treatment_idx = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out_arr = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_counts_by_divide (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_col_vals,&__pyx_n_s_threshold_val,&__pyx_n_s_is_split_by_gt,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_out_arr,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_col_vals)) != 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_threshold_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, 1); __PYX_ERR(0, 252, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_split_by_gt)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, 2); __PYX_ERR(0, 252, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, 3); __PYX_ERR(0, 252, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, 4); __PYX_ERR(0, 252, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_arr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, 5); __PYX_ERR(0, 252, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_counts_by_divide") < 0)) __PYX_ERR(0, 252, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_col_vals = values[0];
    __pyx_v_threshold_val = values[1];
    __pyx_v_is_split_by_gt = values[2];
    __pyx_v_treatment_idx = ((PyArrayObject *)values[3]);
    __pyx_v_y = ((PyArrayObject *)values[4]);
    __pyx_v_out_arr = ((PyArrayObject *)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_counts_by_divide", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 252, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.group_counts_by_divide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_treatment_idx), __pyx_ptype_5numpy_ndarray, 1, "treatment_idx", 0))) __PYX_ERR(0, 254, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) __PYX_ERR(0, 255, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_arr), __pyx_ptype_5numpy_ndarray, 1, "out_arr", 0))) __PYX_ERR(0, 256, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_2group_counts_by_divide(__pyx_self, __pyx_v_col_vals, __pyx_v_threshold_val, __pyx_v_is_split_by_gt, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_out_arr);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_2group_counts_by_divide(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_col_vals, PyObject *__pyx_v_threshold_val, PyObject *__pyx_v_is_split_by_gt, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_arr) {
  int __pyx_v_out_arr_len;
  int __pyx_v_n_class;
  int __pyx_v_num_samples;
  CYTHON_UNUSED int __pyx_v_yv;
  int __pyx_v_tv;
  int __pyx_v_i;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_len_X_l;
  PyArrayObject *__pyx_v_filt = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_filt;
  __Pyx_Buffer __pyx_pybuffer_filt;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_arr;
  __Pyx_Buffer __pyx_pybuffer_out_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_treatment_idx;
  __Pyx_Buffer __pyx_pybuffer_treatment_idx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_counts_by_divide", 0);
  __pyx_pybuffer_filt.pybuffer.buf = NULL;
  __pyx_pybuffer_filt.refcount = 0;
  __pyx_pybuffernd_filt.data = NULL;
  __pyx_pybuffernd_filt.rcbuffer = &__pyx_pybuffer_filt;
  __pyx_pybuffer_treatment_idx.pybuffer.buf = NULL;
  __pyx_pybuffer_treatment_idx.refcount = 0;
  __pyx_pybuffernd_treatment_idx.data = NULL;
  __pyx_pybuffernd_treatment_idx.rcbuffer = &__pyx_pybuffer_treatment_idx;
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_out_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_out_arr.refcount = 0;
  __pyx_pybuffernd_out_arr.data = NULL;
  __pyx_pybuffernd_out_arr.rcbuffer = &__pyx_pybuffer_out_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_treatment_idx, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 252, __pyx_L1_error)
  }
  __pyx_pybuffernd_treatment_idx.diminfo[0].strides = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_treatment_idx.diminfo[0].shape = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 252, __pyx_L1_error)
  }
  __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 252, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_arr.diminfo[0].strides = __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_arr.diminfo[0].shape = __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":295
 *         out_arr[2*i+1] is N(Y = 1, T = i) for i = 0, ..., n_class
 *     '''
 *     cdef int out_arr_len = out_arr.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]
 */
  __pyx_v_out_arr_len = (__pyx_v_out_arr->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":296
 *     '''
 *     cdef int out_arr_len = out_arr.shape[0]
 *     cdef int n_class = out_arr_len / 2             # <<<<<<<<<<<<<<
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0
 */
  __pyx_v_n_class = (((long)__pyx_v_out_arr_len) / 2);

  /* "causalml/inference/tree/uplift.pyx":297
 *     cdef int out_arr_len = out_arr.shape[0]
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int yv = 0
 *     cdef int tv = 0
 */
  __pyx_v_num_samples = (__pyx_v_treatment_idx->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":298
 *     cdef int n_class = out_arr_len / 2
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0             # <<<<<<<<<<<<<<
 *     cdef int tv = 0
 *     cdef int i = 0
 */
  __pyx_v_yv = 0;

  /* "causalml/inference/tree/uplift.pyx":299
 *     cdef int num_samples = treatment_idx.shape[0]
 *     cdef int yv = 0
 *     cdef int tv = 0             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     cdef N_TYPE_t len_X_l = 0
 */
  __pyx_v_tv = 0;

  /* "causalml/inference/tree/uplift.pyx":300
 *     cdef int yv = 0
 *     cdef int tv = 0
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     cdef N_TYPE_t len_X_l = 0
 *     cdef np.ndarray[np.uint8_t, ndim=1, cast=True] filt
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":301
 *     cdef int tv = 0
 *     cdef int i = 0
 *     cdef N_TYPE_t len_X_l = 0             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.uint8_t, ndim=1, cast=True] filt
 *     # first clear the output
 */
  __pyx_v_len_X_l = 0;

  /* "causalml/inference/tree/uplift.pyx":304
 *     cdef np.ndarray[np.uint8_t, ndim=1, cast=True] filt
 *     # first clear the output
 *     for i in range(out_arr_len):             # <<<<<<<<<<<<<<
 *         out_arr[i] = 0
 * 
 */
  __pyx_t_1 = __pyx_v_out_arr_len;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":305
 *     # first clear the output
 *     for i in range(out_arr_len):
 *         out_arr[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     # split
 */
    __pyx_t_4 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides) = 0;
  }

  /* "causalml/inference/tree/uplift.pyx":308
 * 
 *     # split
 *     if is_split_by_gt:             # <<<<<<<<<<<<<<
 *         filt = col_vals >= threshold_val
 *     else:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_is_split_by_gt); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 308, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "causalml/inference/tree/uplift.pyx":309
 *     # split
 *     if is_split_by_gt:
 *         filt = col_vals >= threshold_val             # <<<<<<<<<<<<<<
 *     else:
 *         filt = col_vals == threshold_val
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_col_vals, __pyx_v_threshold_val, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 309, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 309, __pyx_L1_error)
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filt.rcbuffer->pybuffer);
      __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_filt.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack);
      if (unlikely(__pyx_t_1 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_filt.rcbuffer->pybuffer, (PyObject*)__pyx_v_filt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_filt.diminfo[0].strides = __pyx_pybuffernd_filt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_filt.diminfo[0].shape = __pyx_pybuffernd_filt.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 309, __pyx_L1_error)
    }
    __pyx_t_7 = 0;
    __pyx_v_filt = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":308
 * 
 *     # split
 *     if is_split_by_gt:             # <<<<<<<<<<<<<<
 *         filt = col_vals >= threshold_val
 *     else:
 */
    goto __pyx_L5;
  }

  /* "causalml/inference/tree/uplift.pyx":311
 *         filt = col_vals >= threshold_val
 *     else:
 *         filt = col_vals == threshold_val             # <<<<<<<<<<<<<<
 * 
 *     # then loop through treatment_idx and y, sum the counts where filt
 */
  /*else*/ {
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_col_vals, __pyx_v_threshold_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 311, __pyx_L1_error)
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filt.rcbuffer->pybuffer);
      __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_filt.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack);
      if (unlikely(__pyx_t_1 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_filt.rcbuffer->pybuffer, (PyObject*)__pyx_v_filt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_filt.diminfo[0].strides = __pyx_pybuffernd_filt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_filt.diminfo[0].shape = __pyx_pybuffernd_filt.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 311, __pyx_L1_error)
    }
    __pyx_t_7 = 0;
    __pyx_v_filt = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
  }
  __pyx_L5:;

  /* "causalml/inference/tree/uplift.pyx":318
 * 
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 *     for i in range(num_samples):             # <<<<<<<<<<<<<<
 *         if filt[i]> 0:
 *             len_X_l += 1
 */
  __pyx_t_1 = __pyx_v_num_samples;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":319
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 *     for i in range(num_samples):
 *         if filt[i]> 0:             # <<<<<<<<<<<<<<
 *             len_X_l += 1
 *             tv = treatment_idx[i]
 */
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_filt.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_filt.diminfo[0].strides)) > 0) != 0);
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":320
 *     for i in range(num_samples):
 *         if filt[i]> 0:
 *             len_X_l += 1             # <<<<<<<<<<<<<<
 *             tv = treatment_idx[i]
 *             # assume treatment index is in range
 */
      __pyx_v_len_X_l = (__pyx_v_len_X_l + 1);

      /* "causalml/inference/tree/uplift.pyx":321
 *         if filt[i]> 0:
 *             len_X_l += 1
 *             tv = treatment_idx[i]             # <<<<<<<<<<<<<<
 *             # assume treatment index is in range
 *             out_arr[2*tv] += 1
 */
      __pyx_t_4 = __pyx_v_i;
      __pyx_v_tv = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t *, __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_treatment_idx.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":323
 *             tv = treatment_idx[i]
 *             # assume treatment index is in range
 *             out_arr[2*tv] += 1             # <<<<<<<<<<<<<<
 *             # assume y should be either 0 or 1, so this is summing
 *             out_arr[2*tv + 1] += y[i]
 */
      __pyx_t_4 = (2 * __pyx_v_tv);
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides) += 1;

      /* "causalml/inference/tree/uplift.pyx":325
 *             out_arr[2*tv] += 1
 *             # assume y should be either 0 or 1, so this is summing
 *             out_arr[2*tv + 1] += y[i]             # <<<<<<<<<<<<<<
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):
 */
      __pyx_t_4 = __pyx_v_i;
      __pyx_t_11 = ((2 * __pyx_v_tv) + 1);
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_out_arr.diminfo[0].strides) += (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_y.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":319
 *     # first sum as N(T = i) and N(Y = 1, T = i) at index (2*i, 2*i+1), and later adjust
 *     for i in range(num_samples):
 *         if filt[i]> 0:             # <<<<<<<<<<<<<<
 *             len_X_l += 1
 *             tv = treatment_idx[i]
 */
    }
  }

  /* "causalml/inference/tree/uplift.pyx":327
 *             out_arr[2*tv + 1] += y[i]
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):             # <<<<<<<<<<<<<<
 *         out_arr[2*i] -= out_arr[2*i + 1]
 *     # done, modified out_arr
 */
  __pyx_t_1 = __pyx_v_n_class;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "causalml/inference/tree/uplift.pyx":328
 *     # adjust the entry at index 2*i to be N(Y = 0, T = i) = N(T = i) - N(Y = 1, T = i)
 *     for i in range(n_class):
 *         out_arr[2*i] -= out_arr[2*i + 1]             # <<<<<<<<<<<<<<
 *     # done, modified out_arr
 *     return len_X_l
 */
    __pyx_t_4 = ((2 * __pyx_v_i) + 1);
    __pyx_t_11 = (2 * __pyx_v_i);
    *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_out_arr.diminfo[0].strides) -= (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_arr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_out_arr.diminfo[0].strides));
  }

  /* "causalml/inference/tree/uplift.pyx":330
 *         out_arr[2*i] -= out_arr[2*i + 1]
 *     # done, modified out_arr
 *     return len_X_l             # <<<<<<<<<<<<<<
 * 
 * # Uplift Tree Classifier
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyInt_From_npy_int32(__pyx_v_len_X_l); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":252
 *     # done, modified out_arr, so no need to return it
 * 
 * def group_counts_by_divide(             # <<<<<<<<<<<<<<
 *         col_vals, threshold_val, is_split_by_gt,
 *         np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filt.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.group_counts_by_divide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filt.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_filt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":385
 * 
 *     """
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,             # <<<<<<<<<<<<<<
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_control_name = 0;
  PyObject *__pyx_v_max_features = 0;
  PyObject *__pyx_v_max_depth = 0;
  PyObject *__pyx_v_min_samples_leaf = 0;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  PyObject *__pyx_v_early_stopping_eval_diff_scale = 0;
  PyObject *__pyx_v_evaluationFunction = 0;
  PyObject *__pyx_v_normalization = 0;
  PyObject *__pyx_v_honesty = 0;
  PyObject *__pyx_v_estimation_sample_size = 0;
  PyObject *__pyx_v_random_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_control_name,&__pyx_n_s_max_features,&__pyx_n_s_max_depth,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,&__pyx_n_s_early_stopping_eval_diff_scale,&__pyx_n_s_evaluationFunction,&__pyx_n_s_normalization,&__pyx_n_s_honesty,&__pyx_n_s_estimation_sample_size,&__pyx_n_s_random_state,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)__pyx_int_3));
    values[4] = ((PyObject *)((PyObject *)__pyx_int_100));
    values[5] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[6] = ((PyObject *)((PyObject *)__pyx_int_100));
    values[7] = ((PyObject *)((PyObject *)__pyx_int_1));
    values[8] = ((PyObject *)((PyObject*)__pyx_n_u_KL));

    /* "causalml/inference/tree/uplift.pyx":387
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):             # <<<<<<<<<<<<<<
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf
 */
    values[9] = ((PyObject *)((PyObject *)Py_True));
    values[10] = ((PyObject *)((PyObject *)Py_False));
    values[11] = ((PyObject *)((PyObject*)__pyx_float_0_5));
    values[12] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_control_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 13, 1); __PYX_ERR(0, 385, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_features);
          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_max_depth);
          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_min_samples_leaf);
          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_min_samples_treatment);
          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_n_reg);
          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_early_stopping_eval_diff_scale);
          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_evaluationFunction);
          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_normalization);
          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_honesty);
          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_estimation_sample_size);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 385, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_control_name = values[1];
    __pyx_v_max_features = values[2];
    __pyx_v_max_depth = values[3];
    __pyx_v_min_samples_leaf = values[4];
    __pyx_v_min_samples_treatment = values[5];
    __pyx_v_n_reg = values[6];
    __pyx_v_early_stopping_eval_diff_scale = values[7];
    __pyx_v_evaluationFunction = values[8];
    __pyx_v_normalization = values[9];
    __pyx_v_honesty = values[10];
    __pyx_v_estimation_sample_size = values[11];
    __pyx_v_random_state = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 385, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier___init__(__pyx_self, __pyx_v_self, __pyx_v_control_name, __pyx_v_max_features, __pyx_v_max_depth, __pyx_v_min_samples_leaf, __pyx_v_min_samples_treatment, __pyx_v_n_reg, __pyx_v_early_stopping_eval_diff_scale, __pyx_v_evaluationFunction, __pyx_v_normalization, __pyx_v_honesty, __pyx_v_estimation_sample_size, __pyx_v_random_state);

  /* "causalml/inference/tree/uplift.pyx":385
 * 
 *     """
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,             # <<<<<<<<<<<<<<
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 */

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_name, PyObject *__pyx_v_max_features, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_evaluationFunction, PyObject *__pyx_v_normalization, PyObject *__pyx_v_honesty, PyObject *__pyx_v_estimation_sample_size, PyObject *__pyx_v_random_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __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("__init__", 0);

  /* "causalml/inference/tree/uplift.pyx":388
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 *         self.max_depth = max_depth             # <<<<<<<<<<<<<<
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_depth, __pyx_v_max_depth) < 0) __PYX_ERR(0, 388, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":389
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf             # <<<<<<<<<<<<<<
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_leaf, __pyx_v_min_samples_leaf) < 0) __PYX_ERR(0, 389, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":390
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment             # <<<<<<<<<<<<<<
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment, __pyx_v_min_samples_treatment) < 0) __PYX_ERR(0, 390, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":391
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg             # <<<<<<<<<<<<<<
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 *         self.max_features = max_features
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 391, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":392
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale             # <<<<<<<<<<<<<<
 *         self.max_features = max_features
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_v_early_stopping_eval_diff_scale) < 0) __PYX_ERR(0, 392, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":393
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 *         self.max_features = max_features             # <<<<<<<<<<<<<<
 * 
 *         assert evaluationFunction in ['KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', 'IDDP'], \
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_features, __pyx_v_max_features) < 0) __PYX_ERR(0, 393, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":395
 *         self.max_features = max_features
 * 
 *         assert evaluationFunction in ['KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', 'IDDP'], \             # <<<<<<<<<<<<<<
 *             f"evaluationFunction should be either 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', or 'IDDP' but {evaluationFunction} is passed"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_INCREF(__pyx_v_evaluationFunction);
    __pyx_t_1 = __pyx_v_evaluationFunction;
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_KL, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_ED, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_Chi, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_CTS, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_DDP, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_IT, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_CIT, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_IDDP, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_3;
    __pyx_L3_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!(__pyx_t_2 != 0))) {

      /* "causalml/inference/tree/uplift.pyx":396
 * 
 *         assert evaluationFunction in ['KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', 'IDDP'], \
 *             f"evaluationFunction should be either 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', or 'IDDP' but {evaluationFunction} is passed"             # <<<<<<<<<<<<<<
 * 
 *         if evaluationFunction == 'KL':
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_evaluationFunction_should_be_eit);
      __pyx_t_4 += 96;
      __Pyx_GIVEREF(__pyx_kp_u_evaluationFunction_should_be_eit);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_evaluationFunction_should_be_eit);
      __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_evaluationFunction, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_kp_u_is_passed);
      __pyx_t_4 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_is_passed);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_is_passed);
      __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 395, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":398
 *             f"evaluationFunction should be either 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', or 'IDDP' but {evaluationFunction} is passed"
 * 
 *         if evaluationFunction == 'KL':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_KL
 *             self.arr_eval_func = self.arr_evaluate_KL
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_KL, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 398, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":399
 * 
 *         if evaluationFunction == 'KL':
 *             self.evaluationFunction = self.evaluate_KL             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_KL
 *         elif evaluationFunction == 'ED':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_KL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":400
 *         if evaluationFunction == 'KL':
 *             self.evaluationFunction = self.evaluate_KL
 *             self.arr_eval_func = self.arr_evaluate_KL             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'ED':
 *             self.evaluationFunction = self.evaluate_ED
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_KL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 400, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":398
 *             f"evaluationFunction should be either 'KL', 'ED', 'Chi', 'CTS', 'DDP', 'IT', 'CIT', or 'IDDP' but {evaluationFunction} is passed"
 * 
 *         if evaluationFunction == 'KL':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_KL
 *             self.arr_eval_func = self.arr_evaluate_KL
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":401
 *             self.evaluationFunction = self.evaluate_KL
 *             self.arr_eval_func = self.arr_evaluate_KL
 *         elif evaluationFunction == 'ED':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_ED
 *             self.arr_eval_func = self.arr_evaluate_ED
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_ED, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 401, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":402
 *             self.arr_eval_func = self.arr_evaluate_KL
 *         elif evaluationFunction == 'ED':
 *             self.evaluationFunction = self.evaluate_ED             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_ED
 *         elif evaluationFunction == 'Chi':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_ED); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 402, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":403
 *         elif evaluationFunction == 'ED':
 *             self.evaluationFunction = self.evaluate_ED
 *             self.arr_eval_func = self.arr_evaluate_ED             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'Chi':
 *             self.evaluationFunction = self.evaluate_Chi
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_ED); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 403, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":401
 *             self.evaluationFunction = self.evaluate_KL
 *             self.arr_eval_func = self.arr_evaluate_KL
 *         elif evaluationFunction == 'ED':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_ED
 *             self.arr_eval_func = self.arr_evaluate_ED
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":404
 *             self.evaluationFunction = self.evaluate_ED
 *             self.arr_eval_func = self.arr_evaluate_ED
 *         elif evaluationFunction == 'Chi':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_Chi
 *             self.arr_eval_func = self.arr_evaluate_Chi
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_Chi, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 404, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":405
 *             self.arr_eval_func = self.arr_evaluate_ED
 *         elif evaluationFunction == 'Chi':
 *             self.evaluationFunction = self.evaluate_Chi             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_Chi
 *         elif evaluationFunction == 'DDP':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_Chi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":406
 *         elif evaluationFunction == 'Chi':
 *             self.evaluationFunction = self.evaluate_Chi
 *             self.arr_eval_func = self.arr_evaluate_Chi             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'DDP':
 *             self.evaluationFunction = self.evaluate_DDP
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_Chi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":404
 *             self.evaluationFunction = self.evaluate_ED
 *             self.arr_eval_func = self.arr_evaluate_ED
 *         elif evaluationFunction == 'Chi':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_Chi
 *             self.arr_eval_func = self.arr_evaluate_Chi
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":407
 *             self.evaluationFunction = self.evaluate_Chi
 *             self.arr_eval_func = self.arr_evaluate_Chi
 *         elif evaluationFunction == 'DDP':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_DDP
 *             self.arr_eval_func = self.arr_evaluate_DDP
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_DDP, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 407, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":408
 *             self.arr_eval_func = self.arr_evaluate_Chi
 *         elif evaluationFunction == 'DDP':
 *             self.evaluationFunction = self.evaluate_DDP             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_DDP
 *         elif evaluationFunction == 'IT':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_DDP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":409
 *         elif evaluationFunction == 'DDP':
 *             self.evaluationFunction = self.evaluate_DDP
 *             self.arr_eval_func = self.arr_evaluate_DDP             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'IT':
 *             self.evaluationFunction = self.evaluate_IT
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_DDP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":407
 *             self.evaluationFunction = self.evaluate_Chi
 *             self.arr_eval_func = self.arr_evaluate_Chi
 *         elif evaluationFunction == 'DDP':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_DDP
 *             self.arr_eval_func = self.arr_evaluate_DDP
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":410
 *             self.evaluationFunction = self.evaluate_DDP
 *             self.arr_eval_func = self.arr_evaluate_DDP
 *         elif evaluationFunction == 'IT':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_IT
 *             self.arr_eval_func = self.arr_evaluate_IT
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_IT, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 410, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":411
 *             self.arr_eval_func = self.arr_evaluate_DDP
 *         elif evaluationFunction == 'IT':
 *             self.evaluationFunction = self.evaluate_IT             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_IT
 *         elif evaluationFunction == 'CIT':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":412
 *         elif evaluationFunction == 'IT':
 *             self.evaluationFunction = self.evaluate_IT
 *             self.arr_eval_func = self.arr_evaluate_IT             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'CIT':
 *             self.evaluationFunction = self.evaluate_CIT
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_IT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":410
 *             self.evaluationFunction = self.evaluate_DDP
 *             self.arr_eval_func = self.arr_evaluate_DDP
 *         elif evaluationFunction == 'IT':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_IT
 *             self.arr_eval_func = self.arr_evaluate_IT
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":413
 *             self.evaluationFunction = self.evaluate_IT
 *             self.arr_eval_func = self.arr_evaluate_IT
 *         elif evaluationFunction == 'CIT':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_CIT
 *             self.arr_eval_func = self.arr_evaluate_CIT
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_CIT, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 413, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":414
 *             self.arr_eval_func = self.arr_evaluate_IT
 *         elif evaluationFunction == 'CIT':
 *             self.evaluationFunction = self.evaluate_CIT             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_CIT
 *         elif evaluationFunction == 'IDDP':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_CIT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":415
 *         elif evaluationFunction == 'CIT':
 *             self.evaluationFunction = self.evaluate_CIT
 *             self.arr_eval_func = self.arr_evaluate_CIT             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'IDDP':
 *             self.evaluationFunction = self.evaluate_IDDP
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_CIT); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 415, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":413
 *             self.evaluationFunction = self.evaluate_IT
 *             self.arr_eval_func = self.arr_evaluate_IT
 *         elif evaluationFunction == 'CIT':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_CIT
 *             self.arr_eval_func = self.arr_evaluate_CIT
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":416
 *             self.evaluationFunction = self.evaluate_CIT
 *             self.arr_eval_func = self.arr_evaluate_CIT
 *         elif evaluationFunction == 'IDDP':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_IDDP
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_IDDP, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 416, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":417
 *             self.arr_eval_func = self.arr_evaluate_CIT
 *         elif evaluationFunction == 'IDDP':
 *             self.evaluationFunction = self.evaluate_IDDP             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 *         elif evaluationFunction == 'CTS':
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IDDP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":418
 *         elif evaluationFunction == 'IDDP':
 *             self.evaluationFunction = self.evaluate_IDDP
 *             self.arr_eval_func = self.arr_evaluate_IDDP             # <<<<<<<<<<<<<<
 *         elif evaluationFunction == 'CTS':
 *             self.evaluationFunction = self.evaluate_CTS
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_IDDP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 418, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":416
 *             self.evaluationFunction = self.evaluate_CIT
 *             self.arr_eval_func = self.arr_evaluate_CIT
 *         elif evaluationFunction == 'IDDP':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_IDDP
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 */
    goto __pyx_L11;
  }

  /* "causalml/inference/tree/uplift.pyx":419
 *             self.evaluationFunction = self.evaluate_IDDP
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 *         elif evaluationFunction == 'CTS':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_CTS
 *             self.arr_eval_func = self.arr_evaluate_CTS
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_CTS, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 419, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":420
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 *         elif evaluationFunction == 'CTS':
 *             self.evaluationFunction = self.evaluate_CTS             # <<<<<<<<<<<<<<
 *             self.arr_eval_func = self.arr_evaluate_CTS
 *         self.fitted_uplift_tree = None
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_CTS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_t_6) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":421
 *         elif evaluationFunction == 'CTS':
 *             self.evaluationFunction = self.evaluate_CTS
 *             self.arr_eval_func = self.arr_evaluate_CTS             # <<<<<<<<<<<<<<
 *         self.fitted_uplift_tree = None
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_CTS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func, __pyx_t_6) < 0) __PYX_ERR(0, 421, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":419
 *             self.evaluationFunction = self.evaluate_IDDP
 *             self.arr_eval_func = self.arr_evaluate_IDDP
 *         elif evaluationFunction == 'CTS':             # <<<<<<<<<<<<<<
 *             self.evaluationFunction = self.evaluate_CTS
 *             self.arr_eval_func = self.arr_evaluate_CTS
 */
  }
  __pyx_L11:;

  /* "causalml/inference/tree/uplift.pyx":422
 *             self.evaluationFunction = self.evaluate_CTS
 *             self.arr_eval_func = self.arr_evaluate_CTS
 *         self.fitted_uplift_tree = None             # <<<<<<<<<<<<<<
 * 
 *         assert control_name is not None and isinstance(control_name, str), \
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree, Py_None) < 0) __PYX_ERR(0, 422, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":424
 *         self.fitted_uplift_tree = None
 * 
 *         assert control_name is not None and isinstance(control_name, str), \             # <<<<<<<<<<<<<<
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = (__pyx_v_control_name != Py_None);
    __pyx_t_7 = (__pyx_t_3 != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_7 = PyUnicode_Check(__pyx_v_control_name); 
    __pyx_t_3 = (__pyx_t_7 != 0);
    __pyx_t_2 = __pyx_t_3;
    __pyx_L12_bool_binop_done:;
    if (unlikely(!__pyx_t_2)) {

      /* "causalml/inference/tree/uplift.pyx":425
 * 
 *         assert control_name is not None and isinstance(control_name, str), \
 *             f"control_group should be string but {control_name} is passed"             # <<<<<<<<<<<<<<
 *         self.control_name = control_name
 *         self.classes_ = [self.control_name]
 */
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = 0;
      __pyx_t_5 = 127;
      __Pyx_INCREF(__pyx_kp_u_control_group_should_be_string_b);
      __pyx_t_4 += 35;
      __Pyx_GIVEREF(__pyx_kp_u_control_group_should_be_string_b);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_control_group_should_be_string_b);
      __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_control_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_5;
      __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u_is_passed);
      __pyx_t_4 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_is_passed);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_is_passed);
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 424, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":426
 *         assert control_name is not None and isinstance(control_name, str), \
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name             # <<<<<<<<<<<<<<
 *         self.classes_ = [self.control_name]
 *         self.n_class = 1
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_name, __pyx_v_control_name) < 0) __PYX_ERR(0, 426, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":427
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name
 *         self.classes_ = [self.control_name]             # <<<<<<<<<<<<<<
 *         self.n_class = 1
 *         self.normalization = normalization
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_classes, __pyx_t_6) < 0) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "causalml/inference/tree/uplift.pyx":428
 *         self.control_name = control_name
 *         self.classes_ = [self.control_name]
 *         self.n_class = 1             # <<<<<<<<<<<<<<
 *         self.normalization = normalization
 *         self.honesty = honesty
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_class, __pyx_int_1) < 0) __PYX_ERR(0, 428, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":429
 *         self.classes_ = [self.control_name]
 *         self.n_class = 1
 *         self.normalization = normalization             # <<<<<<<<<<<<<<
 *         self.honesty = honesty
 *         self.estimation_sample_size = estimation_sample_size
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_normalization, __pyx_v_normalization) < 0) __PYX_ERR(0, 429, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":430
 *         self.n_class = 1
 *         self.normalization = normalization
 *         self.honesty = honesty             # <<<<<<<<<<<<<<
 *         self.estimation_sample_size = estimation_sample_size
 *         self.random_state = random_state
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_honesty, __pyx_v_honesty) < 0) __PYX_ERR(0, 430, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":431
 *         self.normalization = normalization
 *         self.honesty = honesty
 *         self.estimation_sample_size = estimation_sample_size             # <<<<<<<<<<<<<<
 *         self.random_state = random_state
 *         if evaluationFunction == 'IDDP' and self.honesty is False:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_estimation_sample_size, __pyx_v_estimation_sample_size) < 0) __PYX_ERR(0, 431, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":432
 *         self.honesty = honesty
 *         self.estimation_sample_size = estimation_sample_size
 *         self.random_state = random_state             # <<<<<<<<<<<<<<
 *         if evaluationFunction == 'IDDP' and self.honesty is False:
 *             self.honesty = True
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_random_state, __pyx_v_random_state) < 0) __PYX_ERR(0, 432, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":433
 *         self.estimation_sample_size = estimation_sample_size
 *         self.random_state = random_state
 *         if evaluationFunction == 'IDDP' and self.honesty is False:             # <<<<<<<<<<<<<<
 *             self.honesty = True
 * 
 */
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_evaluationFunction, __pyx_n_u_IDDP, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 433, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_honesty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = (__pyx_t_6 == Py_False);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_7;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":434
 *         self.random_state = random_state
 *         if evaluationFunction == 'IDDP' and self.honesty is False:
 *             self.honesty = True             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_honesty, Py_True) < 0) __PYX_ERR(0, 434, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":433
 *         self.estimation_sample_size = estimation_sample_size
 *         self.random_state = random_state
 *         if evaluationFunction == 'IDDP' and self.honesty is False:             # <<<<<<<<<<<<<<
 *             self.honesty = True
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":385
 * 
 *     """
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,             # <<<<<<<<<<<<<<
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":437
 * 
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """ Fit the uplift model.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_3fit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_2fit[] = " Fit the uplift model.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n\n        treatment : array-like, shape = [num_samples]\n            An array containing the treatment group for each unit.\n\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n\n        Returns\n        -------\n        self : object\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_3fit = {"fit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_3fit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_2fit};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_3fit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_X_val = 0;
  PyObject *__pyx_v_treatment_val = 0;
  PyObject *__pyx_v_y_val = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment,&__pyx_n_s_y,&__pyx_n_s_X_val,&__pyx_n_s_treatment_val,&__pyx_n_s_y_val,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((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  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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 1); __PYX_ERR(0, 437, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 2); __PYX_ERR(0, 437, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 3); __PYX_ERR(0, 437, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_val);
          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_treatment_val);
          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_y_val);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit") < 0)) __PYX_ERR(0, 437, __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);
        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_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment = values[2];
    __pyx_v_y = values[3];
    __pyx_v_X_val = values[4];
    __pyx_v_treatment_val = values[5];
    __pyx_v_y_val = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 437, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_2fit(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment, __pyx_v_y, __pyx_v_X_val, __pyx_v_treatment_val, __pyx_v_y_val);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_2fit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val) {
  PyObject *__pyx_v_treatment_groups = NULL;
  PyObject *__pyx_v_treatment_idx = NULL;
  PyObject *__pyx_v_treatment_val_idx = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_tr = NULL;
  PyObject *__pyx_v_X_est = NULL;
  PyObject *__pyx_v_treatment_idx_est = NULL;
  PyObject *__pyx_v_y_est = NULL;
  PyObject *__pyx_v_col = NULL;
  PyObject *__pyx_v_imp = NULL;
  PyObject *__pyx_7genexpr__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fit", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_X_val);
  __Pyx_INCREF(__pyx_v_treatment_val);
  __Pyx_INCREF(__pyx_v_y_val);

  /* "causalml/inference/tree/uplift.pyx":456
 *         """
 * 
 *         self.random_state_ = check_random_state(self.random_state)             # <<<<<<<<<<<<<<
 * 
 *         X, y = check_X_y(X, y)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_random_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_random_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_random_state_2, __pyx_t_1) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":458
 *         self.random_state_ = check_random_state(self.random_state)
 * 
 *         X, y = check_X_y(X, y)             # <<<<<<<<<<<<<<
 *         y = (y > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *         treatment = np.asarray(treatment)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_X_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __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, 458, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __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, 458, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __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;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 458, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 458, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 458, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":459
 * 
 *         X, y = check_X_y(X, y)
 *         y = (y > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8             # <<<<<<<<<<<<<<
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Y_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":460
 *         X, y = check_X_y(X, y)
 *         y = (y > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *         treatment = np.asarray(treatment)             # <<<<<<<<<<<<<<
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 *         if X_val is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_treatment) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_treatment);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_treatment, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":461
 *         y = (y > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'             # <<<<<<<<<<<<<<
 *         if X_val is not None:
 *             X_val, y_val = check_X_y(X_val, y_val)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_7 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 461, __pyx_L1_error)
    __pyx_t_8 = PyObject_Length(__pyx_v_treatment); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 461, __pyx_L1_error)
    if (unlikely(!((__pyx_t_7 == __pyx_t_8) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Data_length_must_be_equal_for_X);
      __PYX_ERR(0, 461, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":462
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 *         if X_val is not None:             # <<<<<<<<<<<<<<
 *             X_val, y_val = check_X_y(X_val, y_val)
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 */
  __pyx_t_9 = (__pyx_v_X_val != Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "causalml/inference/tree/uplift.pyx":463
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 *         if X_val is not None:
 *             X_val, y_val = check_X_y(X_val, y_val)             # <<<<<<<<<<<<<<
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *             treatment_val = np.asarray(treatment_val)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_check_X_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_X_val, __pyx_v_y_val};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_X_val, __pyx_v_y_val};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X_val);
      __Pyx_GIVEREF(__pyx_v_X_val);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_X_val);
      __Pyx_INCREF(__pyx_v_y_val);
      __Pyx_GIVEREF(__pyx_v_y_val);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_v_y_val);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 463, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 463, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 463, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_X_val, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y_val, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":464
 *         if X_val is not None:
 *             X_val, y_val = check_X_y(X_val, y_val)
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8             # <<<<<<<<<<<<<<
 *             treatment_val = np.asarray(treatment_val)
 *             assert len(y_val) == len(treatment_val), 'Data length must be equal for X_val, treatment_val, and y_val.'
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_y_val, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Y_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y_val, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":465
 *             X_val, y_val = check_X_y(X_val, y_val)
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *             treatment_val = np.asarray(treatment_val)             # <<<<<<<<<<<<<<
 *             assert len(y_val) == len(treatment_val), 'Data length must be equal for X_val, treatment_val, and y_val.'
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_treatment_val) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_treatment_val);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_treatment_val, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":466
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 *             treatment_val = np.asarray(treatment_val)
 *             assert len(y_val) == len(treatment_val), 'Data length must be equal for X_val, treatment_val, and y_val.'             # <<<<<<<<<<<<<<
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_8 = PyObject_Length(__pyx_v_y_val); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 466, __pyx_L1_error)
      __pyx_t_7 = PyObject_Length(__pyx_v_treatment_val); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 466, __pyx_L1_error)
      if (unlikely(!((__pyx_t_8 == __pyx_t_7) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Data_length_must_be_equal_for_X_2);
        __PYX_ERR(0, 466, __pyx_L1_error)
      }
    }
    #endif

    /* "causalml/inference/tree/uplift.pyx":462
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 *         if X_val is not None:             # <<<<<<<<<<<<<<
 *             X_val, y_val = check_X_y(X_val, y_val)
 *             y_val = (y_val > 0).astype(Y_TYPE) # make sure it is 0 or 1, and is int8
 */
  }

  /* "causalml/inference/tree/uplift.pyx":469
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])             # <<<<<<<<<<<<<<
 *         self.classes_ = [self.control_name]
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySet_New(__pyx_v_treatment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 469, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L10_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 469, __pyx_L10_error)
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = PyObject_RichCompare(__pyx_7genexpr__pyx_v_x, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 469, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 469, __pyx_L10_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (__pyx_t_10) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_7genexpr__pyx_v_x))) __PYX_ERR(0, 469, __pyx_L10_error)
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
    goto __pyx_L14_exit_scope;
    __pyx_L10_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
    goto __pyx_L1_error;
    __pyx_L14_exit_scope:;
  } /* exit inner scope */
  __pyx_t_1 = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_12 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 469, __pyx_L1_error)
  __pyx_v_treatment_groups = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":470
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])
 *         self.classes_ = [self.control_name]             # <<<<<<<<<<<<<<
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)
 *         treatment_val_idx = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_classes, __pyx_t_3) < 0) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":471
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])
 *         self.classes_ = [self.control_name]
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)             # <<<<<<<<<<<<<<
 *         treatment_val_idx = None
 *         if treatment_val is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_treatment);
  __Pyx_GIVEREF(__pyx_v_treatment);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_treatment);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_TR_TYPE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_treatment_idx = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":472
 *         self.classes_ = [self.control_name]
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)
 *         treatment_val_idx = None             # <<<<<<<<<<<<<<
 *         if treatment_val is not None:
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_treatment_val_idx = Py_None;

  /* "causalml/inference/tree/uplift.pyx":473
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)
 *         treatment_val_idx = None
 *         if treatment_val is not None:             # <<<<<<<<<<<<<<
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 *         for i, tr in enumerate(treatment_groups, 1):
 */
  __pyx_t_10 = (__pyx_v_treatment_val != Py_None);
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "causalml/inference/tree/uplift.pyx":474
 *         treatment_val_idx = None
 *         if treatment_val is not None:
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)             # <<<<<<<<<<<<<<
 *         for i, tr in enumerate(treatment_groups, 1):
 *             self.classes_.append(tr)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_treatment_val);
    __Pyx_GIVEREF(__pyx_v_treatment_val);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_treatment_val);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_TR_TYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_treatment_val_idx, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":473
 *         treatment_idx = np.zeros_like(treatment, dtype=TR_TYPE)
 *         treatment_val_idx = None
 *         if treatment_val is not None:             # <<<<<<<<<<<<<<
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 *         for i, tr in enumerate(treatment_groups, 1):
 */
  }

  /* "causalml/inference/tree/uplift.pyx":475
 *         if treatment_val is not None:
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 *         for i, tr in enumerate(treatment_groups, 1):             # <<<<<<<<<<<<<<
 *             self.classes_.append(tr)
 *             treatment_idx[treatment == tr] = i
 */
  __Pyx_INCREF(__pyx_int_1);
  __pyx_t_1 = __pyx_int_1;
  __pyx_t_3 = __pyx_v_treatment_groups; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
  for (;;) {
    if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_11 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 475, __pyx_L1_error)
    #else
    __pyx_t_11 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_tr, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":476
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 *         for i, tr in enumerate(treatment_groups, 1):
 *             self.classes_.append(tr)             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 *             if treatment_val_idx is not None:
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_11, __pyx_v_tr); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":477
 *         for i, tr in enumerate(treatment_groups, 1):
 *             self.classes_.append(tr)
 *             treatment_idx[treatment == tr] = i             # <<<<<<<<<<<<<<
 *             if treatment_val_idx is not None:
 *                 treatment_val_idx[treatment_val == tr] = i
 */
    __pyx_t_11 = PyObject_RichCompare(__pyx_v_treatment, __pyx_v_tr, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 477, __pyx_L1_error)
    if (unlikely(PyObject_SetItem(__pyx_v_treatment_idx, __pyx_t_11, __pyx_v_i) < 0)) __PYX_ERR(0, 477, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":478
 *             self.classes_.append(tr)
 *             treatment_idx[treatment == tr] = i
 *             if treatment_val_idx is not None:             # <<<<<<<<<<<<<<
 *                 treatment_val_idx[treatment_val == tr] = i
 *         self.n_class = len(self.classes_)
 */
    __pyx_t_9 = (__pyx_v_treatment_val_idx != Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

      /* "causalml/inference/tree/uplift.pyx":479
 *             treatment_idx[treatment == tr] = i
 *             if treatment_val_idx is not None:
 *                 treatment_val_idx[treatment_val == tr] = i             # <<<<<<<<<<<<<<
 *         self.n_class = len(self.classes_)
 * 
 */
      __pyx_t_11 = PyObject_RichCompare(__pyx_v_treatment_val, __pyx_v_tr, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 479, __pyx_L1_error)
      if (unlikely(PyObject_SetItem(__pyx_v_treatment_val_idx, __pyx_t_11, __pyx_v_i) < 0)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":478
 *             self.classes_.append(tr)
 *             treatment_idx[treatment == tr] = i
 *             if treatment_val_idx is not None:             # <<<<<<<<<<<<<<
 *                 treatment_val_idx[treatment_val == tr] = i
 *         self.n_class = len(self.classes_)
 */
    }

    /* "causalml/inference/tree/uplift.pyx":475
 *         if treatment_val is not None:
 *             treatment_val_idx = np.zeros_like(treatment_val, dtype=TR_TYPE)
 *         for i, tr in enumerate(treatment_groups, 1):             # <<<<<<<<<<<<<<
 *             self.classes_.append(tr)
 *             treatment_idx[treatment == tr] = i
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":480
 *             if treatment_val_idx is not None:
 *                 treatment_val_idx[treatment_val == tr] = i
 *         self.n_class = len(self.classes_)             # <<<<<<<<<<<<<<
 * 
 *         self.feature_imp_dict = defaultdict(float)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_class, __pyx_t_1) < 0) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":482
 *         self.n_class = len(self.classes_)
 * 
 *         self.feature_imp_dict = defaultdict(float)             # <<<<<<<<<<<<<<
 * 
 *         if (self.n_class > 2) and (self.evaluationFunction in [self.evaluate_DDP, self.evaluate_IDDP, self.evaluate_IT, self.evaluate_CIT]):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_11, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)(&PyFloat_Type)));
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_feature_imp_dict, __pyx_t_1) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":484
 *         self.feature_imp_dict = defaultdict(float)
 * 
 *         if (self.n_class > 2) and (self.evaluationFunction in [self.evaluate_DDP, self.evaluate_IDDP, self.evaluate_IT, self.evaluate_CIT]):             # <<<<<<<<<<<<<<
 *             raise ValueError("The DDP, IDDP, IT, and CIT approach can only cope with two class problems, that is two different treatment "
 *                              "options (e.g., control vs treatment). Please select another approach or only use a "
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_9) {
  } else {
    __pyx_t_10 = __pyx_t_9;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_DDP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (!__pyx_t_13) {
  } else {
    __pyx_t_9 = __pyx_t_13;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IDDP); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_13) {
  } else {
    __pyx_t_9 = __pyx_t_13;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (!__pyx_t_13) {
  } else {
    __pyx_t_9 = __pyx_t_13;
    goto __pyx_L22_bool_binop_done;
  }
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_CIT); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __pyx_t_13;
  __pyx_L22_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = (__pyx_t_9 != 0);
  __pyx_t_10 = __pyx_t_13;
  __pyx_L20_bool_binop_done:;
  if (unlikely(__pyx_t_10)) {

    /* "causalml/inference/tree/uplift.pyx":485
 * 
 *         if (self.n_class > 2) and (self.evaluationFunction in [self.evaluate_DDP, self.evaluate_IDDP, self.evaluate_IT, self.evaluate_CIT]):
 *             raise ValueError("The DDP, IDDP, IT, and CIT approach can only cope with two class problems, that is two different treatment "             # <<<<<<<<<<<<<<
 *                              "options (e.g., control vs treatment). Please select another approach or only use a "
 *                              "dataset which employs two treatment options.")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __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, 485, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":484
 *         self.feature_imp_dict = defaultdict(float)
 * 
 *         if (self.n_class > 2) and (self.evaluationFunction in [self.evaluate_DDP, self.evaluate_IDDP, self.evaluate_IT, self.evaluate_CIT]):             # <<<<<<<<<<<<<<
 *             raise ValueError("The DDP, IDDP, IT, and CIT approach can only cope with two class problems, that is two different treatment "
 *                              "options (e.g., control vs treatment). Please select another approach or only use a "
 */
  }

  /* "causalml/inference/tree/uplift.pyx":489
 *                              "dataset which employs two treatment options.")
 * 
 *         if self.honesty:             # <<<<<<<<<<<<<<
 *             try:
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_honesty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_10) {

    /* "causalml/inference/tree/uplift.pyx":490
 * 
 *         if self.honesty:
 *             try:             # <<<<<<<<<<<<<<
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 *                                                                                         shuffle=True, random_state=self.random_state)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      /*try:*/ {

        /* "causalml/inference/tree/uplift.pyx":491
 *         if self.honesty:
 *             try:
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,             # <<<<<<<<<<<<<<
 *                                                                                         shuffle=True, random_state=self.random_state)
 *             except ValueError:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_train_test_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_X);
        __Pyx_GIVEREF(__pyx_v_X);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X);
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_y);
        __pyx_t_11 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_y);
        if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_stratify, __pyx_t_4) < 0) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_estimation_sample_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_test_size, __pyx_t_4) < 0) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "causalml/inference/tree/uplift.pyx":492
 *             try:
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 *                                                                                         shuffle=True, random_state=self.random_state)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")
 */
        if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_shuffle, Py_True) < 0) __PYX_ERR(0, 491, __pyx_L27_error)
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_random_state); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_random_state, __pyx_t_4) < 0) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "causalml/inference/tree/uplift.pyx":491
 *         if self.honesty:
 *             try:
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,             # <<<<<<<<<<<<<<
 *                                                                                         shuffle=True, random_state=self.random_state)
 *             except ValueError:
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
          PyObject* sequence = __pyx_t_4;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 6)) {
            if (size > 6) __Pyx_RaiseTooManyValuesError(6);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 491, __pyx_L27_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
            __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
            __pyx_t_17 = PyTuple_GET_ITEM(sequence, 4); 
            __pyx_t_18 = PyTuple_GET_ITEM(sequence, 5); 
          } else {
            __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
            __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
            __pyx_t_17 = PyList_GET_ITEM(sequence, 4); 
            __pyx_t_18 = PyList_GET_ITEM(sequence, 5); 
          }
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(__pyx_t_18);
          #else
          {
            Py_ssize_t i;
            PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_1,&__pyx_t_3,&__pyx_t_2,&__pyx_t_17,&__pyx_t_18};
            for (i=0; i < 6; i++) {
              PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 491, __pyx_L27_error)
              __Pyx_GOTREF(item);
              *(temps[i]) = item;
            }
          }
          #endif
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else {
          Py_ssize_t index = -1;
          PyObject** temps[6] = {&__pyx_t_11,&__pyx_t_1,&__pyx_t_3,&__pyx_t_2,&__pyx_t_17,&__pyx_t_18};
          __pyx_t_19 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 491, __pyx_L27_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_19)->tp_iternext;
          for (index=0; index < 6; index++) {
            PyObject* item = __pyx_t_6(__pyx_t_19); if (unlikely(!item)) goto __pyx_L33_unpacking_failed;
            __Pyx_GOTREF(item);
            *(temps[index]) = item;
          }
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_19), 6) < 0) __PYX_ERR(0, 491, __pyx_L27_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          goto __pyx_L34_unpacking_done;
          __pyx_L33_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_6 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 491, __pyx_L27_error)
          __pyx_L34_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_v_X_est = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_treatment_idx, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_v_treatment_idx_est = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_17);
        __pyx_t_17 = 0;
        __pyx_v_y_est = __pyx_t_18;
        __pyx_t_18 = 0;

        /* "causalml/inference/tree/uplift.pyx":490
 * 
 *         if self.honesty:
 *             try:             # <<<<<<<<<<<<<<
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 *                                                                                         shuffle=True, random_state=self.random_state)
 */
      }
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      goto __pyx_L32_try_end;
      __pyx_L27_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":493
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 *                                                                                         shuffle=True, random_state=self.random_state)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, test_size=self.estimation_sample_size, shuffle=True,
 */
      __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_5) {
        __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fit", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_18, &__pyx_t_17) < 0) __PYX_ERR(0, 493, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_GOTREF(__pyx_t_17);

        /* "causalml/inference/tree/uplift.pyx":494
 *                                                                                         shuffle=True, random_state=self.random_state)
 *             except ValueError:
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")             # <<<<<<<<<<<<<<
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, test_size=self.estimation_sample_size, shuffle=True,
 *                                                                                         random_state=self.random_state)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_kp_u_Stratified_sampling_failed_Falli) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_Stratified_sampling_failed_Falli);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":495
 *             except ValueError:
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, test_size=self.estimation_sample_size, shuffle=True,             # <<<<<<<<<<<<<<
 *                                                                                         random_state=self.random_state)
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_train_test_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_X);
        __Pyx_GIVEREF(__pyx_v_X);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X);
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_y);
        __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_estimation_sample_size); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_test_size, __pyx_t_11) < 0) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shuffle, Py_True) < 0) __PYX_ERR(0, 495, __pyx_L29_except_error)

        /* "causalml/inference/tree/uplift.pyx":496
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, test_size=self.estimation_sample_size, shuffle=True,
 *                                                                                         random_state=self.random_state)             # <<<<<<<<<<<<<<
 * 
 *         self.fitted_uplift_tree = self.growDecisionTreeFrom(
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_random_state); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 496, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_random_state, __pyx_t_11) < 0) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":495
 *             except ValueError:
 *                 logger.warning(f"Stratified sampling failed. Falling back to random sampling.")
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, test_size=self.estimation_sample_size, shuffle=True,             # <<<<<<<<<<<<<<
 *                                                                                         random_state=self.random_state)
 * 
 */
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 495, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
          PyObject* sequence = __pyx_t_11;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 6)) {
            if (size > 6) __Pyx_RaiseTooManyValuesError(6);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 495, __pyx_L29_except_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
            __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); 
            __pyx_t_20 = PyTuple_GET_ITEM(sequence, 4); 
            __pyx_t_21 = PyTuple_GET_ITEM(sequence, 5); 
          } else {
            __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
            __pyx_t_19 = PyList_GET_ITEM(sequence, 3); 
            __pyx_t_20 = PyList_GET_ITEM(sequence, 4); 
            __pyx_t_21 = PyList_GET_ITEM(sequence, 5); 
          }
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_21);
          #else
          {
            Py_ssize_t i;
            PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_2,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21};
            for (i=0; i < 6; i++) {
              PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 495, __pyx_L29_except_error)
              __Pyx_GOTREF(item);
              *(temps[i]) = item;
            }
          }
          #endif
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else {
          Py_ssize_t index = -1;
          PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_2,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21};
          __pyx_t_22 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 495, __pyx_L29_except_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_22)->tp_iternext;
          for (index=0; index < 6; index++) {
            PyObject* item = __pyx_t_6(__pyx_t_22); if (unlikely(!item)) goto __pyx_L37_unpacking_failed;
            __Pyx_GOTREF(item);
            *(temps[index]) = item;
          }
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_22), 6) < 0) __PYX_ERR(0, 495, __pyx_L29_except_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          goto __pyx_L38_unpacking_done;
          __pyx_L37_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __pyx_t_6 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 495, __pyx_L29_except_error)
          __pyx_L38_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_XDECREF_SET(__pyx_v_X_est, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_treatment_idx, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_treatment_idx_est, __pyx_t_19);
        __pyx_t_19 = 0;
        __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_20);
        __pyx_t_20 = 0;
        __Pyx_XDECREF_SET(__pyx_v_y_est, __pyx_t_21);
        __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        goto __pyx_L28_exception_handled;
      }
      goto __pyx_L29_except_error;
      __pyx_L29_except_error:;

      /* "causalml/inference/tree/uplift.pyx":490
 * 
 *         if self.honesty:
 *             try:             # <<<<<<<<<<<<<<
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 *                                                                                         shuffle=True, random_state=self.random_state)
 */
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      goto __pyx_L1_error;
      __pyx_L28_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      __pyx_L32_try_end:;
    }

    /* "causalml/inference/tree/uplift.pyx":489
 *                              "dataset which employs two treatment options.")
 * 
 *         if self.honesty:             # <<<<<<<<<<<<<<
 *             try:
 *                 X, X_est, treatment_idx, treatment_idx_est, y, y_est = train_test_split(X, treatment_idx, y, stratify=[treatment_idx, y], test_size=self.estimation_sample_size,
 */
  }

  /* "causalml/inference/tree/uplift.pyx":498
 *                                                                                         random_state=self.random_state)
 * 
 *         self.fitted_uplift_tree = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *             X, treatment_idx, y, X_val, treatment_val_idx, y_val,
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 */
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_growDecisionTreeFrom); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);

  /* "causalml/inference/tree/uplift.pyx":499
 * 
 *         self.fitted_uplift_tree = self.growDecisionTreeFrom(
 *             X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *             min_samples_leaf=self.min_samples_leaf,
 */
  __pyx_t_18 = PyTuple_New(6); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_GIVEREF(__pyx_v_X);
  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_idx);
  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_treatment_idx);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_y);
  __Pyx_INCREF(__pyx_v_X_val);
  __Pyx_GIVEREF(__pyx_v_X_val);
  PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_v_X_val);
  __Pyx_INCREF(__pyx_v_treatment_val_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_val_idx);
  PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_v_treatment_val_idx);
  __Pyx_INCREF(__pyx_v_y_val);
  __Pyx_GIVEREF(__pyx_v_y_val);
  PyTuple_SET_ITEM(__pyx_t_18, 5, __pyx_v_y_val);

  /* "causalml/inference/tree/uplift.pyx":500
 *         self.fitted_uplift_tree = self.growDecisionTreeFrom(
 *             X, treatment_idx, y, X_val, treatment_val_idx, y_val,
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,             # <<<<<<<<<<<<<<
 *             min_samples_leaf=self.min_samples_leaf,
 *             depth=1, min_samples_treatment=self.min_samples_treatment,
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_depth); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_max_depth, __pyx_t_11) < 0) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_t_11) < 0) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":501
 *             X, treatment_idx, y, X_val, treatment_val_idx, y_val,
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *             min_samples_leaf=self.min_samples_leaf,             # <<<<<<<<<<<<<<
 *             depth=1, min_samples_treatment=self.min_samples_treatment,
 *             n_reg=self.n_reg, parentNodeSummary_p=None
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_leaf); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_samples_leaf, __pyx_t_11) < 0) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_depth, __pyx_int_1) < 0) __PYX_ERR(0, 500, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":502
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *             min_samples_leaf=self.min_samples_leaf,
 *             depth=1, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *             n_reg=self.n_reg, parentNodeSummary_p=None
 *         )
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_samples_treatment, __pyx_t_11) < 0) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":503
 *             min_samples_leaf=self.min_samples_leaf,
 *             depth=1, min_samples_treatment=self.min_samples_treatment,
 *             n_reg=self.n_reg, parentNodeSummary_p=None             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_reg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_reg, __pyx_t_11) < 0) __PYX_ERR(0, 500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_parentNodeSummary_p, Py_None) < 0) __PYX_ERR(0, 500, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":498
 *                                                                                         random_state=self.random_state)
 * 
 *         self.fitted_uplift_tree = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *             X, treatment_idx, y, X_val, treatment_val_idx, y_val,
 *             max_depth=self.max_depth, early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 */
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_18, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree, __pyx_t_11) < 0) __PYX_ERR(0, 498, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":506
 *         )
 * 
 *         if self.honesty:             # <<<<<<<<<<<<<<
 *             self.honestApproach(X_est, treatment_idx_est, y_est)
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_honesty); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__pyx_t_10) {

    /* "causalml/inference/tree/uplift.pyx":507
 * 
 *         if self.honesty:
 *             self.honestApproach(X_est, treatment_idx_est, y_est)             # <<<<<<<<<<<<<<
 * 
 *         self.feature_importances_ = np.zeros(X.shape[1])
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_honestApproach); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(!__pyx_v_X_est)) { __Pyx_RaiseUnboundLocalError("X_est"); __PYX_ERR(0, 507, __pyx_L1_error) }
    if (unlikely(!__pyx_v_treatment_idx_est)) { __Pyx_RaiseUnboundLocalError("treatment_idx_est"); __PYX_ERR(0, 507, __pyx_L1_error) }
    if (unlikely(!__pyx_v_y_est)) { __Pyx_RaiseUnboundLocalError("y_est"); __PYX_ERR(0, 507, __pyx_L1_error) }
    __pyx_t_18 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_18)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_18);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_v_X_est, __pyx_v_treatment_idx_est, __pyx_v_y_est};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_v_X_est, __pyx_v_treatment_idx_est, __pyx_v_y_est};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_18) {
        __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __pyx_t_18 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X_est);
      __Pyx_GIVEREF(__pyx_v_X_est);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_5, __pyx_v_X_est);
      __Pyx_INCREF(__pyx_v_treatment_idx_est);
      __Pyx_GIVEREF(__pyx_v_treatment_idx_est);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_5, __pyx_v_treatment_idx_est);
      __Pyx_INCREF(__pyx_v_y_est);
      __Pyx_GIVEREF(__pyx_v_y_est);
      PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_5, __pyx_v_y_est);
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_17, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":506
 *         )
 * 
 *         if self.honesty:             # <<<<<<<<<<<<<<
 *             self.honestApproach(X_est, treatment_idx_est, y_est)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":509
 *             self.honestApproach(X_est, treatment_idx_est, y_est)
 * 
 *         self.feature_importances_ = np.zeros(X.shape[1])             # <<<<<<<<<<<<<<
 *         for col, imp in self.feature_imp_dict.items():
 *             self.feature_importances_[col] = imp
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_17);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_17, function);
    }
  }
  __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_17, __pyx_t_4, __pyx_t_18) : __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_18);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_feature_importances, __pyx_t_11) < 0) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":510
 * 
 *         self.feature_importances_ = np.zeros(X.shape[1])
 *         for col, imp in self.feature_imp_dict.items():             # <<<<<<<<<<<<<<
 *             self.feature_importances_[col] = imp
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1
 */
  __pyx_t_7 = 0;
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_feature_imp_dict); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  if (unlikely(__pyx_t_17 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 510, __pyx_L1_error)
  }
  __pyx_t_18 = __Pyx_dict_iterator(__pyx_t_17, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_5)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_XDECREF(__pyx_t_11);
  __pyx_t_11 = __pyx_t_18;
  __pyx_t_18 = 0;
  while (1) {
    __pyx_t_23 = __Pyx_dict_iter_next(__pyx_t_11, __pyx_t_8, &__pyx_t_7, &__pyx_t_18, &__pyx_t_17, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_23 == 0)) break;
    if (unlikely(__pyx_t_23 == -1)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_18);
    __pyx_t_18 = 0;
    __Pyx_XDECREF_SET(__pyx_v_imp, __pyx_t_17);
    __pyx_t_17 = 0;

    /* "causalml/inference/tree/uplift.pyx":511
 *         self.feature_importances_ = np.zeros(X.shape[1])
 *         for col, imp in self.feature_imp_dict.items():
 *             self.feature_importances_[col] = imp             # <<<<<<<<<<<<<<
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1
 * 
 */
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    if (unlikely(PyObject_SetItem(__pyx_t_17, __pyx_v_col, __pyx_v_imp) < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "causalml/inference/tree/uplift.pyx":512
 *         for col, imp in self.feature_imp_dict.items():
 *             self.feature_importances_[col] = imp
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1             # <<<<<<<<<<<<<<
 * 
 *     # Prune Trees
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_18 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_18)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_18);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_17 = (__pyx_t_18) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_18) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_11, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_feature_importances, __pyx_t_4) < 0) __PYX_ERR(0, 512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":437
 * 
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """ Fit the uplift model.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_treatment_groups);
  __Pyx_XDECREF(__pyx_v_treatment_idx);
  __Pyx_XDECREF(__pyx_v_treatment_val_idx);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_tr);
  __Pyx_XDECREF(__pyx_v_X_est);
  __Pyx_XDECREF(__pyx_v_treatment_idx_est);
  __Pyx_XDECREF(__pyx_v_y_est);
  __Pyx_XDECREF(__pyx_v_col);
  __Pyx_XDECREF(__pyx_v_imp);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_treatment);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_X_val);
  __Pyx_XDECREF(__pyx_v_treatment_val);
  __Pyx_XDECREF(__pyx_v_y_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":515
 * 
 *     # Prune Trees
 *     def prune(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff'):             # <<<<<<<<<<<<<<
 *         """ Prune the uplift model.
 *         Args
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_5prune(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_4prune[] = " Prune the uplift model.\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment : array-like, shape = [num_samples]\n            An array containing the treatment group for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        minGain : float, optional (default = 0.0001)\n            The minimum gain required to make a tree node split. The children\n            tree branches are trimmed if the actual split gain is less than\n            the minimum gain.\n        rule : string, optional (default = 'maxAbsDiff')\n            The prune rules. Supported values are 'maxAbsDiff' for optimizing\n            the maximum absolute difference, and 'bestUplift' for optimizing\n            the node-size weighted treatment effect.\n        Returns\n        -------\n        self : object\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_5prune = {"prune", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_5prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_4prune};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_5prune(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_minGain = 0;
  PyObject *__pyx_v_rule = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prune (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment,&__pyx_n_s_y,&__pyx_n_s_minGain,&__pyx_n_s_rule,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject*)__pyx_float_0_0001));
    values[5] = ((PyObject *)((PyObject*)__pyx_n_u_maxAbsDiff));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prune", 0, 4, 6, 1); __PYX_ERR(0, 515, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prune", 0, 4, 6, 2); __PYX_ERR(0, 515, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prune", 0, 4, 6, 3); __PYX_ERR(0, 515, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minGain);
          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_rule);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prune") < 0)) __PYX_ERR(0, 515, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment = values[2];
    __pyx_v_y = values[3];
    __pyx_v_minGain = values[4];
    __pyx_v_rule = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prune", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 515, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_4prune(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment, __pyx_v_y, __pyx_v_minGain, __pyx_v_rule);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_4prune(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_minGain, PyObject *__pyx_v_rule) {
  PyObject *__pyx_v_treatment_idx = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_tr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("prune", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment);
  __Pyx_INCREF(__pyx_v_y);

  /* "causalml/inference/tree/uplift.pyx":538
 *         """
 * 
 *         X, y = check_X_y(X, y)             # <<<<<<<<<<<<<<
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_X_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 538, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 538, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 538, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":539
 * 
 *         X, y = check_X_y(X, y)
 *         treatment = np.asarray(treatment)             # <<<<<<<<<<<<<<
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_treatment) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_treatment);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_treatment, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":540
 *         X, y = check_X_y(X, y)
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'             # <<<<<<<<<<<<<<
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_7 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 540, __pyx_L1_error)
    __pyx_t_8 = PyObject_Length(__pyx_v_treatment); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 540, __pyx_L1_error)
    if (unlikely(!((__pyx_t_7 == __pyx_t_8) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Data_length_must_be_equal_for_X);
      __PYX_ERR(0, 540, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":543
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)             # <<<<<<<<<<<<<<
 *         for i, tr in enumerate(self.classes_[1:], 1):
 *             treatment_idx[treatment == tr] = i
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_treatment) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_treatment);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_treatment_idx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":544
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 * 
 */
  __Pyx_INCREF(__pyx_int_1);
  __pyx_t_1 = __pyx_int_1;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_5, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_9(__pyx_t_5);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 544, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_tr, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":545
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):
 *             treatment_idx[treatment == tr] = i             # <<<<<<<<<<<<<<
 * 
 *         self.pruneTree(X, treatment_idx, y,
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_treatment, __pyx_v_tr, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
    if (unlikely(PyObject_SetItem(__pyx_v_treatment_idx, __pyx_t_2, __pyx_v_i) < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":544
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":547
 *             treatment_idx[treatment == tr] = i
 * 
 *         self.pruneTree(X, treatment_idx, y,             # <<<<<<<<<<<<<<
 *                        tree=self.fitted_uplift_tree,
 *                        rule=rule,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pruneTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_GIVEREF(__pyx_v_X);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_idx);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_treatment_idx);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_y);

  /* "causalml/inference/tree/uplift.pyx":548
 * 
 *         self.pruneTree(X, treatment_idx, y,
 *                        tree=self.fitted_uplift_tree,             # <<<<<<<<<<<<<<
 *                        rule=rule,
 *                        minGain=minGain,
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tree, __pyx_t_3) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":549
 *         self.pruneTree(X, treatment_idx, y,
 *                        tree=self.fitted_uplift_tree,
 *                        rule=rule,             # <<<<<<<<<<<<<<
 *                        minGain=minGain,
 *                        n_reg=self.n_reg,
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rule, __pyx_v_rule) < 0) __PYX_ERR(0, 548, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":550
 *                        tree=self.fitted_uplift_tree,
 *                        rule=rule,
 *                        minGain=minGain,             # <<<<<<<<<<<<<<
 *                        n_reg=self.n_reg,
 *                        parentNodeSummary=None)
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_minGain, __pyx_v_minGain) < 0) __PYX_ERR(0, 548, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":551
 *                        rule=rule,
 *                        minGain=minGain,
 *                        n_reg=self.n_reg,             # <<<<<<<<<<<<<<
 *                        parentNodeSummary=None)
 *         return self
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_reg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n_reg, __pyx_t_3) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":552
 *                        minGain=minGain,
 *                        n_reg=self.n_reg,
 *                        parentNodeSummary=None)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parentNodeSummary, Py_None) < 0) __PYX_ERR(0, 548, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":547
 *             treatment_idx[treatment == tr] = i
 * 
 *         self.pruneTree(X, treatment_idx, y,             # <<<<<<<<<<<<<<
 *                        tree=self.fitted_uplift_tree,
 *                        rule=rule,
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":553
 *                        n_reg=self.n_reg,
 *                        parentNodeSummary=None)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def honestApproach(self, X_est, T_est, Y_est):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":515
 * 
 *     # Prune Trees
 *     def prune(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff'):             # <<<<<<<<<<<<<<
 *         """ Prune the uplift model.
 *         Args
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_treatment_idx);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_tr);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_treatment);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":555
 *         return self
 * 
 *     def honestApproach(self, X_est, T_est, Y_est):             # <<<<<<<<<<<<<<
 *         """ Apply the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 *         Args
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_7honestApproach(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_6honestApproach[] = " Apply the honest approach based on \"Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects.\"\n        Args\n        ----\n        X_est : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to calculate the unbiased estimates in the leafs of the decision tree.\n        T_est : array-like, shape = [num_samples]\n            An array containing the treatment group for each unit.\n        Y_est : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_7honestApproach = {"honestApproach", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_7honestApproach, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_6honestApproach};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_7honestApproach(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X_est = 0;
  PyObject *__pyx_v_T_est = 0;
  PyObject *__pyx_v_Y_est = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("honestApproach (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X_est,&__pyx_n_s_T_est,&__pyx_n_s_Y_est,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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("honestApproach", 1, 4, 4, 1); __PYX_ERR(0, 555, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_T_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("honestApproach", 1, 4, 4, 2); __PYX_ERR(0, 555, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("honestApproach", 1, 4, 4, 3); __PYX_ERR(0, 555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "honestApproach") < 0)) __PYX_ERR(0, 555, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_X_est = values[1];
    __pyx_v_T_est = values[2];
    __pyx_v_Y_est = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("honestApproach", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.honestApproach", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_6honestApproach(__pyx_self, __pyx_v_self, __pyx_v_X_est, __pyx_v_T_est, __pyx_v_Y_est);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_6honestApproach(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_est, PyObject *__pyx_v_T_est, PyObject *__pyx_v_Y_est) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("honestApproach", 0);

  /* "causalml/inference/tree/uplift.pyx":567
 *         """
 * 
 *         self.modifyEstimation(X_est, T_est, Y_est, self.fitted_uplift_tree)             # <<<<<<<<<<<<<<
 * 
 *     def modifyEstimation(self, X_est, t_est, y_est, tree):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_modifyEstimation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __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[5] = {__pyx_t_4, __pyx_v_X_est, __pyx_v_T_est, __pyx_v_Y_est, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __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[5] = {__pyx_t_4, __pyx_v_X_est, __pyx_v_T_est, __pyx_v_Y_est, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __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(4+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X_est);
    __Pyx_GIVEREF(__pyx_v_X_est);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_X_est);
    __Pyx_INCREF(__pyx_v_T_est);
    __Pyx_GIVEREF(__pyx_v_T_est);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_T_est);
    __Pyx_INCREF(__pyx_v_Y_est);
    __Pyx_GIVEREF(__pyx_v_Y_est);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_Y_est);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_t_3);
    __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, 567, __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;

  /* "causalml/inference/tree/uplift.pyx":555
 *         return self
 * 
 *     def honestApproach(self, X_est, T_est, Y_est):             # <<<<<<<<<<<<<<
 *         """ Apply the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 *         Args
 */

  /* 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("causalml.inference.tree.uplift.UpliftTreeClassifier.honestApproach", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":569
 *         self.modifyEstimation(X_est, T_est, Y_est, self.fitted_uplift_tree)
 * 
 *     def modifyEstimation(self, X_est, t_est, y_est, tree):             # <<<<<<<<<<<<<<
 *         """ Modifies the leafs of the current decision tree to only contain unbiased estimates.
 *         Applies the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_9modifyEstimation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8modifyEstimation[] = " Modifies the leafs of the current decision tree to only contain unbiased estimates.\n        Applies the honest approach based on \"Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects.\"\n        Args\n        ----\n        X_est : ndarray, shape = [num_samples, num_features]\n           An ndarray of the covariates used to calculate the unbiased estimates in the leafs of the decision tree.\n        T_est : array-like, shape = [num_samples]\n           An array containing the treatment group for each unit.\n        Y_est : array-like, shape = [num_samples]\n           An array containing the outcome of interest for each unit.\n        tree : object\n            object of DecisionTree class - the current decision tree that shall be modified\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_9modifyEstimation = {"modifyEstimation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_9modifyEstimation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8modifyEstimation};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_9modifyEstimation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X_est = 0;
  PyObject *__pyx_v_t_est = 0;
  PyObject *__pyx_v_y_est = 0;
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("modifyEstimation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X_est,&__pyx_n_s_t_est,&__pyx_n_s_y_est,&__pyx_n_s_tree,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("modifyEstimation", 1, 5, 5, 1); __PYX_ERR(0, 569, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("modifyEstimation", 1, 5, 5, 2); __PYX_ERR(0, 569, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_est)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("modifyEstimation", 1, 5, 5, 3); __PYX_ERR(0, 569, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("modifyEstimation", 1, 5, 5, 4); __PYX_ERR(0, 569, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "modifyEstimation") < 0)) __PYX_ERR(0, 569, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_X_est = values[1];
    __pyx_v_t_est = values[2];
    __pyx_v_y_est = values[3];
    __pyx_v_tree = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("modifyEstimation", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 569, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.modifyEstimation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8modifyEstimation(__pyx_self, __pyx_v_self, __pyx_v_X_est, __pyx_v_t_est, __pyx_v_y_est, __pyx_v_tree);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8modifyEstimation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_est, PyObject *__pyx_v_t_est, PyObject *__pyx_v_y_est, PyObject *__pyx_v_tree) {
  PyObject *__pyx_v_X_l = NULL;
  PyObject *__pyx_v_X_r = NULL;
  PyObject *__pyx_v_w_l = NULL;
  PyObject *__pyx_v_w_r = NULL;
  PyObject *__pyx_v_y_l = NULL;
  PyObject *__pyx_v_y_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("modifyEstimation", 0);

  /* "causalml/inference/tree/uplift.pyx":585
 * 
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X_est, t_est, y_est, tree.col, tree.value)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":586
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X_est, t_est, y_est, tree.col, tree.value)             # <<<<<<<<<<<<<<
 * 
 *             # recursive call for each branch
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_divideSet); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_col); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_X_est, __pyx_v_t_est, __pyx_v_y_est, __pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_X_est, __pyx_v_t_est, __pyx_v_y_est, __pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X_est);
      __Pyx_GIVEREF(__pyx_v_X_est);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_X_est);
      __Pyx_INCREF(__pyx_v_t_est);
      __Pyx_GIVEREF(__pyx_v_t_est);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_t_est);
      __Pyx_INCREF(__pyx_v_y_est);
      __Pyx_GIVEREF(__pyx_v_y_est);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_y_est);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 586, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_4,&__pyx_t_9,&__pyx_t_6,&__pyx_t_5,&__pyx_t_7,&__pyx_t_10};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 586, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_4,&__pyx_t_9,&__pyx_t_6,&__pyx_t_5,&__pyx_t_7,&__pyx_t_10};
      __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 6) < 0) __PYX_ERR(0, 586, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 586, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_X_l = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_X_r = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_w_l = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_w_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_y_l = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y_r = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "causalml/inference/tree/uplift.pyx":589
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "causalml/inference/tree/uplift.pyx":590
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)             # <<<<<<<<<<<<<<
 *             if tree.falseBranch is not None:
 *                 self.modifyEstimation(X_r, w_r, y_r, tree.falseBranch)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_modifyEstimation); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_X_l, __pyx_v_w_l, __pyx_v_y_l, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_X_l, __pyx_v_w_l, __pyx_v_y_l, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 590, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_X_l);
        __Pyx_GIVEREF(__pyx_v_X_l);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_X_l);
        __Pyx_INCREF(__pyx_v_w_l);
        __Pyx_GIVEREF(__pyx_v_w_l);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_w_l);
        __Pyx_INCREF(__pyx_v_y_l);
        __Pyx_GIVEREF(__pyx_v_y_l);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_8, __pyx_v_y_l);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_8, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":589
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 */
    }

    /* "causalml/inference/tree/uplift.pyx":591
 *             if tree.trueBranch is not None:
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.modifyEstimation(X_r, w_r, y_r, tree.falseBranch)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = (__pyx_t_2 != Py_None);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "causalml/inference/tree/uplift.pyx":592
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 *                 self.modifyEstimation(X_r, w_r, y_r, tree.falseBranch)             # <<<<<<<<<<<<<<
 * 
 *         # classProb
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_modifyEstimation); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_X_r, __pyx_v_w_r, __pyx_v_y_r, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_X_r, __pyx_v_w_r, __pyx_v_y_r, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_X_r);
        __Pyx_GIVEREF(__pyx_v_X_r);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_v_X_r);
        __Pyx_INCREF(__pyx_v_w_r);
        __Pyx_GIVEREF(__pyx_v_w_r);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_v_w_r);
        __Pyx_INCREF(__pyx_v_y_r);
        __Pyx_GIVEREF(__pyx_v_y_r);
        PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_8, __pyx_v_y_r);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_8, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":591
 *             if tree.trueBranch is not None:
 *                 self.modifyEstimation(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.modifyEstimation(X_r, w_r, y_r, tree.falseBranch)
 * 
 */
    }

    /* "causalml/inference/tree/uplift.pyx":585
 * 
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X_est, t_est, y_est, tree.col, tree.value)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":595
 * 
 *         # classProb
 *         if tree.results is not None:             # <<<<<<<<<<<<<<
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":596
 *         # classProb
 *         if tree.results is not None:
 *             tree.results = self.uplift_classification_results(t_est, y_est)             # <<<<<<<<<<<<<<
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uplift_classification_results); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_t_est, __pyx_v_y_est};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_t_est, __pyx_v_y_est};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_t_est);
      __Pyx_GIVEREF(__pyx_v_t_est);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_t_est);
      __Pyx_INCREF(__pyx_v_y_est);
      __Pyx_GIVEREF(__pyx_v_y_est);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_y_est);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_results, __pyx_t_2) < 0) __PYX_ERR(0, 596, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":595
 * 
 *         # classProb
 *         if tree.results is not None:             # <<<<<<<<<<<<<<
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":569
 *         self.modifyEstimation(X_est, T_est, Y_est, self.fitted_uplift_tree)
 * 
 *     def modifyEstimation(self, X_est, t_est, y_est, tree):             # <<<<<<<<<<<<<<
 *         """ Modifies the leafs of the current decision tree to only contain unbiased estimates.
 *         Applies the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.modifyEstimation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X_l);
  __Pyx_XDECREF(__pyx_v_X_r);
  __Pyx_XDECREF(__pyx_v_w_l);
  __Pyx_XDECREF(__pyx_v_w_r);
  __Pyx_XDECREF(__pyx_v_y_l);
  __Pyx_XDECREF(__pyx_v_y_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":598
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,             # <<<<<<<<<<<<<<
 *                   n_reg=0,
 *                   parentNodeSummary=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_11pruneTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_10pruneTree[] = "Prune one single tree node in the uplift model.\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        rule : string, optional (default = 'maxAbsDiff')\n            The prune rules. Supported values are 'maxAbsDiff' for optimizing the maximum absolute difference, and\n            'bestUplift' for optimizing the node-size weighted treatment effect.\n        minGain : float, optional (default = 0.)\n            The minimum gain required to make a tree node split. The children tree branches are trimmed if the actual\n            split gain is less than the minimum gain.\n        n_reg: int, optional (default=0)\n            The regularization parameter defined in Rzepakowski et al. 2012, the weight (in terms of sample size) of the\n            parent node influence on the child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n        parentNodeSummary : list of list, optional (default = None)\n            Node summary statistics, [P(Y=1|T), N(T)] of the parent tree node.\n        Returns\n        -------\n        self : object\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_11pruneTree = {"pruneTree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_11pruneTree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_10pruneTree};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_11pruneTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_rule = 0;
  PyObject *__pyx_v_minGain = 0;
  PyObject *__pyx_v_n_reg = 0;
  PyObject *__pyx_v_parentNodeSummary = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pruneTree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_tree,&__pyx_n_s_rule,&__pyx_n_s_minGain,&__pyx_n_s_n_reg,&__pyx_n_s_parentNodeSummary,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject*)__pyx_n_u_maxAbsDiff));
    values[6] = ((PyObject *)((PyObject*)__pyx_float_0_));
    values[7] = ((PyObject *)((PyObject *)__pyx_int_0));

    /* "causalml/inference/tree/uplift.pyx":600
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,
 *                   n_reg=0,
 *                   parentNodeSummary=None):             # <<<<<<<<<<<<<<
 *         """Prune one single tree node in the uplift model.
 *         Args
 */
    values[8] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pruneTree", 0, 5, 9, 1); __PYX_ERR(0, 598, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pruneTree", 0, 5, 9, 2); __PYX_ERR(0, 598, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pruneTree", 0, 5, 9, 3); __PYX_ERR(0, 598, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pruneTree", 0, 5, 9, 4); __PYX_ERR(0, 598, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rule);
          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_minGain);
          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_n_reg);
          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_parentNodeSummary);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pruneTree") < 0)) __PYX_ERR(0, 598, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment_idx = values[2];
    __pyx_v_y = values[3];
    __pyx_v_tree = values[4];
    __pyx_v_rule = values[5];
    __pyx_v_minGain = values[6];
    __pyx_v_n_reg = values[7];
    __pyx_v_parentNodeSummary = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pruneTree", 0, 5, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 598, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.pruneTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_10pruneTree(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_tree, __pyx_v_rule, __pyx_v_minGain, __pyx_v_n_reg, __pyx_v_parentNodeSummary);

  /* "causalml/inference/tree/uplift.pyx":598
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,             # <<<<<<<<<<<<<<
 *                   n_reg=0,
 *                   parentNodeSummary=None):
 */

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_10pruneTree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_tree, PyObject *__pyx_v_rule, PyObject *__pyx_v_minGain, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary) {
  PyObject *__pyx_v_currentNodeSummary = NULL;
  PyObject *__pyx_v_X_l = NULL;
  PyObject *__pyx_v_X_r = NULL;
  PyObject *__pyx_v_w_l = NULL;
  PyObject *__pyx_v_w_r = NULL;
  PyObject *__pyx_v_y_l = NULL;
  PyObject *__pyx_v_y_r = NULL;
  PyObject *__pyx_v_currentScoreD = NULL;
  PyObject *__pyx_v_trueNodeSummary = NULL;
  PyObject *__pyx_v_trueScoreD = NULL;
  PyObject *__pyx_v_falseNodeSummary = NULL;
  PyObject *__pyx_v_falseScoreD = NULL;
  PyObject *__pyx_v_gain = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pruneTree", 0);

  /* "causalml/inference/tree/uplift.pyx":626
 *         """
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *             treatment_idx, y, min_samples_treatment=self.min_samples_treatment,
 *             n_reg=n_reg, parentNodeSummary=parentNodeSummary
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "causalml/inference/tree/uplift.pyx":627
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(
 *             treatment_idx, y, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *             n_reg=n_reg, parentNodeSummary=parentNodeSummary
 *         )
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_treatment_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_idx);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_treatment_idx);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_min_samples_treatment, __pyx_t_4) < 0) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":628
 *         currentNodeSummary = self.tree_node_summary(
 *             treatment_idx, y, min_samples_treatment=self.min_samples_treatment,
 *             n_reg=n_reg, parentNodeSummary=parentNodeSummary             # <<<<<<<<<<<<<<
 *         )
 *         tree.nodeSummary = currentNodeSummary
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 627, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parentNodeSummary, __pyx_v_parentNodeSummary) < 0) __PYX_ERR(0, 627, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":626
 *         """
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *             treatment_idx, y, min_samples_treatment=self.min_samples_treatment,
 *             n_reg=n_reg, parentNodeSummary=parentNodeSummary
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_currentNodeSummary = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":630
 *             n_reg=n_reg, parentNodeSummary=parentNodeSummary
 *         )
 *         tree.nodeSummary = currentNodeSummary             # <<<<<<<<<<<<<<
 *         # Divide sets for child nodes
 *         if (tree.trueBranch is None) or (tree.falseBranch is None):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_nodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 630, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":632
 *         tree.nodeSummary = currentNodeSummary
 *         # Divide sets for child nodes
 *         if (tree.trueBranch is None) or (tree.falseBranch is None):             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = (__pyx_t_4 == Py_None);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "causalml/inference/tree/uplift.pyx":633
 *         # Divide sets for child nodes
 *         if (tree.trueBranch is None) or (tree.falseBranch is None):
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)             # <<<<<<<<<<<<<<
 * 
 *             # recursive call for each branch
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_divideSet); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_t_2, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_t_2, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_X);
      __Pyx_INCREF(__pyx_v_treatment_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_idx);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_treatment_idx);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 633, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_11);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_10,&__pyx_t_1,&__pyx_t_2,&__pyx_t_8,&__pyx_t_11};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 633, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_10,&__pyx_t_1,&__pyx_t_2,&__pyx_t_8,&__pyx_t_11};
      __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 6) < 0) __PYX_ERR(0, 633, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 633, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_X_l = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_X_r = __pyx_t_10;
    __pyx_t_10 = 0;
    __pyx_v_w_l = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_w_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_y_l = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_y_r = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":636
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch.results is None:             # <<<<<<<<<<<<<<
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,
 *                                n_reg,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_results); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = (__pyx_t_11 == Py_None);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "causalml/inference/tree/uplift.pyx":637
 *             # recursive call for each branch
 *             if tree.trueBranch.results is None:
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,             # <<<<<<<<<<<<<<
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pruneTree); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "causalml/inference/tree/uplift.pyx":638
 *             if tree.trueBranch.results is None:
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,
 *                                n_reg,             # <<<<<<<<<<<<<<
 *                                parentNodeSummary=currentNodeSummary)
 *             if tree.falseBranch.results is None:
 */
      __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_X_l);
      __Pyx_GIVEREF(__pyx_v_X_l);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_X_l);
      __Pyx_INCREF(__pyx_v_w_l);
      __Pyx_GIVEREF(__pyx_v_w_l);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_w_l);
      __Pyx_INCREF(__pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_v_y_l);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rule);
      __Pyx_GIVEREF(__pyx_v_rule);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_rule);
      __Pyx_INCREF(__pyx_v_minGain);
      __Pyx_GIVEREF(__pyx_v_minGain);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_minGain);
      __Pyx_INCREF(__pyx_v_n_reg);
      __Pyx_GIVEREF(__pyx_v_n_reg);
      PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_v_n_reg);
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":639
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)             # <<<<<<<<<<<<<<
 *             if tree.falseBranch.results is None:
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,
 */
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 639, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":637
 *             # recursive call for each branch
 *             if tree.trueBranch.results is None:
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,             # <<<<<<<<<<<<<<
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":636
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch.results is None:             # <<<<<<<<<<<<<<
 *                 self.pruneTree(X_l, w_l, y_l, tree.trueBranch, rule, minGain,
 *                                n_reg,
 */
    }

    /* "causalml/inference/tree/uplift.pyx":640
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 *             if tree.falseBranch.results is None:             # <<<<<<<<<<<<<<
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,
 *                                n_reg,
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_results); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = (__pyx_t_4 == Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = (__pyx_t_6 != 0);
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":641
 *                                parentNodeSummary=currentNodeSummary)
 *             if tree.falseBranch.results is None:
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,             # <<<<<<<<<<<<<<
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pruneTree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "causalml/inference/tree/uplift.pyx":642
 *             if tree.falseBranch.results is None:
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,
 *                                n_reg,             # <<<<<<<<<<<<<<
 *                                parentNodeSummary=currentNodeSummary)
 * 
 */
      __pyx_t_8 = PyTuple_New(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_X_r);
      __Pyx_GIVEREF(__pyx_v_X_r);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_X_r);
      __Pyx_INCREF(__pyx_v_w_r);
      __Pyx_GIVEREF(__pyx_v_w_r);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_w_r);
      __Pyx_INCREF(__pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_v_y_r);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2);
      __Pyx_INCREF(__pyx_v_rule);
      __Pyx_GIVEREF(__pyx_v_rule);
      PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_rule);
      __Pyx_INCREF(__pyx_v_minGain);
      __Pyx_GIVEREF(__pyx_v_minGain);
      PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_minGain);
      __Pyx_INCREF(__pyx_v_n_reg);
      __Pyx_GIVEREF(__pyx_v_n_reg);
      PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_v_n_reg);
      __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":643
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)             # <<<<<<<<<<<<<<
 * 
 *         # merge leaves (potentially)
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 643, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":641
 *                                parentNodeSummary=currentNodeSummary)
 *             if tree.falseBranch.results is None:
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,             # <<<<<<<<<<<<<<
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 */
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":640
 *                                n_reg,
 *                                parentNodeSummary=currentNodeSummary)
 *             if tree.falseBranch.results is None:             # <<<<<<<<<<<<<<
 *                 self.pruneTree(X_r, w_r, y_r, tree.falseBranch, rule, minGain,
 *                                n_reg,
 */
    }

    /* "causalml/inference/tree/uplift.pyx":632
 *         tree.nodeSummary = currentNodeSummary
 *         # Divide sets for child nodes
 *         if (tree.trueBranch is None) or (tree.falseBranch is None):             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":646
 * 
 *         # merge leaves (potentially)
 *         if (tree.trueBranch.results is not None and             # <<<<<<<<<<<<<<
 *             tree.falseBranch.results is not None):
 *             if rule == 'maxAbsDiff':
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_6 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L11_bool_binop_done;
  }

  /* "causalml/inference/tree/uplift.pyx":647
 *         # merge leaves (potentially)
 *         if (tree.trueBranch.results is not None and
 *             tree.falseBranch.results is not None):             # <<<<<<<<<<<<<<
 *             if rule == 'maxAbsDiff':
 *                 # Current D
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_results); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = (__pyx_t_11 != Py_None);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_6 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L11_bool_binop_done:;

  /* "causalml/inference/tree/uplift.pyx":646
 * 
 *         # merge leaves (potentially)
 *         if (tree.trueBranch.results is not None and             # <<<<<<<<<<<<<<
 *             tree.falseBranch.results is not None):
 *             if rule == 'maxAbsDiff':
 */
  if (__pyx_t_5) {

    /* "causalml/inference/tree/uplift.pyx":648
 *         if (tree.trueBranch.results is not None and
 *             tree.falseBranch.results is not None):
 *             if rule == 'maxAbsDiff':             # <<<<<<<<<<<<<<
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_rule, __pyx_n_u_maxAbsDiff, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 648, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":650
 *             if rule == 'maxAbsDiff':
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_currentNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 650, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L15_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":651
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and
 *                     self.control_name in currentNodeSummary):             # <<<<<<<<<<<<<<
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]
 *                                                         - currentNodeSummary[self.control_name][0])
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_currentNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L15_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":650
 *             if rule == 'maxAbsDiff':
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":652
 *                 if (tree.maxDiffTreatment in currentNodeSummary and
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]             # <<<<<<<<<<<<<<
 *                                                         - currentNodeSummary[self.control_name][0])
 *                 else:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_maxDiffSign); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":653
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]
 *                                                         - currentNodeSummary[self.control_name][0])             # <<<<<<<<<<<<<<
 *                 else:
 *                     currentScoreD = 0
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 653, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 653, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":652
 *                 if (tree.maxDiffTreatment in currentNodeSummary and
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]             # <<<<<<<<<<<<<<
 *                                                         - currentNodeSummary[self.control_name][0])
 *                 else:
 */
        __pyx_t_8 = PyNumber_Multiply(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_currentScoreD = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":650
 *             if rule == 'maxAbsDiff':
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = tree.maxDiffSign * (currentNodeSummary[tree.maxDiffTreatment][0]
 */
        goto __pyx_L14;
      }

      /* "causalml/inference/tree/uplift.pyx":655
 *                                                         - currentNodeSummary[self.control_name][0])
 *                 else:
 *                     currentScoreD = 0             # <<<<<<<<<<<<<<
 * 
 *                 # trueBranch D
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_currentScoreD = __pyx_int_0;
      }
      __pyx_L14:;

      /* "causalml/inference/tree/uplift.pyx":658
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);

      /* "causalml/inference/tree/uplift.pyx":659
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      if (unlikely(!__pyx_v_w_l)) { __Pyx_RaiseUnboundLocalError("w_l"); __PYX_ERR(0, 659, __pyx_L1_error) }
      if (unlikely(!__pyx_v_y_l)) { __Pyx_RaiseUnboundLocalError("y_l"); __PYX_ERR(0, 659, __pyx_L1_error) }

      /* "causalml/inference/tree/uplift.pyx":658
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_w_l);
      __Pyx_GIVEREF(__pyx_v_w_l);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w_l);
      __Pyx_INCREF(__pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_v_y_l);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y_l);

      /* "causalml/inference/tree/uplift.pyx":659
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_min_samples_treatment, __pyx_t_2) < 0) __PYX_ERR(0, 659, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":660
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary             # <<<<<<<<<<<<<<
 *                 )
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and
 */
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 659, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 659, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":658
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_v_trueNodeSummary = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":662
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_trueNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L18_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":663
 *                 )
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and
 *                     self.control_name in trueNodeSummary):             # <<<<<<<<<<<<<<
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]
 *                                                                 - trueNodeSummary[self.control_name][0])
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_trueNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L18_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":662
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":664
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]             # <<<<<<<<<<<<<<
 *                                                                 - trueNodeSummary[self.control_name][0])
 *                     trueScoreD = (
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffSign); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":665
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]
 *                                                                 - trueNodeSummary[self.control_name][0])             # <<<<<<<<<<<<<<
 *                     trueScoreD = (
 *                         trueScoreD
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_Subtract(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":664
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]             # <<<<<<<<<<<<<<
 *                                                                 - trueNodeSummary[self.control_name][0])
 *                     trueScoreD = (
 */
        __pyx_t_11 = PyNumber_Multiply(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_trueScoreD = __pyx_t_11;
        __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":668
 *                     trueScoreD = (
 *                         trueScoreD
 *                         * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                          + trueNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":669
 *                         trueScoreD
 *                         * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 *                          + trueNodeSummary[self.control_name][1])             # <<<<<<<<<<<<<<
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 *                            + currentNodeSummary[self.control_name][1])
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":668
 *                     trueScoreD = (
 *                         trueScoreD
 *                         * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                          + trueNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 */
        __pyx_t_11 = PyNumber_Multiply(__pyx_v_trueScoreD, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":670
 *                         * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 *                          + trueNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                            + currentNodeSummary[self.control_name][1])
 *                     )
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":671
 *                          + trueNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 *                            + currentNodeSummary[self.control_name][1])             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":670
 *                         * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][1]
 *                          + trueNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.trueBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                            + currentNodeSummary[self.control_name][1])
 *                     )
 */
        __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_trueScoreD, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":662
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.maxDiffTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = tree.trueBranch.maxDiffSign * (trueNodeSummary[tree.trueBranch.maxDiffTreatment][0]
 */
        goto __pyx_L17;
      }

      /* "causalml/inference/tree/uplift.pyx":674
 *                     )
 *                 else:
 *                     trueScoreD = 0             # <<<<<<<<<<<<<<
 * 
 *                 # falseBranch D
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_trueScoreD = __pyx_int_0;
      }
      __pyx_L17:;

      /* "causalml/inference/tree/uplift.pyx":677
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "causalml/inference/tree/uplift.pyx":678
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      if (unlikely(!__pyx_v_w_r)) { __Pyx_RaiseUnboundLocalError("w_r"); __PYX_ERR(0, 678, __pyx_L1_error) }
      if (unlikely(!__pyx_v_y_r)) { __Pyx_RaiseUnboundLocalError("y_r"); __PYX_ERR(0, 678, __pyx_L1_error) }

      /* "causalml/inference/tree/uplift.pyx":677
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_w_r);
      __Pyx_GIVEREF(__pyx_v_w_r);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w_r);
      __Pyx_INCREF(__pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_v_y_r);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y_r);

      /* "causalml/inference/tree/uplift.pyx":678
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_min_samples_treatment, __pyx_t_8) < 0) __PYX_ERR(0, 678, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "causalml/inference/tree/uplift.pyx":679
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary             # <<<<<<<<<<<<<<
 *                 )
 *                 if (tree.falseBranch.maxDiffTreatment in falseNodeSummary and
 */
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 678, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 678, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":677
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_v_falseNodeSummary = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "causalml/inference/tree/uplift.pyx":681
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.maxDiffTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_falseNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 681, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L21_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":682
 *                 )
 *                 if (tree.falseBranch.maxDiffTreatment in falseNodeSummary and
 *                     self.control_name in falseNodeSummary):             # <<<<<<<<<<<<<<
 *                     falseScoreD = (
 *                         tree.falseBranch.maxDiffSign *
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_11, __pyx_v_falseNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L21_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":681
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.maxDiffTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":684
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 *                         tree.falseBranch.maxDiffSign *             # <<<<<<<<<<<<<<
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][0]
 *                          - falseNodeSummary[self.control_name][0])
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffSign); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":685
 *                     falseScoreD = (
 *                         tree.falseBranch.maxDiffSign *
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][0]             # <<<<<<<<<<<<<<
 *                          - falseNodeSummary[self.control_name][0])
 *                     )
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":686
 *                         tree.falseBranch.maxDiffSign *
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][0]
 *                          - falseNodeSummary[self.control_name][0])             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 686, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 686, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":684
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 *                         tree.falseBranch.maxDiffSign *             # <<<<<<<<<<<<<<
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][0]
 *                          - falseNodeSummary[self.control_name][0])
 */
        __pyx_t_11 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_falseScoreD = __pyx_t_11;
        __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":691
 *                     falseScoreD = (
 *                         falseScoreD *
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                          + falseNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":692
 *                         falseScoreD *
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                          + falseNodeSummary[self.control_name][1])             # <<<<<<<<<<<<<<
 *                         / (currentNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                            + currentNodeSummary[self.control_name][1])
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 692, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 692, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 692, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 692, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":690
 * 
 *                     falseScoreD = (
 *                         falseScoreD *             # <<<<<<<<<<<<<<
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                          + falseNodeSummary[self.control_name][1])
 */
        __pyx_t_11 = PyNumber_Multiply(__pyx_v_falseScoreD, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 690, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":693
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                          + falseNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.falseBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                            + currentNodeSummary[self.control_name][1])
 *                     )
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_maxDiffTreatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":694
 *                          + falseNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                            + currentNodeSummary[self.control_name][1])             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":693
 *                         (falseNodeSummary[tree.falseBranch.maxDiffTreatment][1]
 *                          + falseNodeSummary[self.control_name][1])
 *                         / (currentNodeSummary[tree.falseBranch.maxDiffTreatment][1]             # <<<<<<<<<<<<<<
 *                            + currentNodeSummary[self.control_name][1])
 *                     )
 */
        __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_falseScoreD, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":681
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.maxDiffTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
        goto __pyx_L20;
      }

      /* "causalml/inference/tree/uplift.pyx":697
 *                     )
 *                 else:
 *                     falseScoreD = 0             # <<<<<<<<<<<<<<
 * 
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_falseScoreD = __pyx_int_0;
      }
      __pyx_L20:;

      /* "causalml/inference/tree/uplift.pyx":699
 *                     falseScoreD = 0
 * 
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or             # <<<<<<<<<<<<<<
 *                     (trueScoreD + falseScoreD < 0.)):
 *                     tree.trueBranch, tree.falseBranch = None, None
 */
      __pyx_t_8 = PyNumber_Add(__pyx_v_trueScoreD, __pyx_v_falseScoreD); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyNumber_Subtract(__pyx_t_8, __pyx_v_currentScoreD); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_v_minGain, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!__pyx_t_6) {
      } else {
        __pyx_t_5 = __pyx_t_6;
        goto __pyx_L24_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":700
 * 
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or
 *                     (trueScoreD + falseScoreD < 0.)):             # <<<<<<<<<<<<<<
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults
 */
      __pyx_t_8 = PyNumber_Add(__pyx_v_trueScoreD, __pyx_v_falseScoreD); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_float_0_, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __pyx_t_6;
      __pyx_L24_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":699
 *                     falseScoreD = 0
 * 
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or             # <<<<<<<<<<<<<<
 *                     (trueScoreD + falseScoreD < 0.)):
 *                     tree.trueBranch, tree.falseBranch = None, None
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":701
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or
 *                     (trueScoreD + falseScoreD < 0.)):
 *                     tree.trueBranch, tree.falseBranch = None, None             # <<<<<<<<<<<<<<
 *                     tree.results = tree.backupResults
 * 
 */
        __pyx_t_4 = Py_None;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_8 = Py_None;
        __Pyx_INCREF(__pyx_t_8);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch, __pyx_t_4) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch, __pyx_t_8) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":702
 *                     (trueScoreD + falseScoreD < 0.)):
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults             # <<<<<<<<<<<<<<
 * 
 *             elif rule == 'bestUplift':
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_backupResults); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_results, __pyx_t_8) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":699
 *                     falseScoreD = 0
 * 
 *                 if ((trueScoreD + falseScoreD) - currentScoreD <= minGain or             # <<<<<<<<<<<<<<
 *                     (trueScoreD + falseScoreD < 0.)):
 *                     tree.trueBranch, tree.falseBranch = None, None
 */
      }

      /* "causalml/inference/tree/uplift.pyx":648
 *         if (tree.trueBranch.results is not None and
 *             tree.falseBranch.results is not None):
 *             if rule == 'maxAbsDiff':             # <<<<<<<<<<<<<<
 *                 # Current D
 *                 if (tree.maxDiffTreatment in currentNodeSummary and
 */
      goto __pyx_L13;
    }

    /* "causalml/inference/tree/uplift.pyx":704
 *                     tree.results = tree.backupResults
 * 
 *             elif rule == 'bestUplift':             # <<<<<<<<<<<<<<
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_rule, __pyx_n_u_bestUplift, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":706
 *             elif rule == 'bestUplift':
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = (
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 706, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_8, __pyx_v_currentNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 706, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L27_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":707
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and
 *                     self.control_name in currentNodeSummary):             # <<<<<<<<<<<<<<
 *                     currentScoreD = (
 *                         currentNodeSummary[tree.bestTreatment][0]
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 707, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_8, __pyx_v_currentNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 707, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L27_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":706
 *             elif rule == 'bestUplift':
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = (
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":709
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = (
 *                         currentNodeSummary[tree.bestTreatment][0]             # <<<<<<<<<<<<<<
 *                         - currentNodeSummary[self.control_name][0]
 *                     )
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 709, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 709, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "causalml/inference/tree/uplift.pyx":710
 *                     currentScoreD = (
 *                         currentNodeSummary[tree.bestTreatment][0]
 *                         - currentNodeSummary[self.control_name][0]             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 710, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyNumber_Subtract(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 710, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_currentScoreD = __pyx_t_11;
        __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":706
 *             elif rule == 'bestUplift':
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in currentNodeSummary):
 *                     currentScoreD = (
 */
        goto __pyx_L26;
      }

      /* "causalml/inference/tree/uplift.pyx":713
 *                     )
 *                 else:
 *                     currentScoreD = 0             # <<<<<<<<<<<<<<
 * 
 *                 # trueBranch D
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_currentScoreD = __pyx_int_0;
      }
      __pyx_L26:;

      /* "causalml/inference/tree/uplift.pyx":716
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);

      /* "causalml/inference/tree/uplift.pyx":717
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      if (unlikely(!__pyx_v_w_l)) { __Pyx_RaiseUnboundLocalError("w_l"); __PYX_ERR(0, 717, __pyx_L1_error) }
      if (unlikely(!__pyx_v_y_l)) { __Pyx_RaiseUnboundLocalError("y_l"); __PYX_ERR(0, 717, __pyx_L1_error) }

      /* "causalml/inference/tree/uplift.pyx":716
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_w_l);
      __Pyx_GIVEREF(__pyx_v_w_l);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w_l);
      __Pyx_INCREF(__pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_v_y_l);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y_l);

      /* "causalml/inference/tree/uplift.pyx":717
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      __pyx_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_min_samples_treatment, __pyx_t_2) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":718
 *                 trueNodeSummary = self.tree_node_summary(
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary             # <<<<<<<<<<<<<<
 *                 )
 *                 if (tree.trueBranch.bestTreatment in trueNodeSummary and
 */
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 717, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":716
 * 
 *                 # trueBranch D
 *                 trueNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_l, y_l, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_trueNodeSummary = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "causalml/inference/tree/uplift.pyx":720
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.bestTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = (
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_8, __pyx_v_trueNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 720, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L30_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":721
 *                 )
 *                 if (tree.trueBranch.bestTreatment in trueNodeSummary and
 *                     self.control_name in trueNodeSummary):             # <<<<<<<<<<<<<<
 *                     trueScoreD = (
 *                         trueNodeSummary[tree.trueBranch.bestTreatment][0]
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_8, __pyx_v_trueNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L30_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":720
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.bestTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = (
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":723
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = (
 *                         trueNodeSummary[tree.trueBranch.bestTreatment][0]             # <<<<<<<<<<<<<<
 *                         - trueNodeSummary[self.control_name][0]
 *                     )
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":724
 *                     trueScoreD = (
 *                         trueNodeSummary[tree.trueBranch.bestTreatment][0]
 *                         - trueNodeSummary[self.control_name][0]             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_trueNodeSummary, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_trueScoreD = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "causalml/inference/tree/uplift.pyx":720
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.trueBranch.bestTreatment in trueNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in trueNodeSummary):
 *                     trueScoreD = (
 */
        goto __pyx_L29;
      }

      /* "causalml/inference/tree/uplift.pyx":727
 *                     )
 *                 else:
 *                     trueScoreD = 0             # <<<<<<<<<<<<<<
 * 
 *                 # falseBranch D
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_trueScoreD = __pyx_int_0;
      }
      __pyx_L29:;

      /* "causalml/inference/tree/uplift.pyx":730
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

      /* "causalml/inference/tree/uplift.pyx":731
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      if (unlikely(!__pyx_v_w_r)) { __Pyx_RaiseUnboundLocalError("w_r"); __PYX_ERR(0, 731, __pyx_L1_error) }
      if (unlikely(!__pyx_v_y_r)) { __Pyx_RaiseUnboundLocalError("y_r"); __PYX_ERR(0, 731, __pyx_L1_error) }

      /* "causalml/inference/tree/uplift.pyx":730
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_w_r);
      __Pyx_GIVEREF(__pyx_v_w_r);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_w_r);
      __Pyx_INCREF(__pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_v_y_r);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_y_r);

      /* "causalml/inference/tree/uplift.pyx":731
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 */
      __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_min_samples_treatment, __pyx_t_11) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":732
 *                 falseNodeSummary = self.tree_node_summary(
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary             # <<<<<<<<<<<<<<
 *                 )
 *                 if (tree.falseBranch.bestTreatment in falseNodeSummary and
 */
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 731, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parentNodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 731, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":730
 * 
 *                 # falseBranch D
 *                 falseNodeSummary = self.tree_node_summary(             # <<<<<<<<<<<<<<
 *                     w_r, y_r, min_samples_treatment=self.min_samples_treatment,
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 */
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_falseNodeSummary = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":734
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.bestTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_falseNodeSummary, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 734, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_5 = __pyx_t_7;
        goto __pyx_L33_bool_binop_done;
      }

      /* "causalml/inference/tree/uplift.pyx":735
 *                 )
 *                 if (tree.falseBranch.bestTreatment in falseNodeSummary and
 *                     self.control_name in falseNodeSummary):             # <<<<<<<<<<<<<<
 *                     falseScoreD = (
 *                         falseNodeSummary[tree.falseBranch.bestTreatment][0]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_falseNodeSummary, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 735, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_5 = __pyx_t_6;
      __pyx_L33_bool_binop_done:;

      /* "causalml/inference/tree/uplift.pyx":734
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.bestTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":737
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 *                         falseNodeSummary[tree.falseBranch.bestTreatment][0]             # <<<<<<<<<<<<<<
 *                         - falseNodeSummary[self.control_name][0]
 *                     )
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "causalml/inference/tree/uplift.pyx":738
 *                     falseScoreD = (
 *                         falseNodeSummary[tree.falseBranch.bestTreatment][0]
 *                         - falseNodeSummary[self.control_name][0]             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_falseNodeSummary, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 738, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_Subtract(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 738, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_falseScoreD = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "causalml/inference/tree/uplift.pyx":734
 *                     n_reg=n_reg, parentNodeSummary=currentNodeSummary
 *                 )
 *                 if (tree.falseBranch.bestTreatment in falseNodeSummary and             # <<<<<<<<<<<<<<
 *                     self.control_name in falseNodeSummary):
 *                     falseScoreD = (
 */
        goto __pyx_L32;
      }

      /* "causalml/inference/tree/uplift.pyx":741
 *                     )
 *                 else:
 *                     falseScoreD = 0             # <<<<<<<<<<<<<<
 *                 gain = ((1. * len(y_l) / len(y) * trueScoreD
 *                          + 1. * len(y_r) / len(y) * falseScoreD)
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_int_0);
        __pyx_v_falseScoreD = __pyx_int_0;
      }
      __pyx_L32:;

      /* "causalml/inference/tree/uplift.pyx":742
 *                 else:
 *                     falseScoreD = 0
 *                 gain = ((1. * len(y_l) / len(y) * trueScoreD             # <<<<<<<<<<<<<<
 *                          + 1. * len(y_r) / len(y) * falseScoreD)
 *                         - currentScoreD)
 */
      if (unlikely(!__pyx_v_y_l)) { __Pyx_RaiseUnboundLocalError("y_l"); __PYX_ERR(0, 742, __pyx_L1_error) }
      __pyx_t_14 = PyObject_Length(__pyx_v_y_l); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 742, __pyx_L1_error)
      __pyx_t_15 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 742, __pyx_L1_error)
      __pyx_t_8 = PyFloat_FromDouble(((1. * __pyx_t_14) / ((double)__pyx_t_15))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_v_trueScoreD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "causalml/inference/tree/uplift.pyx":743
 *                     falseScoreD = 0
 *                 gain = ((1. * len(y_l) / len(y) * trueScoreD
 *                          + 1. * len(y_r) / len(y) * falseScoreD)             # <<<<<<<<<<<<<<
 *                         - currentScoreD)
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):
 */
      if (unlikely(!__pyx_v_y_r)) { __Pyx_RaiseUnboundLocalError("y_r"); __PYX_ERR(0, 743, __pyx_L1_error) }
      __pyx_t_15 = PyObject_Length(__pyx_v_y_r); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 743, __pyx_L1_error)
      __pyx_t_14 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 743, __pyx_L1_error)
      __pyx_t_8 = PyFloat_FromDouble(((1. * __pyx_t_15) / ((double)__pyx_t_14))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 743, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = PyNumber_Multiply(__pyx_t_8, __pyx_v_falseScoreD); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 743, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 743, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":744
 *                 gain = ((1. * len(y_l) / len(y) * trueScoreD
 *                          + 1. * len(y_r) / len(y) * falseScoreD)
 *                         - currentScoreD)             # <<<<<<<<<<<<<<
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):
 *                     tree.trueBranch, tree.falseBranch = None, None
 */
      __pyx_t_11 = PyNumber_Subtract(__pyx_t_8, __pyx_v_currentScoreD); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 744, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_gain = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "causalml/inference/tree/uplift.pyx":745
 *                          + 1. * len(y_r) / len(y) * falseScoreD)
 *                         - currentScoreD)
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):             # <<<<<<<<<<<<<<
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults
 */
      __pyx_t_11 = PyObject_RichCompare(__pyx_v_gain, __pyx_v_minGain, Py_LE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 745, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 745, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!__pyx_t_6) {
      } else {
        __pyx_t_5 = __pyx_t_6;
        goto __pyx_L36_bool_binop_done;
      }
      __pyx_t_11 = PyNumber_Add(__pyx_v_trueScoreD, __pyx_v_falseScoreD); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_11, __pyx_float_0_, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 745, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 745, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_5 = __pyx_t_6;
      __pyx_L36_bool_binop_done:;
      if (__pyx_t_5) {

        /* "causalml/inference/tree/uplift.pyx":746
 *                         - currentScoreD)
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):
 *                     tree.trueBranch, tree.falseBranch = None, None             # <<<<<<<<<<<<<<
 *                     tree.results = tree.backupResults
 *         return self
 */
        __pyx_t_8 = Py_None;
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_11 = Py_None;
        __Pyx_INCREF(__pyx_t_11);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch, __pyx_t_8) < 0) __PYX_ERR(0, 746, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch, __pyx_t_11) < 0) __PYX_ERR(0, 746, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":747
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_backupResults); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 747, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_results, __pyx_t_11) < 0) __PYX_ERR(0, 747, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":745
 *                          + 1. * len(y_r) / len(y) * falseScoreD)
 *                         - currentScoreD)
 *                 if gain <= minGain or (trueScoreD + falseScoreD < 0.):             # <<<<<<<<<<<<<<
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults
 */
      }

      /* "causalml/inference/tree/uplift.pyx":704
 *                     tree.results = tree.backupResults
 * 
 *             elif rule == 'bestUplift':             # <<<<<<<<<<<<<<
 *                 # Current D
 *                 if (tree.bestTreatment in currentNodeSummary and
 */
    }
    __pyx_L13:;

    /* "causalml/inference/tree/uplift.pyx":646
 * 
 *         # merge leaves (potentially)
 *         if (tree.trueBranch.results is not None and             # <<<<<<<<<<<<<<
 *             tree.falseBranch.results is not None):
 *             if rule == 'maxAbsDiff':
 */
  }

  /* "causalml/inference/tree/uplift.pyx":748
 *                     tree.trueBranch, tree.falseBranch = None, None
 *                     tree.results = tree.backupResults
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def fill(self, X, treatment, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":598
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,             # <<<<<<<<<<<<<<
 *                   n_reg=0,
 *                   parentNodeSummary=None):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.pruneTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_currentNodeSummary);
  __Pyx_XDECREF(__pyx_v_X_l);
  __Pyx_XDECREF(__pyx_v_X_r);
  __Pyx_XDECREF(__pyx_v_w_l);
  __Pyx_XDECREF(__pyx_v_w_r);
  __Pyx_XDECREF(__pyx_v_y_l);
  __Pyx_XDECREF(__pyx_v_y_r);
  __Pyx_XDECREF(__pyx_v_currentScoreD);
  __Pyx_XDECREF(__pyx_v_trueNodeSummary);
  __Pyx_XDECREF(__pyx_v_trueScoreD);
  __Pyx_XDECREF(__pyx_v_falseNodeSummary);
  __Pyx_XDECREF(__pyx_v_falseScoreD);
  __Pyx_XDECREF(__pyx_v_gain);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":750
 *         return self
 * 
 *     def fill(self, X, treatment, y):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a higher-level function to transform the original data inputs
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_13fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_12fill[] = " Fill the data into an existing tree.\n        This is a higher-level function to transform the original data inputs\n        into lower level data inputs (list of list and tree).\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment : array-like, shape = [num_samples]\n            An array containing the treatment group for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n\n        Returns\n        -------\n        self : object\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_13fill = {"fill", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_13fill, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_12fill};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_13fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fill (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment,&__pyx_n_s_y,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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fill", 1, 4, 4, 1); __PYX_ERR(0, 750, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fill", 1, 4, 4, 2); __PYX_ERR(0, 750, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fill", 1, 4, 4, 3); __PYX_ERR(0, 750, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill") < 0)) __PYX_ERR(0, 750, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment = values[2];
    __pyx_v_y = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fill", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 750, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_12fill(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment, __pyx_v_y);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_12fill(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_treatment_idx = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_tr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fill", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment);
  __Pyx_INCREF(__pyx_v_y);

  /* "causalml/inference/tree/uplift.pyx":769
 *         """
 * 
 *         X, y = check_X_y(X, y)             # <<<<<<<<<<<<<<
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_X_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 769, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 769, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 769, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":770
 * 
 *         X, y = check_X_y(X, y)
 *         treatment = np.asarray(treatment)             # <<<<<<<<<<<<<<
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_treatment) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_treatment);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_treatment, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":771
 *         X, y = check_X_y(X, y)
 *         treatment = np.asarray(treatment)
 *         assert len(y) == len(treatment), 'Data length must be equal for X, treatment, and y.'             # <<<<<<<<<<<<<<
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_7 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 771, __pyx_L1_error)
    __pyx_t_8 = PyObject_Length(__pyx_v_treatment); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 771, __pyx_L1_error)
    if (unlikely(!((__pyx_t_7 == __pyx_t_8) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_Data_length_must_be_equal_for_X);
      __PYX_ERR(0, 771, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":774
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)             # <<<<<<<<<<<<<<
 *         for i, tr in enumerate(self.classes_[1:], 1):
 *             treatment_idx[treatment == tr] = i
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_treatment) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_treatment);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_treatment_idx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":775
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 * 
 */
  __Pyx_INCREF(__pyx_int_1);
  __pyx_t_1 = __pyx_int_1;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_5, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 775, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 775, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 775, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_9(__pyx_t_5);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 775, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_tr, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":776
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):
 *             treatment_idx[treatment == tr] = i             # <<<<<<<<<<<<<<
 * 
 *         self.fillTree(X, treatment_idx, y, tree=self.fitted_uplift_tree)
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_treatment, __pyx_v_tr, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error)
    if (unlikely(PyObject_SetItem(__pyx_v_treatment_idx, __pyx_t_2, __pyx_v_i) < 0)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":775
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":778
 *             treatment_idx[treatment == tr] = i
 * 
 *         self.fillTree(X, treatment_idx, y, tree=self.fitted_uplift_tree)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fillTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_GIVEREF(__pyx_v_X);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_X);
  __Pyx_INCREF(__pyx_v_treatment_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_idx);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_treatment_idx);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_y);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tree, __pyx_t_3) < 0) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":779
 * 
 *         self.fillTree(X, treatment_idx, y, tree=self.fitted_uplift_tree)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def fillTree(self, X, treatment_idx, y, tree):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":750
 *         return self
 * 
 *     def fill(self, X, treatment, y):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a higher-level function to transform the original data inputs
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_treatment_idx);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_tr);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_treatment);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":781
 *         return self
 * 
 *     def fillTree(self, X, treatment_idx, y, tree):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a lower-level function to execute on the tree filling task.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_15fillTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_14fillTree[] = " Fill the data into an existing tree.\n        This is a lower-level function to execute on the tree filling task.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        tree : object\n            object of DecisionTree class\n\n        Returns\n        -------\n        self : object\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_15fillTree = {"fillTree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_15fillTree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_14fillTree};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_15fillTree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fillTree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_tree,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fillTree", 1, 5, 5, 1); __PYX_ERR(0, 781, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fillTree", 1, 5, 5, 2); __PYX_ERR(0, 781, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fillTree", 1, 5, 5, 3); __PYX_ERR(0, 781, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fillTree", 1, 5, 5, 4); __PYX_ERR(0, 781, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fillTree") < 0)) __PYX_ERR(0, 781, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment_idx = values[2];
    __pyx_v_y = values[3];
    __pyx_v_tree = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fillTree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 781, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fillTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_14fillTree(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_tree);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_14fillTree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_tree) {
  PyObject *__pyx_v_currentNodeSummary = NULL;
  PyObject *__pyx_v_X_l = NULL;
  PyObject *__pyx_v_X_r = NULL;
  PyObject *__pyx_v_w_l = NULL;
  PyObject *__pyx_v_w_r = NULL;
  PyObject *__pyx_v_y_l = NULL;
  PyObject *__pyx_v_y_r = NULL;
  PyObject *__pyx_v_matchScore = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_v_summary = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fillTree", 0);

  /* "causalml/inference/tree/uplift.pyx":801
 *         """
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(treatment_idx, y,             # <<<<<<<<<<<<<<
 *                                                     min_samples_treatment=0,
 *                                                     n_reg=0,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_treatment_idx);
  __Pyx_GIVEREF(__pyx_v_treatment_idx);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_treatment_idx);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);

  /* "causalml/inference/tree/uplift.pyx":802
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(treatment_idx, y,
 *                                                     min_samples_treatment=0,             # <<<<<<<<<<<<<<
 *                                                     n_reg=0,
 *                                                     parentNodeSummary=None)
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_min_samples_treatment, __pyx_int_0) < 0) __PYX_ERR(0, 802, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_reg, __pyx_int_0) < 0) __PYX_ERR(0, 802, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":804
 *                                                     min_samples_treatment=0,
 *                                                     n_reg=0,
 *                                                     parentNodeSummary=None)             # <<<<<<<<<<<<<<
 *         tree.nodeSummary = currentNodeSummary
 * 
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_parentNodeSummary, Py_None) < 0) __PYX_ERR(0, 802, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":801
 *         """
 *         # Current Node Summary for Validation Data Set
 *         currentNodeSummary = self.tree_node_summary(treatment_idx, y,             # <<<<<<<<<<<<<<
 *                                                     min_samples_treatment=0,
 *                                                     n_reg=0,
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_currentNodeSummary = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":805
 *                                                     n_reg=0,
 *                                                     parentNodeSummary=None)
 *         tree.nodeSummary = currentNodeSummary             # <<<<<<<<<<<<<<
 * 
 *         # Divide sets for child nodes
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_nodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 805, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":808
 * 
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "causalml/inference/tree/uplift.pyx":809
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)             # <<<<<<<<<<<<<<
 * 
 *             # recursive call for each branch
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_divideSet); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_t_2, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_t_2, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_X);
      __Pyx_INCREF(__pyx_v_treatment_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_idx);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_treatment_idx);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 809, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_9,&__pyx_t_1,&__pyx_t_2,&__pyx_t_7,&__pyx_t_10};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 809, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_9,&__pyx_t_1,&__pyx_t_2,&__pyx_t_7,&__pyx_t_10};
      __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 6) < 0) __PYX_ERR(0, 809, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 809, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __pyx_v_X_l = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_X_r = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_w_l = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_w_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_y_l = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y_r = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "causalml/inference/tree/uplift.pyx":812
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = (__pyx_t_4 != Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "causalml/inference/tree/uplift.pyx":813
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)             # <<<<<<<<<<<<<<
 *             if tree.falseBranch is not None:
 *                 self.fillTree(X_r, w_r, y_r, tree.falseBranch)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fillTree); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_X_l, __pyx_v_w_l, __pyx_v_y_l, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_v_X_l, __pyx_v_w_l, __pyx_v_y_l, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_X_l);
        __Pyx_GIVEREF(__pyx_v_X_l);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_8, __pyx_v_X_l);
        __Pyx_INCREF(__pyx_v_w_l);
        __Pyx_GIVEREF(__pyx_v_w_l);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_8, __pyx_v_w_l);
        __Pyx_INCREF(__pyx_v_y_l);
        __Pyx_GIVEREF(__pyx_v_y_l);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_8, __pyx_v_y_l);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_1, 3+__pyx_t_8, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":812
 * 
 *             # recursive call for each branch
 *             if tree.trueBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 */
    }

    /* "causalml/inference/tree/uplift.pyx":814
 *             if tree.trueBranch is not None:
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.fillTree(X_r, w_r, y_r, tree.falseBranch)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 814, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = (__pyx_t_4 != Py_None);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = (__pyx_t_6 != 0);
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":815
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:
 *                 self.fillTree(X_r, w_r, y_r, tree.falseBranch)             # <<<<<<<<<<<<<<
 * 
 *         # Update Information
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fillTree); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_X_r, __pyx_v_w_r, __pyx_v_y_r, __pyx_t_1};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_X_r, __pyx_v_w_r, __pyx_v_y_r, __pyx_t_1};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_X_r);
        __Pyx_GIVEREF(__pyx_v_X_r);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_v_X_r);
        __Pyx_INCREF(__pyx_v_w_r);
        __Pyx_GIVEREF(__pyx_v_w_r);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_v_w_r);
        __Pyx_INCREF(__pyx_v_y_r);
        __Pyx_GIVEREF(__pyx_v_y_r);
        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_8, __pyx_v_y_r);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_8, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":814
 *             if tree.trueBranch is not None:
 *                 self.fillTree(X_l, w_l, y_l, tree.trueBranch)
 *             if tree.falseBranch is not None:             # <<<<<<<<<<<<<<
 *                 self.fillTree(X_r, w_r, y_r, tree.falseBranch)
 * 
 */
    }

    /* "causalml/inference/tree/uplift.pyx":808
 * 
 *         # Divide sets for child nodes
 *         if tree.trueBranch or tree.falseBranch:             # <<<<<<<<<<<<<<
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, tree.col, tree.value)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":820
 * 
 *         # matchScore
 *         matchScore = (currentNodeSummary[tree.bestTreatment][0] - currentNodeSummary[0][0])             # <<<<<<<<<<<<<<
 *         tree.matchScore = round(matchScore, 4)
 *         tree.summary['matchScore'] = round(matchScore, 4)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_bestTreatment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_currentNodeSummary, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_currentNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_matchScore = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "causalml/inference/tree/uplift.pyx":821
 *         # matchScore
 *         matchScore = (currentNodeSummary[tree.bestTreatment][0] - currentNodeSummary[0][0])
 *         tree.matchScore = round(matchScore, 4)             # <<<<<<<<<<<<<<
 *         tree.summary['matchScore'] = round(matchScore, 4)
 * 
 */
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_matchScore);
  __Pyx_GIVEREF(__pyx_v_matchScore);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_matchScore);
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_matchScore, __pyx_t_2) < 0) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":822
 *         matchScore = (currentNodeSummary[tree.bestTreatment][0] - currentNodeSummary[0][0])
 *         tree.matchScore = round(matchScore, 4)
 *         tree.summary['matchScore'] = round(matchScore, 4)             # <<<<<<<<<<<<<<
 * 
 *         # Samples, Group_size
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_matchScore);
  __Pyx_GIVEREF(__pyx_v_matchScore);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_matchScore);
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_4);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_summary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_matchScore, __pyx_t_10) < 0)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "causalml/inference/tree/uplift.pyx":825
 * 
 *         # Samples, Group_size
 *         tree.summary['samples'] = len(y)             # <<<<<<<<<<<<<<
 *         tree.summary['group_size'] = ''
 *         for treatment_group, summary in zip(self.classes_, currentNodeSummary):
 */
  __pyx_t_13 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 825, __pyx_L1_error)
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_summary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_samples, __pyx_t_10) < 0)) __PYX_ERR(0, 825, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "causalml/inference/tree/uplift.pyx":826
 *         # Samples, Group_size
 *         tree.summary['samples'] = len(y)
 *         tree.summary['group_size'] = ''             # <<<<<<<<<<<<<<
 *         for treatment_group, summary in zip(self.classes_, currentNodeSummary):
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_summary); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_n_u_group_size, __pyx_kp_u__4) < 0)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "causalml/inference/tree/uplift.pyx":827
 *         tree.summary['samples'] = len(y)
 *         tree.summary['group_size'] = ''
 *         for treatment_group, summary in zip(self.classes_, currentNodeSummary):             # <<<<<<<<<<<<<<
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])
 *         # classProb
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_currentNodeSummary);
  __Pyx_GIVEREF(__pyx_v_currentNodeSummary);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_currentNodeSummary);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
    __pyx_t_2 = __pyx_t_10; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 827, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 827, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 827, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 827, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 827, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      }
    } else {
      __pyx_t_10 = __pyx_t_14(__pyx_t_2);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 827, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_10);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 827, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) __PYX_ERR(0, 827, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 827, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_summary, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":828
 *         tree.summary['group_size'] = ''
 *         for treatment_group, summary in zip(self.classes_, currentNodeSummary):
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])             # <<<<<<<<<<<<<<
 *         # classProb
 *         if tree.results is not None:
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_summary); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_n_u_group_size);
    __pyx_t_15 = __pyx_n_u_group_size;
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_10, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_u__5, __pyx_v_treatment_group); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_kp_u__6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_summary, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_t_15, __pyx_t_9) < 0)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "causalml/inference/tree/uplift.pyx":827
 *         tree.summary['samples'] = len(y)
 *         tree.summary['group_size'] = ''
 *         for treatment_group, summary in zip(self.classes_, currentNodeSummary):             # <<<<<<<<<<<<<<
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])
 *         # classProb
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":830
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])
 *         # classProb
 *         if tree.results is not None:             # <<<<<<<<<<<<<<
 *             tree.results = self.uplift_classification_results(treatment_idx, y)
 *         return self
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "causalml/inference/tree/uplift.pyx":831
 *         # classProb
 *         if tree.results is not None:
 *             tree.results = self.uplift_classification_results(treatment_idx, y)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uplift_classification_results); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_treatment_idx, __pyx_v_y};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_treatment_idx, __pyx_v_y};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_treatment_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_idx);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_treatment_idx);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_v_y);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_tree, __pyx_n_s_results, __pyx_t_2) < 0) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":830
 *             tree.summary['group_size'] += ' ' + treatment_group + ': ' + str(summary[1])
 *         # classProb
 *         if tree.results is not None:             # <<<<<<<<<<<<<<
 *             tree.results = self.uplift_classification_results(treatment_idx, y)
 *         return self
 */
  }

  /* "causalml/inference/tree/uplift.pyx":832
 *         if tree.results is not None:
 *             tree.results = self.uplift_classification_results(treatment_idx, y)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def predict(self, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":781
 *         return self
 * 
 *     def fillTree(self, X, treatment_idx, y, tree):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a lower-level function to execute on the tree filling task.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.fillTree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_currentNodeSummary);
  __Pyx_XDECREF(__pyx_v_X_l);
  __Pyx_XDECREF(__pyx_v_X_r);
  __Pyx_XDECREF(__pyx_v_w_l);
  __Pyx_XDECREF(__pyx_v_w_r);
  __Pyx_XDECREF(__pyx_v_y_l);
  __Pyx_XDECREF(__pyx_v_y_r);
  __Pyx_XDECREF(__pyx_v_matchScore);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XDECREF(__pyx_v_summary);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":834
 *         return self
 * 
 *     def predict(self, X):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_17predict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_16predict[] = "\n        Returns the recommended treatment group and predicted optimal\n        probability conditional on using the recommended treatment group.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n\n        Returns\n        -------\n        pred: ndarray, shape = [num_samples, num_treatments]\n            An ndarray of predicted treatment effects across treatments.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_17predict = {"predict", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_17predict, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_16predict};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_17predict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("predict (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("predict", 1, 2, 2, 1); __PYX_ERR(0, 834, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict") < 0)) __PYX_ERR(0, 834, __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_self = values[0];
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("predict", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 834, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.predict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_16predict(__pyx_self, __pyx_v_self, __pyx_v_X);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_16predict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_v_pred_nodes = NULL;
  Py_ssize_t __pyx_v_i_row;
  PyObject *__pyx_v_pred_leaf = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("predict", 0);
  __Pyx_INCREF(__pyx_v_X);

  /* "causalml/inference/tree/uplift.pyx":850
 *         '''
 * 
 *         X = check_array(X)             # <<<<<<<<<<<<<<
 * 
 *         pred_nodes = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_X) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_X);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":852
 *         X = check_array(X)
 * 
 *         pred_nodes = []             # <<<<<<<<<<<<<<
 *         for i_row in range(len(X)):
 *             pred_leaf, _ = self.classify(X[i_row], self.fitted_uplift_tree, dataMissing=False)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pred_nodes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":853
 * 
 *         pred_nodes = []
 *         for i_row in range(len(X)):             # <<<<<<<<<<<<<<
 *             pred_leaf, _ = self.classify(X[i_row], self.fitted_uplift_tree, dataMissing=False)
 *             pred_nodes.append(pred_leaf)
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 853, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i_row = __pyx_t_6;

    /* "causalml/inference/tree/uplift.pyx":854
 *         pred_nodes = []
 *         for i_row in range(len(X)):
 *             pred_leaf, _ = self.classify(X[i_row], self.fitted_uplift_tree, dataMissing=False)             # <<<<<<<<<<<<<<
 *             pred_nodes.append(pred_leaf)
 *         return np.array(pred_nodes)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classify); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_X, __pyx_v_i_row, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fitted_uplift_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dataMissing, Py_False) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 854, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_1), 2) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 854, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_pred_leaf, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":855
 *         for i_row in range(len(X)):
 *             pred_leaf, _ = self.classify(X[i_row], self.fitted_uplift_tree, dataMissing=False)
 *             pred_nodes.append(pred_leaf)             # <<<<<<<<<<<<<<
 *         return np.array(pred_nodes)
 * 
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_pred_nodes, __pyx_v_pred_leaf); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 855, __pyx_L1_error)
  }

  /* "causalml/inference/tree/uplift.pyx":856
 *             pred_leaf, _ = self.classify(X[i_row], self.fitted_uplift_tree, dataMissing=False)
 *             pred_nodes.append(pred_leaf)
 *         return np.array(pred_nodes)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_pred_nodes) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_pred_nodes);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":834
 *         return self
 * 
 *     def predict(self, X):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */

  /* 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_7);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.predict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pred_nodes);
  __Pyx_XDECREF(__pyx_v_pred_leaf);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":859
 * 
 *     @staticmethod
 *     def divideSet(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node split.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_19divideSet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_18divideSet[] = "\n        Tree node split.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        column : int\n                The column used to split the data.\n        value : float or int\n                The value in the column for splitting the data.\n\n        Returns\n        -------\n        (X_l, X_r, treatment_l, treatment_r, y_l, y_r) : list of ndarray\n                The covariates, treatments and outcomes of left node and the right node.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_19divideSet = {"divideSet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_19divideSet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_18divideSet};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_19divideSet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_column = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divideSet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_column,&__pyx_n_s_value,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet", 1, 5, 5, 1); __PYX_ERR(0, 859, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet", 1, 5, 5, 2); __PYX_ERR(0, 859, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet", 1, 5, 5, 3); __PYX_ERR(0, 859, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet", 1, 5, 5, 4); __PYX_ERR(0, 859, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divideSet") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_X = values[0];
    __pyx_v_treatment_idx = values[1];
    __pyx_v_y = values[2];
    __pyx_v_column = values[3];
    __pyx_v_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divideSet", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.divideSet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_18divideSet(__pyx_self, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_column, __pyx_v_value);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_18divideSet(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_column, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_filt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("divideSet", 0);

  /* "causalml/inference/tree/uplift.pyx":882
 *         '''
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):             # <<<<<<<<<<<<<<
 *             filt = X[:, column] >= value
 *         else:  # for strings
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_issubdtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_ptype_5numpy_number)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_ptype_5numpy_number)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_ptype_5numpy_number));
    __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5numpy_number));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_ptype_5numpy_number));
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "causalml/inference/tree/uplift.pyx":883
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):
 *             filt = X[:, column] >= value             # <<<<<<<<<<<<<<
 *         else:  # for strings
 *             filt = X[:, column] == value
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__7);
    __Pyx_GIVEREF(__pyx_slice__7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__7);
    __Pyx_INCREF(__pyx_v_column);
    __Pyx_GIVEREF(__pyx_v_column);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_column);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_value, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_filt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":882
 *         '''
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):             # <<<<<<<<<<<<<<
 *             filt = X[:, column] >= value
 *         else:  # for strings
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":885
 *             filt = X[:, column] >= value
 *         else:  # for strings
 *             filt = X[:, column] == value             # <<<<<<<<<<<<<<
 * 
 *         return X[filt], X[~filt], treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__7);
    __Pyx_GIVEREF(__pyx_slice__7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__7);
    __Pyx_INCREF(__pyx_v_column);
    __Pyx_GIVEREF(__pyx_v_column);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_column);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_filt = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":887
 *             filt = X[:, column] == value
 * 
 *         return X[filt], X[~filt], treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_v_filt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Invert(__pyx_v_filt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_treatment_idx, __pyx_v_filt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Invert(__pyx_v_filt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_treatment_idx, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_v_filt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyNumber_Invert(__pyx_v_filt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":859
 * 
 *     @staticmethod
 *     def divideSet(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node split.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.divideSet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":890
 * 
 *     @staticmethod
 *     def divideSet_len(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''Tree node split.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_21divideSet_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_20divideSet_len[] = "Tree node split.\n\n        Modified from dividedSet(), but return the len(X_l) and\n        len(X_r) instead of the split X_l and X_r, to avoid some\n        overhead, intended to be used for finding the split. After\n        finding the best splits, can split to find the X_l and X_r.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        column : int\n                The column used to split the data.\n        value : float or int\n                The value in the column for splitting the data.\n\n        Returns\n        -------\n        (len_X_l, len_X_r, treatment_l, treatment_r, y_l, y_r) : list of ndarray\n                The covariates nrows, treatments and outcomes of left node and the right node.\n\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_21divideSet_len = {"divideSet_len", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_21divideSet_len, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_20divideSet_len};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_21divideSet_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_column = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divideSet_len (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_column,&__pyx_n_s_value,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet_len", 1, 5, 5, 1); __PYX_ERR(0, 890, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet_len", 1, 5, 5, 2); __PYX_ERR(0, 890, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet_len", 1, 5, 5, 3); __PYX_ERR(0, 890, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divideSet_len", 1, 5, 5, 4); __PYX_ERR(0, 890, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divideSet_len") < 0)) __PYX_ERR(0, 890, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_X = values[0];
    __pyx_v_treatment_idx = values[1];
    __pyx_v_y = values[2];
    __pyx_v_column = values[3];
    __pyx_v_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divideSet_len", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 890, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.divideSet_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_20divideSet_len(__pyx_self, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_column, __pyx_v_value);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_20divideSet_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_column, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_filt = NULL;
  PyObject *__pyx_v_len_X_l = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("divideSet_len", 0);

  /* "causalml/inference/tree/uplift.pyx":918
 *         '''
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):             # <<<<<<<<<<<<<<
 *             filt = X[:, column] >= value
 *         else:  # for strings
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_issubdtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_ptype_5numpy_number)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_ptype_5numpy_number)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_ptype_5numpy_number));
    __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5numpy_number));
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_ptype_5numpy_number));
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "causalml/inference/tree/uplift.pyx":919
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):
 *             filt = X[:, column] >= value             # <<<<<<<<<<<<<<
 *         else:  # for strings
 *             filt = X[:, column] == value
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__7);
    __Pyx_GIVEREF(__pyx_slice__7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__7);
    __Pyx_INCREF(__pyx_v_column);
    __Pyx_GIVEREF(__pyx_v_column);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_column);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_value, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_filt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":918
 *         '''
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):             # <<<<<<<<<<<<<<
 *             filt = X[:, column] >= value
 *         else:  # for strings
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":921
 *             filt = X[:, column] >= value
 *         else:  # for strings
 *             filt = X[:, column] == value             # <<<<<<<<<<<<<<
 * 
 *         len_X_l = np.sum(filt)
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__7);
    __Pyx_GIVEREF(__pyx_slice__7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__7);
    __Pyx_INCREF(__pyx_v_column);
    __Pyx_GIVEREF(__pyx_v_column);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_column);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_filt = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":923
 *             filt = X[:, column] == value
 * 
 *         len_X_l = np.sum(filt)             # <<<<<<<<<<<<<<
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_v_filt) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_filt);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_len_X_l = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":924
 * 
 *         len_X_l = np.sum(filt)
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]             # <<<<<<<<<<<<<<
 * 
 *     def group_uniqueCounts(self, treatment_idx, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 924, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_v_len_X_l); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_treatment_idx, __pyx_v_filt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Invert(__pyx_v_filt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_treatment_idx, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_v_filt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Invert(__pyx_v_filt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_len_X_l);
  __Pyx_GIVEREF(__pyx_v_len_X_l);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_len_X_l);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_9);
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":890
 * 
 *     @staticmethod
 *     def divideSet_len(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''Tree node split.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.divideSet_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filt);
  __Pyx_XDECREF(__pyx_v_len_X_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":926
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 *     def group_uniqueCounts(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Count sample size by experiment group.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_23group_uniqueCounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_22group_uniqueCounts[] = "\n        Count sample size by experiment group.\n\n        Args\n        ----\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n\n        Returns\n        -------\n        results : list of list\n            The negative and positive outcome sample sizes for each of the control and treatment groups.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_23group_uniqueCounts = {"group_uniqueCounts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_23group_uniqueCounts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_22group_uniqueCounts};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_23group_uniqueCounts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_uniqueCounts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_uniqueCounts", 1, 3, 3, 1); __PYX_ERR(0, 926, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_uniqueCounts", 1, 3, 3, 2); __PYX_ERR(0, 926, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_uniqueCounts") < 0)) __PYX_ERR(0, 926, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_treatment_idx = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_uniqueCounts", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.group_uniqueCounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_22group_uniqueCounts(__pyx_self, __pyx_v_self, __pyx_v_treatment_idx, __pyx_v_y);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_22group_uniqueCounts(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_results = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_filt = NULL;
  PyObject *__pyx_v_n_pos = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_uniqueCounts", 0);

  /* "causalml/inference/tree/uplift.pyx":942
 *             The negative and positive outcome sample sizes for each of the control and treatment groups.
 *         '''
 *         results = []             # <<<<<<<<<<<<<<
 *         for i in range(self.n_class):
 *             filt = treatment_idx == i
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":943
 *         '''
 *         results = []
 *         for i in range(self.n_class):             # <<<<<<<<<<<<<<
 *             filt = treatment_idx == i
 *             n_pos = y[filt].sum()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 943, __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, 943, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 943, __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, 943, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 943, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":944
 *         results = []
 *         for i in range(self.n_class):
 *             filt = treatment_idx == i             # <<<<<<<<<<<<<<
 *             n_pos = y[filt].sum()
 * 
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_treatment_idx, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_filt, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":945
 *         for i in range(self.n_class):
 *             filt = treatment_idx == i
 *             n_pos = y[filt].sum()             # <<<<<<<<<<<<<<
 * 
 *             # [N(Y = 0, T = 1), N(Y = 1, T = 1)]
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_v_filt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_n_pos, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":948
 * 
 *             # [N(Y = 0, T = 1), N(Y = 1, T = 1)]
 *             results.append([filt.sum() - n_pos, n_pos])             # <<<<<<<<<<<<<<
 * 
 *         return results
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_filt, __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_n_pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_n_pos);
    __Pyx_GIVEREF(__pyx_v_n_pos);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_n_pos);
    __pyx_t_6 = 0;
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":943
 *         '''
 *         results = []
 *         for i in range(self.n_class):             # <<<<<<<<<<<<<<
 *             filt = treatment_idx == i
 *             n_pos = y[filt].sum()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":950
 *             results.append([filt.sum() - n_pos, n_pos])
 * 
 *         return results             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":926
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 *     def group_uniqueCounts(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Count sample size by experiment group.
 */

  /* function exit code */
  __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("causalml.inference.tree.uplift.UpliftTreeClassifier.group_uniqueCounts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_filt);
  __Pyx_XDECREF(__pyx_v_n_pos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":953
 * 
 *     @staticmethod
 *     def evaluate_KL(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate KL Divergence as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_25evaluate_KL(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_24evaluate_KL[] = "\n        Calculate KL Divergence as split evaluation criterion for a given node.\n\n        Args\n        ----\n        nodeSummary : list of list\n            The tree node summary statistics, [P(Y=1|T), N(T)], produced by tree_node_summary()\n            method.\n\n        Returns\n        -------\n        d_res : KL Divergence\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_25evaluate_KL = {"evaluate_KL", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_25evaluate_KL, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_24evaluate_KL};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_25evaluate_KL(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_KL (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_24evaluate_KL(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_24evaluate_KL(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_v_p_c = NULL;
  double __pyx_v_d_res;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  float __pyx_t_5;
  float __pyx_t_6;
  float __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_KL", 0);

  /* "causalml/inference/tree/uplift.pyx":967
 *         d_res : KL Divergence
 *         '''
 *         p_c = nodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         d_res = 0.
 *         for treatment_group in nodeSummary[1:]:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_p_c = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":968
 *         '''
 *         p_c = nodeSummary[0][0]
 *         d_res = 0.             # <<<<<<<<<<<<<<
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += kl_divergence(treatment_group[0], p_c)
 */
  __pyx_v_d_res = 0.;

  /* "causalml/inference/tree/uplift.pyx":969
 *         p_c = nodeSummary[0][0]
 *         d_res = 0.
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += kl_divergence(treatment_group[0], p_c)
 *         return d_res
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 969, __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, 969, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 969, __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, 969, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 969, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":970
 *         d_res = 0.
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += kl_divergence(treatment_group[0], p_c)             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_p_c); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(__pyx_t_5, __pyx_t_6); if (unlikely(__pyx_t_7 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 970, __pyx_L1_error)
    __pyx_v_d_res = (__pyx_v_d_res + __pyx_t_7);

    /* "causalml/inference/tree/uplift.pyx":969
 *         p_c = nodeSummary[0][0]
 *         d_res = 0.
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += kl_divergence(treatment_group[0], p_c)
 *         return d_res
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":971
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += kl_divergence(treatment_group[0], p_c)
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":953
 * 
 *     @staticmethod
 *     def evaluate_KL(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate KL Divergence as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_KL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p_c);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":974
 * 
 *     @staticmethod
 *     def arr_evaluate_KL(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_27arr_evaluate_KL(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_26arr_evaluate_KL[] = "\n        Calculate KL Divergence as split evaluation criterion for a given node.\n        Modified to accept new node summary format.\n\n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : KL Divergence\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_27arr_evaluate_KL = {"arr_evaluate_KL", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_27arr_evaluate_KL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_26arr_evaluate_KL};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_27arr_evaluate_KL(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_KL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_KL", 1, 2, 2, 1); __PYX_ERR(0, 974, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_KL") < 0)) __PYX_ERR(0, 974, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_KL", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 974, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_KL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 974, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 975, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_26arr_evaluate_KL(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_26arr_evaluate_KL(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  float __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_KL", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 974, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 974, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":995
 *         d_res : KL Divergence
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":996
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 */
  __pyx_t_1 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":997
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for i in range(1, n_class):
 */
  __pyx_v_d_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":998
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             d_res += kl_divergence(node_summary_p[i], p_c)
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":999
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             d_res += kl_divergence(node_summary_p[i], p_c)
 *         return d_res
 */
  __pyx_t_2 = __pyx_v_n_class;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "causalml/inference/tree/uplift.pyx":1000
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             d_res += kl_divergence(node_summary_p[i], p_c)             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_5 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)), __pyx_v_p_c); if (unlikely(__pyx_t_5 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1000, __pyx_L1_error)
    __pyx_v_d_res = (__pyx_v_d_res + __pyx_t_5);
  }

  /* "causalml/inference/tree/uplift.pyx":1001
 *         for i in range(1, n_class):
 *             d_res += kl_divergence(node_summary_p[i], p_c)
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":974
 * 
 *     @staticmethod
 *     def arr_evaluate_KL(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_KL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1004
 * 
 *     @staticmethod
 *     def evaluate_ED(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Euclidean Distance as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_29evaluate_ED(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_28evaluate_ED[] = "\n        Calculate Euclidean Distance as split evaluation criterion for a given node.\n\n        Args\n        ----\n        nodeSummary : dictionary\n            The tree node summary statistics, produced by tree_node_summary()\n            method.\n\n        Returns\n        -------\n        d_res : Euclidean Distance\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_29evaluate_ED = {"evaluate_ED", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_29evaluate_ED, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_28evaluate_ED};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_29evaluate_ED(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_ED (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_28evaluate_ED(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_28evaluate_ED(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_d_res = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_ED", 0);

  /* "causalml/inference/tree/uplift.pyx":1018
 *         d_res : Euclidean Distance
 *         '''
 *         pc = nodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1019
 *         '''
 *         pc = nodeSummary[0][0]
 *         d_res = 0             # <<<<<<<<<<<<<<
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += 2*(treatment_group[0] - pc)**2
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_d_res = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1020
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += 2*(treatment_group[0] - pc)**2
 *         return d_res
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1020, __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, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1020, __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, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1020, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1021
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += 2*(treatment_group[0] - pc)**2             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_pc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_d_res, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_d_res, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1020
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += 2*(treatment_group[0] - pc)**2
 *         return d_res
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1022
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += 2*(treatment_group[0] - pc)**2
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d_res);
  __pyx_r = __pyx_v_d_res;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1004
 * 
 *     @staticmethod
 *     def evaluate_ED(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Euclidean Distance as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_ED", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_d_res);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1025
 * 
 *     @staticmethod
 *     def arr_evaluate_ED(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_31arr_evaluate_ED(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_30arr_evaluate_ED[] = "\n        Calculate Euclidean Distance as split evaluation criterion for a given node.\n\n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : Euclidean Distance\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_31arr_evaluate_ED = {"arr_evaluate_ED", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_31arr_evaluate_ED, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_30arr_evaluate_ED};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_31arr_evaluate_ED(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_ED (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_ED", 1, 2, 2, 1); __PYX_ERR(0, 1025, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_ED") < 0)) __PYX_ERR(0, 1025, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_ED", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_ED", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 1025, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 1026, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_30arr_evaluate_ED(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_30arr_evaluate_ED(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_ED", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1025, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1025, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1045
 *         d_res : Euclidean Distance
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":1046
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 */
  __pyx_t_1 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1047
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for i in range(1, n_class):
 */
  __pyx_v_d_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1048
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             d_res += 2*(node_summary_p[i] - p_c)*(node_summary_p[i] - p_c)
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1049
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             d_res += 2*(node_summary_p[i] - p_c)*(node_summary_p[i] - p_c)
 *         return d_res
 */
  __pyx_t_2 = __pyx_v_n_class;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "causalml/inference/tree/uplift.pyx":1050
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             d_res += 2*(node_summary_p[i] - p_c)*(node_summary_p[i] - p_c)             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_5 = __pyx_v_i;
    __pyx_v_d_res = (__pyx_v_d_res + ((2.0 * ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c)) * ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c)));
  }

  /* "causalml/inference/tree/uplift.pyx":1051
 *         for i in range(1, n_class):
 *             d_res += 2*(node_summary_p[i] - p_c)*(node_summary_p[i] - p_c)
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1025
 * 
 *     @staticmethod
 *     def arr_evaluate_ED(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_ED", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1054
 * 
 *     @staticmethod
 *     def evaluate_Chi(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Chi-Square statistic as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_33evaluate_Chi(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_32evaluate_Chi[] = "\n        Calculate Chi-Square statistic as split evaluation criterion for a given node.\n\n        Args\n        ----\n        nodeSummary : dictionary\n            The tree node summary statistics, produced by tree_node_summary() method.\n\n        Returns\n        -------\n        d_res : Chi-Square\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_33evaluate_Chi = {"evaluate_Chi", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_33evaluate_Chi, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_32evaluate_Chi};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_33evaluate_Chi(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_Chi (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_32evaluate_Chi(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_32evaluate_Chi(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_d_res = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_Chi", 0);

  /* "causalml/inference/tree/uplift.pyx":1067
 *         d_res : Chi-Square
 *         '''
 *         pc = nodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1068
 *         '''
 *         pc = nodeSummary[0][0]
 *         d_res = 0             # <<<<<<<<<<<<<<
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_d_res = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1069
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1069, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1069, __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, 1069, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1069, __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, 1069, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1069, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1070
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)             # <<<<<<<<<<<<<<
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))
 *         return d_res
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_pc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_v_pc);
    __pyx_t_5 = __pyx_v_pc;
    __pyx_t_6 = pow(0.1, 6.0);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = __pyx_t_5;
    } else {
      __pyx_t_9 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1070, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":1071
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_7, __pyx_v_pc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_pc, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = pow(0.1, 6.0);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_9 = __pyx_t_2;
    } else {
      __pyx_t_11 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_9 = __pyx_t_11;
      __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1070
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)             # <<<<<<<<<<<<<<
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))
 *         return d_res
 */
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_d_res, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_d_res, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1069
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1072
 *             d_res += ((treatment_group[0] - pc) ** 2 / max(0.1 ** 6, pc)
 *                       + (treatment_group[0] - pc) ** 2 / max(0.1 ** 6, 1 - pc))
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d_res);
  __pyx_r = __pyx_v_d_res;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1054
 * 
 *     @staticmethod
 *     def evaluate_Chi(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Chi-Square statistic as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_Chi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_d_res);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1075
 * 
 *     @staticmethod
 *     def arr_evaluate_Chi(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_35arr_evaluate_Chi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_34arr_evaluate_Chi[] = "\n        Calculate Chi-Square statistic as split evaluation criterion for a given node.\n\n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : Chi-Square\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_35arr_evaluate_Chi = {"arr_evaluate_Chi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_35arr_evaluate_Chi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_34arr_evaluate_Chi};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_35arr_evaluate_Chi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_Chi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_Chi", 1, 2, 2, 1); __PYX_ERR(0, 1075, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_Chi") < 0)) __PYX_ERR(0, 1075, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_Chi", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1075, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_Chi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 1075, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 1076, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_34arr_evaluate_Chi(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_34arr_evaluate_Chi(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_max_eps_pc;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_max_eps_1_pc;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_diff_sq;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_2;
  double __pyx_t_3;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_Chi", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1075, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1075, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1095
 *         d_res : Chi-Square
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":1096
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 */
  __pyx_t_1 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1097
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         cdef P_TYPE_t max_eps_pc = max(0.1 ** 6, p_c)
 */
  __pyx_v_d_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1098
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t max_eps_pc = max(0.1 ** 6, p_c)
 *         cdef P_TYPE_t max_eps_1_pc = max(0.1 ** 6, 1 - p_c)
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1099
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 *         cdef P_TYPE_t max_eps_pc = max(0.1 ** 6, p_c)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t max_eps_1_pc = max(0.1 ** 6, 1 - p_c)
 *         cdef P_TYPE_t diff_sq = 0.0
 */
  __pyx_t_2 = __pyx_v_p_c;
  __pyx_t_3 = pow(0.1, 6.0);
  if (((__pyx_t_2 > __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_v_max_eps_pc = __pyx_t_4;

  /* "causalml/inference/tree/uplift.pyx":1100
 *         cdef int i = 0
 *         cdef P_TYPE_t max_eps_pc = max(0.1 ** 6, p_c)
 *         cdef P_TYPE_t max_eps_1_pc = max(0.1 ** 6, 1 - p_c)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t diff_sq = 0.0
 *         for i in range(1, n_class):
 */
  __pyx_t_4 = (1.0 - __pyx_v_p_c);
  __pyx_t_3 = pow(0.1, 6.0);
  if (((__pyx_t_4 > __pyx_t_3) != 0)) {
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  __pyx_v_max_eps_1_pc = __pyx_t_2;

  /* "causalml/inference/tree/uplift.pyx":1101
 *         cdef P_TYPE_t max_eps_pc = max(0.1 ** 6, p_c)
 *         cdef P_TYPE_t max_eps_1_pc = max(0.1 ** 6, 1 - p_c)
 *         cdef P_TYPE_t diff_sq = 0.0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             diff_sq = (node_summary_p[i] - p_c) * (node_summary_p[i] - p_c)
 */
  __pyx_v_diff_sq = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1102
 *         cdef P_TYPE_t max_eps_1_pc = max(0.1 ** 6, 1 - p_c)
 *         cdef P_TYPE_t diff_sq = 0.0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             diff_sq = (node_summary_p[i] - p_c) * (node_summary_p[i] - p_c)
 *             d_res += (diff_sq / max_eps_pc + diff_sq / max_eps_1_pc)
 */
  __pyx_t_5 = __pyx_v_n_class;
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "causalml/inference/tree/uplift.pyx":1103
 *         cdef P_TYPE_t diff_sq = 0.0
 *         for i in range(1, n_class):
 *             diff_sq = (node_summary_p[i] - p_c) * (node_summary_p[i] - p_c)             # <<<<<<<<<<<<<<
 *             d_res += (diff_sq / max_eps_pc + diff_sq / max_eps_1_pc)
 *         return d_res
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = __pyx_v_i;
    __pyx_v_diff_sq = (((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c) * ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c));

    /* "causalml/inference/tree/uplift.pyx":1104
 *         for i in range(1, n_class):
 *             diff_sq = (node_summary_p[i] - p_c) * (node_summary_p[i] - p_c)
 *             d_res += (diff_sq / max_eps_pc + diff_sq / max_eps_1_pc)             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_v_d_res = (__pyx_v_d_res + ((__pyx_v_diff_sq / __pyx_v_max_eps_pc) + (__pyx_v_diff_sq / __pyx_v_max_eps_1_pc)));
  }

  /* "causalml/inference/tree/uplift.pyx":1105
 *             diff_sq = (node_summary_p[i] - p_c) * (node_summary_p[i] - p_c)
 *             d_res += (diff_sq / max_eps_pc + diff_sq / max_eps_1_pc)
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1075
 * 
 *     @staticmethod
 *     def arr_evaluate_Chi(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_Chi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1108
 * 
 *     @staticmethod
 *     def evaluate_DDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_37evaluate_DDP(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_36evaluate_DDP[] = "\n        Calculate Delta P as split evaluation criterion for a given node.\n\n        Args\n        ----\n        nodeSummary : list of list\n            The tree node summary statistics, [P(Y=1|T), N(T)], produced by tree_node_summary() method.\n\n        Returns\n        -------\n        d_res : Delta P\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_37evaluate_DDP = {"evaluate_DDP", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_37evaluate_DDP, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_36evaluate_DDP};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_37evaluate_DDP(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_DDP (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_36evaluate_DDP(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_36evaluate_DDP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_d_res = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_DDP", 0);

  /* "causalml/inference/tree/uplift.pyx":1121
 *         d_res : Delta P
 *         '''
 *         pc = nodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1122
 *         '''
 *         pc = nodeSummary[0][0]
 *         d_res = 0             # <<<<<<<<<<<<<<
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_d_res = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1123
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += treatment_group[0] - pc
 *         return d_res
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1123, __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, 1123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1123, __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, 1123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1123, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1124
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_pc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_d_res, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_d_res, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1123
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += treatment_group[0] - pc
 *         return d_res
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1125
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d_res);
  __pyx_r = __pyx_v_d_res;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1108
 * 
 *     @staticmethod
 *     def evaluate_DDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_DDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_d_res);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1128
 * 
 *     @staticmethod
 *     def arr_evaluate_DDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_39arr_evaluate_DDP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_38arr_evaluate_DDP[] = "\n        Calculate Delta P as split evaluation criterion for a given node.\n\n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : Delta P\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_39arr_evaluate_DDP = {"arr_evaluate_DDP", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_39arr_evaluate_DDP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_38arr_evaluate_DDP};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_39arr_evaluate_DDP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_DDP (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_DDP", 1, 2, 2, 1); __PYX_ERR(0, 1128, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_DDP") < 0)) __PYX_ERR(0, 1128, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_DDP", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_DDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 1128, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 1129, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_38arr_evaluate_DDP(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_38arr_evaluate_DDP(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_DDP", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1128, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1128, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1148
 *         d_res : Delta P
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":1149
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 */
  __pyx_t_1 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1150
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for i in range(1, n_class):
 */
  __pyx_v_d_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1151
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1152
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             d_res += node_summary_p[i] - p_c
 *         return d_res
 */
  __pyx_t_2 = __pyx_v_n_class;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "causalml/inference/tree/uplift.pyx":1153
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_v_d_res = (__pyx_v_d_res + ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c));
  }

  /* "causalml/inference/tree/uplift.pyx":1154
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1128
 * 
 *     @staticmethod
 *     def arr_evaluate_DDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_DDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1157
 * 
 *     @staticmethod
 *     def evaluate_IT(leftNodeSummary, rightNodeSummary, w_l, w_r):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Squared T-Statistic as split evaluation criterion for a given node
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_41evaluate_IT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_40evaluate_IT[] = "\n        Calculate Squared T-Statistic as split evaluation criterion for a given node\n\n        Args\n        ----\n        leftNodeSummary : list of list\n            The left node summary statistics.\n        rightNodeSummary : list of list\n            The right node summary statistics.\n        w_l: array-like, shape = [num_samples]\n            An array containing the treatment for each unit in the left node\n        w_r: array-like, shape = [num_samples]\n            An array containing the treatment for each unit in the right node\n\n        Returns\n        -------\n        g_s : Squared T-Statistic\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_41evaluate_IT = {"evaluate_IT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_41evaluate_IT, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_40evaluate_IT};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_41evaluate_IT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_leftNodeSummary = 0;
  PyObject *__pyx_v_rightNodeSummary = 0;
  CYTHON_UNUSED PyObject *__pyx_v_w_l = 0;
  CYTHON_UNUSED PyObject *__pyx_v_w_r = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_IT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_leftNodeSummary,&__pyx_n_s_rightNodeSummary,&__pyx_n_s_w_l,&__pyx_n_s_w_r,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_leftNodeSummary)) != 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_rightNodeSummary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_IT", 1, 4, 4, 1); __PYX_ERR(0, 1157, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_IT", 1, 4, 4, 2); __PYX_ERR(0, 1157, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_IT", 1, 4, 4, 3); __PYX_ERR(0, 1157, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_IT") < 0)) __PYX_ERR(0, 1157, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_leftNodeSummary = values[0];
    __pyx_v_rightNodeSummary = values[1];
    __pyx_v_w_l = values[2];
    __pyx_v_w_r = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_IT", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1157, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_IT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_40evaluate_IT(__pyx_self, __pyx_v_leftNodeSummary, __pyx_v_rightNodeSummary, __pyx_v_w_l, __pyx_v_w_r);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_40evaluate_IT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_leftNodeSummary, PyObject *__pyx_v_rightNodeSummary, CYTHON_UNUSED PyObject *__pyx_v_w_l, CYTHON_UNUSED PyObject *__pyx_v_w_r) {
  PyObject *__pyx_v_g_s = NULL;
  PyObject *__pyx_v_y_l_0 = NULL;
  PyObject *__pyx_v_y_r_0 = NULL;
  PyObject *__pyx_v_n_3 = NULL;
  PyObject *__pyx_v_n_4 = NULL;
  PyObject *__pyx_v_s_3 = NULL;
  PyObject *__pyx_v_s_4 = NULL;
  PyObject *__pyx_v_treatment_left = NULL;
  PyObject *__pyx_v_treatment_right = NULL;
  PyObject *__pyx_v_y_l_1 = NULL;
  PyObject *__pyx_v_y_r_1 = NULL;
  PyObject *__pyx_v_n_1 = NULL;
  PyObject *__pyx_v_n_2 = NULL;
  PyObject *__pyx_v_s_1 = NULL;
  PyObject *__pyx_v_s_2 = NULL;
  PyObject *__pyx_v_sum_n = NULL;
  PyObject *__pyx_v_w_1 = NULL;
  PyObject *__pyx_v_w_2 = NULL;
  PyObject *__pyx_v_w_3 = NULL;
  PyObject *__pyx_v_w_4 = NULL;
  PyObject *__pyx_v_sigma = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_IT", 0);

  /* "causalml/inference/tree/uplift.pyx":1176
 *         g_s : Squared T-Statistic
 *         '''
 *         g_s = 0             # <<<<<<<<<<<<<<
 * 
 *         ## Control Group
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_g_s = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1180
 *         ## Control Group
 *         # Sample mean in left & right child node
 *         y_l_0 = leftNodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         y_r_0 = rightNodeSummary[0][0]
 *         # Sample size left & right child node
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_leftNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_y_l_0 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1181
 *         # Sample mean in left & right child node
 *         y_l_0 = leftNodeSummary[0][0]
 *         y_r_0 = rightNodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         # Sample size left & right child node
 *         n_3 = leftNodeSummary[0][1]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_rightNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_y_r_0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1183
 *         y_r_0 = rightNodeSummary[0][0]
 *         # Sample size left & right child node
 *         n_3 = leftNodeSummary[0][1]             # <<<<<<<<<<<<<<
 *         n_4 = rightNodeSummary[0][1]
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_leftNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n_3 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1184
 *         # Sample size left & right child node
 *         n_3 = leftNodeSummary[0][1]
 *         n_4 = rightNodeSummary[0][1]             # <<<<<<<<<<<<<<
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         s_3 = y_l_0*(1-y_l_0)
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_rightNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_n_4 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1186
 *         n_4 = rightNodeSummary[0][1]
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         s_3 = y_l_0*(1-y_l_0)             # <<<<<<<<<<<<<<
 *         s_4 = y_r_0*(1-y_r_0)
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_y_l_0, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_v_y_l_0, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_s_3 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1187
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         s_3 = y_l_0*(1-y_l_0)
 *         s_4 = y_r_0*(1-y_r_0)             # <<<<<<<<<<<<<<
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):
 */
  __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_y_r_0, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_y_r_0, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s_4 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1189
 *         s_4 = y_r_0*(1-y_r_0)
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):             # <<<<<<<<<<<<<<
 *             ## Treatment Group
 *             # Sample mean in left & right child node
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_leftNodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rightNodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1189, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1189, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1189, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1189, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1189, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_left, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_treatment_right, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":1192
 *             ## Treatment Group
 *             # Sample mean in left & right child node
 *             y_l_1 = treatment_left[0]             # <<<<<<<<<<<<<<
 *             y_r_1 = treatment_right[0]
 *             # Sample size left & right child node
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_left, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_y_l_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1193
 *             # Sample mean in left & right child node
 *             y_l_1 = treatment_left[0]
 *             y_r_1 = treatment_right[0]             # <<<<<<<<<<<<<<
 *             # Sample size left & right child node
 *             n_1 = treatment_left[1]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_right, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_y_r_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1195
 *             y_r_1 = treatment_right[0]
 *             # Sample size left & right child node
 *             n_1 = treatment_left[1]             # <<<<<<<<<<<<<<
 *             n_2 = treatment_right[1]
 *             # Sample variance in left & right child node
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_left, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1196
 *             # Sample size left & right child node
 *             n_1 = treatment_left[1]
 *             n_2 = treatment_right[1]             # <<<<<<<<<<<<<<
 *             # Sample variance in left & right child node
 *             s_1 = y_l_1*(1-y_l_1)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_right, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_2, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1198
 *             n_2 = treatment_right[1]
 *             # Sample variance in left & right child node
 *             s_1 = y_l_1*(1-y_l_1)             # <<<<<<<<<<<<<<
 *             s_2 = y_r_1*(1-y_r_1)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_y_l_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_y_l_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_s_1, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":1199
 *             # Sample variance in left & right child node
 *             s_1 = y_l_1*(1-y_l_1)
 *             s_2 = y_r_1*(1-y_r_1)             # <<<<<<<<<<<<<<
 * 
 *             sum_n = np.sum([n_1 - 1, n_2 - 1, n_3 - 1, n_4 - 1])
 */
    __pyx_t_6 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_y_r_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_y_r_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_s_2, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1201
 *             s_2 = y_r_1*(1-y_r_1)
 * 
 *             sum_n = np.sum([n_1 - 1, n_2 - 1, n_3 - 1, n_4 - 1])             # <<<<<<<<<<<<<<
 *             w_1 = (n_1 - 1) / sum_n
 *             w_2 = (n_2 - 1) / sum_n
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyList_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sum_n, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1202
 * 
 *             sum_n = np.sum([n_1 - 1, n_2 - 1, n_3 - 1, n_4 - 1])
 *             w_1 = (n_1 - 1) / sum_n             # <<<<<<<<<<<<<<
 *             w_2 = (n_2 - 1) / sum_n
 *             w_3 = (n_3 - 1) / sum_n
 */
    __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_sum_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_w_1, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":1203
 *             sum_n = np.sum([n_1 - 1, n_2 - 1, n_3 - 1, n_4 - 1])
 *             w_1 = (n_1 - 1) / sum_n
 *             w_2 = (n_2 - 1) / sum_n             # <<<<<<<<<<<<<<
 *             w_3 = (n_3 - 1) / sum_n
 *             w_4 = (n_4 - 1) / sum_n
 */
    __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_sum_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_w_2, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1204
 *             w_1 = (n_1 - 1) / sum_n
 *             w_2 = (n_2 - 1) / sum_n
 *             w_3 = (n_3 - 1) / sum_n             # <<<<<<<<<<<<<<
 *             w_4 = (n_4 - 1) / sum_n
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_sum_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_w_3, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":1205
 *             w_2 = (n_2 - 1) / sum_n
 *             w_3 = (n_3 - 1) / sum_n
 *             w_4 = (n_4 - 1) / sum_n             # <<<<<<<<<<<<<<
 * 
 *             # Pooled estimator of the constant variance
 */
    __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_n_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_sum_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_w_4, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1208
 * 
 *             # Pooled estimator of the constant variance
 *             sigma = np.sqrt(np.sum([w_1 * s_1, w_2 * s_2, w_3 * s_3, w_4 * s_4]))             # <<<<<<<<<<<<<<
 * 
 *             # Squared t-statistic
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Multiply(__pyx_v_w_1, __pyx_v_s_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_w_2, __pyx_v_s_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_w_3, __pyx_v_s_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = PyNumber_Multiply(__pyx_v_w_4, __pyx_v_s_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyList_New(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_13, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_13, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_12);
    PyList_SET_ITEM(__pyx_t_13, 3, __pyx_t_12);
    __pyx_t_10 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_13);
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sigma, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1211
 * 
 *             # Squared t-statistic
 *             g_s = np.power(((y_l_1 - y_l_0) - (y_r_1 - y_r_0)) / (sigma * np.sqrt(np.sum([1 / n_1, 1 / n_2, 1 / n_3, 1 / n_4]))), 2)             # <<<<<<<<<<<<<<
 * 
 *         return g_s
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_power); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Subtract(__pyx_v_y_l_1, __pyx_v_y_l_0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = PyNumber_Subtract(__pyx_v_y_r_1, __pyx_v_y_r_0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = PyNumber_Subtract(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_v_n_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_v_n_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_v_n_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_v_n_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = PyList_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_16, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_14);
    PyList_SET_ITEM(__pyx_t_16, 2, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyList_SET_ITEM(__pyx_t_16, 3, __pyx_t_15);
    __pyx_t_6 = 0;
    __pyx_t_10 = 0;
    __pyx_t_14 = 0;
    __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_11 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_15, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_16);
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_7, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_v_sigma, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_17 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_17 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_9, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_9, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_13 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_17, __pyx_t_9);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_17, __pyx_int_2);
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_g_s, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1189
 *         s_4 = y_r_0*(1-y_r_0)
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):             # <<<<<<<<<<<<<<
 *             ## Treatment Group
 *             # Sample mean in left & right child node
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1213
 *             g_s = np.power(((y_l_1 - y_l_0) - (y_r_1 - y_r_0)) / (sigma * np.sqrt(np.sum([1 / n_1, 1 / n_2, 1 / n_3, 1 / n_4]))), 2)
 * 
 *         return g_s             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_g_s);
  __pyx_r = __pyx_v_g_s;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1157
 * 
 *     @staticmethod
 *     def evaluate_IT(leftNodeSummary, rightNodeSummary, w_l, w_r):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Squared T-Statistic as split evaluation criterion for a given node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_IT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g_s);
  __Pyx_XDECREF(__pyx_v_y_l_0);
  __Pyx_XDECREF(__pyx_v_y_r_0);
  __Pyx_XDECREF(__pyx_v_n_3);
  __Pyx_XDECREF(__pyx_v_n_4);
  __Pyx_XDECREF(__pyx_v_s_3);
  __Pyx_XDECREF(__pyx_v_s_4);
  __Pyx_XDECREF(__pyx_v_treatment_left);
  __Pyx_XDECREF(__pyx_v_treatment_right);
  __Pyx_XDECREF(__pyx_v_y_l_1);
  __Pyx_XDECREF(__pyx_v_y_r_1);
  __Pyx_XDECREF(__pyx_v_n_1);
  __Pyx_XDECREF(__pyx_v_n_2);
  __Pyx_XDECREF(__pyx_v_s_1);
  __Pyx_XDECREF(__pyx_v_s_2);
  __Pyx_XDECREF(__pyx_v_sum_n);
  __Pyx_XDECREF(__pyx_v_w_1);
  __Pyx_XDECREF(__pyx_v_w_2);
  __Pyx_XDECREF(__pyx_v_w_3);
  __Pyx_XDECREF(__pyx_v_w_4);
  __Pyx_XDECREF(__pyx_v_sigma);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1216
 * 
 *     @staticmethod
 *     def arr_evaluate_IT(np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] left_node_summary_n,
 *                         np.ndarray[P_TYPE_t, ndim=1] right_node_summary_p,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_43arr_evaluate_IT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_42arr_evaluate_IT[] = "\n        Calculate Squared T-Statistic as split evaluation criterion for a given node\n\n        NOTE: n_class should be 2.\n\n        Args\n        ----\n        left_node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the left node, i.e. [P(Y=1|T=i)...]\n        left_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the left node, i.e. [N(T=i)...]\n        right_node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the right node, i.e. [P(Y=1|T=i)...]\n        right_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the right node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        g_s : Squared T-Statistic\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_43arr_evaluate_IT = {"arr_evaluate_IT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_43arr_evaluate_IT, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_42arr_evaluate_IT};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_43arr_evaluate_IT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left_node_summary_p = 0;
  PyArrayObject *__pyx_v_left_node_summary_n = 0;
  PyArrayObject *__pyx_v_right_node_summary_p = 0;
  PyArrayObject *__pyx_v_right_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_IT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left_node_summary_p,&__pyx_n_s_left_node_summary_n,&__pyx_n_s_right_node_summary_p,&__pyx_n_s_right_node_summary_n,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_left_node_summary_p)) != 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_left_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_IT", 1, 4, 4, 1); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_node_summary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_IT", 1, 4, 4, 2); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_IT", 1, 4, 4, 3); __PYX_ERR(0, 1216, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_IT") < 0)) __PYX_ERR(0, 1216, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_left_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_left_node_summary_n = ((PyArrayObject *)values[1]);
    __pyx_v_right_node_summary_p = ((PyArrayObject *)values[2]);
    __pyx_v_right_node_summary_n = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_IT", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_IT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "left_node_summary_p", 0))) __PYX_ERR(0, 1216, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "left_node_summary_n", 0))) __PYX_ERR(0, 1217, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "right_node_summary_p", 0))) __PYX_ERR(0, 1218, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "right_node_summary_n", 0))) __PYX_ERR(0, 1219, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_42arr_evaluate_IT(__pyx_self, __pyx_v_left_node_summary_p, __pyx_v_left_node_summary_n, __pyx_v_right_node_summary_p, __pyx_v_right_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_42arr_evaluate_IT(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_node_summary_p, PyArrayObject *__pyx_v_left_node_summary_n, PyArrayObject *__pyx_v_right_node_summary_p, PyArrayObject *__pyx_v_right_node_summary_n) {
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_y_l_0;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_y_r_0;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_3;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_4;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_s_3;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_s_4;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_y_l_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_y_r_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_2;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_s_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_s_2;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sum_n;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_w_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_w_2;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_w_3;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_w_4;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sigma;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_g_s;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_left_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_left_node_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_right_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_right_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_IT", 0);
  __pyx_pybuffer_left_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_left_node_summary_p.refcount = 0;
  __pyx_pybuffernd_left_node_summary_p.data = NULL;
  __pyx_pybuffernd_left_node_summary_p.rcbuffer = &__pyx_pybuffer_left_node_summary_p;
  __pyx_pybuffer_left_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_left_node_summary_n.refcount = 0;
  __pyx_pybuffernd_left_node_summary_n.data = NULL;
  __pyx_pybuffernd_left_node_summary_n.rcbuffer = &__pyx_pybuffer_left_node_summary_n;
  __pyx_pybuffer_right_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_right_node_summary_p.refcount = 0;
  __pyx_pybuffernd_right_node_summary_p.data = NULL;
  __pyx_pybuffernd_right_node_summary_p.rcbuffer = &__pyx_pybuffer_right_node_summary_p;
  __pyx_pybuffer_right_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_right_node_summary_n.refcount = 0;
  __pyx_pybuffernd_right_node_summary_n.data = NULL;
  __pyx_pybuffernd_right_node_summary_n.rcbuffer = &__pyx_pybuffer_right_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  }
  __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  }
  __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  }
  __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  }
  __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1250
 *         ## Control Group
 *         # Sample mean in left & right child node
 *         cdef P_TYPE_t y_l_0 = left_node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t y_r_0 = right_node_summary_p[0]
 *         # Sample size left & right child node
 */
  __pyx_t_1 = 0;
  __pyx_v_y_l_0 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1251
 *         # Sample mean in left & right child node
 *         cdef P_TYPE_t y_l_0 = left_node_summary_p[0]
 *         cdef P_TYPE_t y_r_0 = right_node_summary_p[0]             # <<<<<<<<<<<<<<
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_3 = left_node_summary_n[0]
 */
  __pyx_t_1 = 0;
  __pyx_v_y_r_0 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1253
 *         cdef P_TYPE_t y_r_0 = right_node_summary_p[0]
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_3 = left_node_summary_n[0]             # <<<<<<<<<<<<<<
 *         cdef N_TYPE_t n_4 = right_node_summary_n[0]
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 */
  __pyx_t_1 = 0;
  __pyx_v_n_3 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1254
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_3 = left_node_summary_n[0]
 *         cdef N_TYPE_t n_4 = right_node_summary_n[0]             # <<<<<<<<<<<<<<
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         cdef P_TYPE_t s_3 = y_l_0*(1-y_l_0)
 */
  __pyx_t_1 = 0;
  __pyx_v_n_4 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1256
 *         cdef N_TYPE_t n_4 = right_node_summary_n[0]
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         cdef P_TYPE_t s_3 = y_l_0*(1-y_l_0)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t s_4 = y_r_0*(1-y_r_0)
 * 
 */
  __pyx_v_s_3 = (__pyx_v_y_l_0 * (1.0 - __pyx_v_y_l_0));

  /* "causalml/inference/tree/uplift.pyx":1257
 *         # Sample variance in left & right child node (p*(p-1) for bernoulli)
 *         cdef P_TYPE_t s_3 = y_l_0*(1-y_l_0)
 *         cdef P_TYPE_t s_4 = y_r_0*(1-y_r_0)             # <<<<<<<<<<<<<<
 * 
 *         # only one treatment, contrast with control, so no need to loop
 */
  __pyx_v_s_4 = (__pyx_v_y_r_0 * (1.0 - __pyx_v_y_r_0));

  /* "causalml/inference/tree/uplift.pyx":1262
 *         ## Treatment Group
 *         # Sample mean in left & right child node
 *         cdef P_TYPE_t y_l_1 = left_node_summary_p[1]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t y_r_1 = right_node_summary_p[1]
 *         # Sample size left & right child node
 */
  __pyx_t_1 = 1;
  __pyx_v_y_l_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1263
 *         # Sample mean in left & right child node
 *         cdef P_TYPE_t y_l_1 = left_node_summary_p[1]
 *         cdef P_TYPE_t y_r_1 = right_node_summary_p[1]             # <<<<<<<<<<<<<<
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_1 = left_node_summary_n[1]
 */
  __pyx_t_1 = 1;
  __pyx_v_y_r_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1265
 *         cdef P_TYPE_t y_r_1 = right_node_summary_p[1]
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_1 = left_node_summary_n[1]             # <<<<<<<<<<<<<<
 *         cdef N_TYPE_t n_2 = right_node_summary_n[1]
 *         # Sample variance in left & right child node
 */
  __pyx_t_1 = 1;
  __pyx_v_n_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1266
 *         # Sample size left & right child node
 *         cdef N_TYPE_t n_1 = left_node_summary_n[1]
 *         cdef N_TYPE_t n_2 = right_node_summary_n[1]             # <<<<<<<<<<<<<<
 *         # Sample variance in left & right child node
 *         cdef P_TYPE_t s_1 = y_l_1*(1-y_l_1)
 */
  __pyx_t_1 = 1;
  __pyx_v_n_2 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1268
 *         cdef N_TYPE_t n_2 = right_node_summary_n[1]
 *         # Sample variance in left & right child node
 *         cdef P_TYPE_t s_1 = y_l_1*(1-y_l_1)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t s_2 = y_r_1*(1-y_r_1)
 * 
 */
  __pyx_v_s_1 = (__pyx_v_y_l_1 * (1.0 - __pyx_v_y_l_1));

  /* "causalml/inference/tree/uplift.pyx":1269
 *         # Sample variance in left & right child node
 *         cdef P_TYPE_t s_1 = y_l_1*(1-y_l_1)
 *         cdef P_TYPE_t s_2 = y_r_1*(1-y_r_1)             # <<<<<<<<<<<<<<
 * 
 *         cdef P_TYPE_t sum_n = (n_1 - 1) + (n_2 - 1) + (n_3 - 1) + (n_4 - 1)
 */
  __pyx_v_s_2 = (__pyx_v_y_r_1 * (1.0 - __pyx_v_y_r_1));

  /* "causalml/inference/tree/uplift.pyx":1271
 *         cdef P_TYPE_t s_2 = y_r_1*(1-y_r_1)
 * 
 *         cdef P_TYPE_t sum_n = (n_1 - 1) + (n_2 - 1) + (n_3 - 1) + (n_4 - 1)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t w_1 = (n_1 - 1) / sum_n
 *         cdef P_TYPE_t w_2 = (n_2 - 1) / sum_n
 */
  __pyx_v_sum_n = ((((__pyx_v_n_1 - 1) + (__pyx_v_n_2 - 1)) + (__pyx_v_n_3 - 1)) + (__pyx_v_n_4 - 1));

  /* "causalml/inference/tree/uplift.pyx":1272
 * 
 *         cdef P_TYPE_t sum_n = (n_1 - 1) + (n_2 - 1) + (n_3 - 1) + (n_4 - 1)
 *         cdef P_TYPE_t w_1 = (n_1 - 1) / sum_n             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t w_2 = (n_2 - 1) / sum_n
 *         cdef P_TYPE_t w_3 = (n_3 - 1) / sum_n
 */
  __pyx_v_w_1 = (((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(__pyx_v_n_1 - 1)) / __pyx_v_sum_n);

  /* "causalml/inference/tree/uplift.pyx":1273
 *         cdef P_TYPE_t sum_n = (n_1 - 1) + (n_2 - 1) + (n_3 - 1) + (n_4 - 1)
 *         cdef P_TYPE_t w_1 = (n_1 - 1) / sum_n
 *         cdef P_TYPE_t w_2 = (n_2 - 1) / sum_n             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t w_3 = (n_3 - 1) / sum_n
 *         cdef P_TYPE_t w_4 = (n_4 - 1) / sum_n
 */
  __pyx_v_w_2 = (((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(__pyx_v_n_2 - 1)) / __pyx_v_sum_n);

  /* "causalml/inference/tree/uplift.pyx":1274
 *         cdef P_TYPE_t w_1 = (n_1 - 1) / sum_n
 *         cdef P_TYPE_t w_2 = (n_2 - 1) / sum_n
 *         cdef P_TYPE_t w_3 = (n_3 - 1) / sum_n             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t w_4 = (n_4 - 1) / sum_n
 * 
 */
  __pyx_v_w_3 = (((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(__pyx_v_n_3 - 1)) / __pyx_v_sum_n);

  /* "causalml/inference/tree/uplift.pyx":1275
 *         cdef P_TYPE_t w_2 = (n_2 - 1) / sum_n
 *         cdef P_TYPE_t w_3 = (n_3 - 1) / sum_n
 *         cdef P_TYPE_t w_4 = (n_4 - 1) / sum_n             # <<<<<<<<<<<<<<
 * 
 *         # Pooled estimator of the constant variance
 */
  __pyx_v_w_4 = (((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(__pyx_v_n_4 - 1)) / __pyx_v_sum_n);

  /* "causalml/inference/tree/uplift.pyx":1278
 * 
 *         # Pooled estimator of the constant variance
 *         cdef P_TYPE_t sigma = sqrt(w_1 * s_1 + w_2 * s_2 + w_3 * s_3 + w_4 * s_4)             # <<<<<<<<<<<<<<
 * 
 *         # Squared t-statistic
 */
  __pyx_v_sigma = sqrt(((((__pyx_v_w_1 * __pyx_v_s_1) + (__pyx_v_w_2 * __pyx_v_s_2)) + (__pyx_v_w_3 * __pyx_v_s_3)) + (__pyx_v_w_4 * __pyx_v_s_4)));

  /* "causalml/inference/tree/uplift.pyx":1281
 * 
 *         # Squared t-statistic
 *         cdef P_TYPE_t g_s = ((y_l_1 - y_l_0) - (y_r_1 - y_r_0)) / (sigma * sqrt(1.0 / n_1 + 1.0 / n_2 + 1.0 / n_3 + 1.0 / n_4))             # <<<<<<<<<<<<<<
 *         g_s = g_s * g_s
 * 
 */
  __pyx_v_g_s = (((__pyx_v_y_l_1 - __pyx_v_y_l_0) - (__pyx_v_y_r_1 - __pyx_v_y_r_0)) / (__pyx_v_sigma * sqrt(((((1.0 / ((double)__pyx_v_n_1)) + (1.0 / ((double)__pyx_v_n_2))) + (1.0 / ((double)__pyx_v_n_3))) + (1.0 / ((double)__pyx_v_n_4))))));

  /* "causalml/inference/tree/uplift.pyx":1282
 *         # Squared t-statistic
 *         cdef P_TYPE_t g_s = ((y_l_1 - y_l_0) - (y_r_1 - y_r_0)) / (sigma * sqrt(1.0 / n_1 + 1.0 / n_2 + 1.0 / n_3 + 1.0 / n_4))
 *         g_s = g_s * g_s             # <<<<<<<<<<<<<<
 * 
 *         return g_s
 */
  __pyx_v_g_s = (__pyx_v_g_s * __pyx_v_g_s);

  /* "causalml/inference/tree/uplift.pyx":1284
 *         g_s = g_s * g_s
 * 
 *         return g_s             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_g_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1216
 * 
 *     @staticmethod
 *     def arr_evaluate_IT(np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] left_node_summary_n,
 *                         np.ndarray[P_TYPE_t, ndim=1] right_node_summary_p,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  { 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_left_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_IT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1287
 * 
 *     @staticmethod
 *     def evaluate_CIT(currentNodeSummary, leftNodeSummary, rightNodeSummary, y_l, y_r, w_l, w_r, y, w):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate likelihood ratio test statistic as split evaluation criterion for a given node
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_45evaluate_CIT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_44evaluate_CIT[] = "\n        Calculate likelihood ratio test statistic as split evaluation criterion for a given node\n        Args\n        ----\n        currentNodeSummary: list of lists\n            The parent node summary statistics\n        leftNodeSummary : list of lists\n            The left node summary statistics.\n        rightNodeSummary : list of lists\n            The right node summary statistics.\n        y_l: array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit in the left node\n        y_r: array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit in the right node\n        w_l: array-like, shape = [num_samples]\n            An array containing the treatment for each unit in the left node\n        w_r: array-like, shape = [num_samples]\n            An array containing the treatment for each unit in the right node\n        y: array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit\n        w: array-like, shape = [num_samples]\n            An array containing the treatment for each unit\n        Returns\n        -------\n        lrt : Likelihood ratio test statistic\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_45evaluate_CIT = {"evaluate_CIT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_45evaluate_CIT, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_44evaluate_CIT};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_45evaluate_CIT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_currentNodeSummary = 0;
  PyObject *__pyx_v_leftNodeSummary = 0;
  PyObject *__pyx_v_rightNodeSummary = 0;
  PyObject *__pyx_v_y_l = 0;
  PyObject *__pyx_v_y_r = 0;
  PyObject *__pyx_v_w_l = 0;
  PyObject *__pyx_v_w_r = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_CIT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_currentNodeSummary,&__pyx_n_s_leftNodeSummary,&__pyx_n_s_rightNodeSummary,&__pyx_n_s_y_l,&__pyx_n_s_y_r,&__pyx_n_s_w_l,&__pyx_n_s_w_r,&__pyx_n_s_y,&__pyx_n_s_w,0};
    PyObject* values[9] = {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  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_currentNodeSummary)) != 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_leftNodeSummary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 1); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rightNodeSummary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 2); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 3); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 4); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 5); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 6); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 7); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, 8); __PYX_ERR(0, 1287, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_CIT") < 0)) __PYX_ERR(0, 1287, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_currentNodeSummary = values[0];
    __pyx_v_leftNodeSummary = values[1];
    __pyx_v_rightNodeSummary = values[2];
    __pyx_v_y_l = values[3];
    __pyx_v_y_r = values[4];
    __pyx_v_w_l = values[5];
    __pyx_v_w_r = values[6];
    __pyx_v_y = values[7];
    __pyx_v_w = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_CIT", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_CIT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_44evaluate_CIT(__pyx_self, __pyx_v_currentNodeSummary, __pyx_v_leftNodeSummary, __pyx_v_rightNodeSummary, __pyx_v_y_l, __pyx_v_y_r, __pyx_v_w_l, __pyx_v_w_r, __pyx_v_y, __pyx_v_w);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_44evaluate_CIT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_currentNodeSummary, PyObject *__pyx_v_leftNodeSummary, PyObject *__pyx_v_rightNodeSummary, PyObject *__pyx_v_y_l, PyObject *__pyx_v_y_r, PyObject *__pyx_v_w_l, PyObject *__pyx_v_w_r, PyObject *__pyx_v_y, PyObject *__pyx_v_w) {
  PyObject *__pyx_v_lrt = NULL;
  PyObject *__pyx_v_n_l_t_0 = NULL;
  PyObject *__pyx_v_n_r_t_0 = NULL;
  PyObject *__pyx_v_treatment_left = NULL;
  PyObject *__pyx_v_treatment_right = NULL;
  PyObject *__pyx_v_n_l_t_1 = NULL;
  PyObject *__pyx_v_n_r_t_1 = NULL;
  PyObject *__pyx_v_n_l_t = NULL;
  PyObject *__pyx_v_n_r_t = NULL;
  PyObject *__pyx_v_n_t = NULL;
  PyObject *__pyx_v_n_t_1 = NULL;
  PyObject *__pyx_v_n_t_0 = NULL;
  PyObject *__pyx_v_sse_tau_l = NULL;
  PyObject *__pyx_v_sse_tau_r = NULL;
  PyObject *__pyx_v_sse_tau = NULL;
  PyObject *__pyx_v_i_tau_l = NULL;
  PyObject *__pyx_v_i_tau_r = NULL;
  PyObject *__pyx_v_i_tau = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_CIT", 0);

  /* "causalml/inference/tree/uplift.pyx":1314
 *         lrt : Likelihood ratio test statistic
 *         '''
 *         lrt = 0             # <<<<<<<<<<<<<<
 * 
 *         # Control sample size left & right child node
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_lrt = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1317
 * 
 *         # Control sample size left & right child node
 *         n_l_t_0 = leftNodeSummary[0][1]             # <<<<<<<<<<<<<<
 *         n_r_t_0 = rightNodeSummary[0][1]
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_leftNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n_l_t_0 = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1318
 *         # Control sample size left & right child node
 *         n_l_t_0 = leftNodeSummary[0][1]
 *         n_r_t_0 = rightNodeSummary[0][1]             # <<<<<<<<<<<<<<
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_rightNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_n_r_t_0 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1320
 *         n_r_t_0 = rightNodeSummary[0][1]
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):             # <<<<<<<<<<<<<<
 *             # Treatment sample size left & right child node
 *             n_l_t_1 = treatment_left[1]
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_leftNodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_rightNodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1320, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1320, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1320, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1320, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1320, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1320, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1320, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_left, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_treatment_right, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":1322
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):
 *             # Treatment sample size left & right child node
 *             n_l_t_1 = treatment_left[1]             # <<<<<<<<<<<<<<
 *             n_r_t_1 = treatment_right[1]
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_left, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_l_t_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1323
 *             # Treatment sample size left & right child node
 *             n_l_t_1 = treatment_left[1]
 *             n_r_t_1 = treatment_right[1]             # <<<<<<<<<<<<<<
 * 
 *             # Total size of left & right node
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_right, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_r_t_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1326
 * 
 *             # Total size of left & right node
 *             n_l_t = n_l_t_1 + n_l_t_0             # <<<<<<<<<<<<<<
 *             n_r_t = n_r_t_1 + n_r_t_0
 * 
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_n_l_t_1, __pyx_v_n_l_t_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_l_t, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1327
 *             # Total size of left & right node
 *             n_l_t = n_l_t_1 + n_l_t_0
 *             n_r_t = n_r_t_1 + n_r_t_0             # <<<<<<<<<<<<<<
 * 
 *             # Total size of parent node
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_n_r_t_1, __pyx_v_n_r_t_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_r_t, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1330
 * 
 *             # Total size of parent node
 *             n_t = n_l_t + n_r_t             # <<<<<<<<<<<<<<
 * 
 *             # Total treatment & control size in parent node
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_n_l_t, __pyx_v_n_r_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_t, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1333
 * 
 *             # Total treatment & control size in parent node
 *             n_t_1 = n_l_t_1 + n_r_t_1             # <<<<<<<<<<<<<<
 *             n_t_0 = n_l_t_0 + n_r_t_0
 * 
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_n_l_t_1, __pyx_v_n_r_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_t_1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1334
 *             # Total treatment & control size in parent node
 *             n_t_1 = n_l_t_1 + n_r_t_1
 *             n_t_0 = n_l_t_0 + n_r_t_0             # <<<<<<<<<<<<<<
 * 
 *             # Standard squared error of left child node
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_n_l_t_0, __pyx_v_n_r_t_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_t_0, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1337
 * 
 *             # Standard squared error of left child node
 *             sse_tau_l = np.sum(np.power(y_l[w_l == 1] - treatment_left[0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y_l[w_l == 0] - treatment_left[0], 2))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_power); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_v_w_l, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_y_l, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_treatment_left, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = PyNumber_Subtract(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_11, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_11, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_11);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_11 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "causalml/inference/tree/uplift.pyx":1338
 *             # Standard squared error of left child node
 *             sse_tau_l = np.sum(np.power(y_l[w_l == 1] - treatment_left[0], 2)) + np.sum(
 *                 np.power(y_l[w_l == 0] - treatment_left[0], 2))             # <<<<<<<<<<<<<<
 * 
 *             # Standard squared error of right child node
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_power); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_v_w_l, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_y_l, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_treatment_left, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_13, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_13, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_12, __pyx_t_13);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_13 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_11, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "causalml/inference/tree/uplift.pyx":1337
 * 
 *             # Standard squared error of left child node
 *             sse_tau_l = np.sum(np.power(y_l[w_l == 1] - treatment_left[0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y_l[w_l == 0] - treatment_left[0], 2))
 * 
 */
    __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sse_tau_l, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "causalml/inference/tree/uplift.pyx":1341
 * 
 *             # Standard squared error of right child node
 *             sse_tau_r = np.sum(np.power(y_r[w_r == 1] - treatment_right[0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y_r[w_r == 0] - treatment_right[0], 2))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_power); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_w_r, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_y_r, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_treatment_right, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_13 = PyNumber_Subtract(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_13, __pyx_int_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_13, __pyx_int_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_12, __pyx_t_13);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_13 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":1342
 *             # Standard squared error of right child node
 *             sse_tau_r = np.sum(np.power(y_r[w_r == 1] - treatment_right[0], 2)) + np.sum(
 *                 np.power(y_r[w_r == 0] - treatment_right[0], 2))             # <<<<<<<<<<<<<<
 * 
 *             # Standard squared error of parent child node
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_power); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_v_w_r, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_y_r, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_treatment_right, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = PyNumber_Subtract(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_10, __pyx_int_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_10, __pyx_int_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_12, __pyx_t_10);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_10 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_13, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":1341
 * 
 *             # Standard squared error of right child node
 *             sse_tau_r = np.sum(np.power(y_r[w_r == 1] - treatment_right[0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y_r[w_r == 0] - treatment_right[0], 2))
 * 
 */
    __pyx_t_11 = PyNumber_Add(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sse_tau_r, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":1345
 * 
 *             # Standard squared error of parent child node
 *             sse_tau = np.sum(np.power(y[w == 1] - currentNodeSummary[1][0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y[w == 0] - currentNodeSummary[0][0], 2))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_power); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_w, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_currentNodeSummary, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_12, __pyx_t_1);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_11 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_13, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1346
 *             # Standard squared error of parent child node
 *             sse_tau = np.sum(np.power(y[w == 1] - currentNodeSummary[1][0], 2)) + np.sum(
 *                 np.power(y[w == 0] - currentNodeSummary[0][0], 2))             # <<<<<<<<<<<<<<
 * 
 *             # Maximized log-likelihood function
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_power); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_w, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_currentNodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_2};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_12, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "causalml/inference/tree/uplift.pyx":1345
 * 
 *             # Standard squared error of parent child node
 *             sse_tau = np.sum(np.power(y[w == 1] - currentNodeSummary[1][0], 2)) + np.sum(             # <<<<<<<<<<<<<<
 *                 np.power(y[w == 0] - currentNodeSummary[0][0], 2))
 * 
 */
    __pyx_t_13 = PyNumber_Add(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sse_tau, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "causalml/inference/tree/uplift.pyx":1349
 * 
 *             # Maximized log-likelihood function
 *             i_tau_l = - (n_l_t / 2) * np.log(n_l_t * sse_tau_l) + n_l_t_1 * np.log(n_l_t_1) + n_l_t_0 * np.log(n_l_t_0)             # <<<<<<<<<<<<<<
 *             i_tau_r = - (n_r_t / 2) * np.log(n_r_t * sse_tau_r) + n_r_t_1 * np.log(n_r_t_1) + n_r_t_0 * np.log(n_r_t_0)
 *             i_tau = - (n_t / 2) * np.log(n_t * sse_tau) + n_t_1 * np.log(n_t_1) + n_t_0 * np.log(n_t_0)
 */
    __pyx_t_13 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_n_l_t, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_9 = PyNumber_Negative(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_v_n_l_t, __pyx_v_sse_tau_l); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_13 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_13 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_v_n_l_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_n_l_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_v_n_l_t_1, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_2, __pyx_v_n_l_t_0) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_n_l_t_0);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_n_l_t_0, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_i_tau_l, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":1350
 *             # Maximized log-likelihood function
 *             i_tau_l = - (n_l_t / 2) * np.log(n_l_t * sse_tau_l) + n_l_t_1 * np.log(n_l_t_1) + n_l_t_0 * np.log(n_l_t_0)
 *             i_tau_r = - (n_r_t / 2) * np.log(n_r_t * sse_tau_r) + n_r_t_1 * np.log(n_r_t_1) + n_r_t_0 * np.log(n_r_t_0)             # <<<<<<<<<<<<<<
 *             i_tau = - (n_t / 2) * np.log(n_t * sse_tau) + n_t_1 * np.log(n_t_1) + n_t_0 * np.log(n_t_0)
 * 
 */
    __pyx_t_11 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_n_r_t, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = PyNumber_Negative(__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Multiply(__pyx_v_n_r_t, __pyx_v_sse_tau_r); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_11 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_log); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    __pyx_t_11 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_9, __pyx_v_n_r_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_n_r_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Multiply(__pyx_v_n_r_t_1, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_13 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_2, __pyx_v_n_r_t_0) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_n_r_t_0);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_n_r_t_0, __pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Add(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_i_tau_r, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "causalml/inference/tree/uplift.pyx":1351
 *             i_tau_l = - (n_l_t / 2) * np.log(n_l_t * sse_tau_l) + n_l_t_1 * np.log(n_l_t_1) + n_l_t_0 * np.log(n_l_t_0)
 *             i_tau_r = - (n_r_t / 2) * np.log(n_r_t * sse_tau_r) + n_r_t_1 * np.log(n_r_t_1) + n_r_t_0 * np.log(n_r_t_0)
 *             i_tau = - (n_t / 2) * np.log(n_t * sse_tau) + n_t_1 * np.log(n_t_1) + n_t_0 * np.log(n_t_0)             # <<<<<<<<<<<<<<
 * 
 *             # Likelihood ration test statistic
 */
    __pyx_t_13 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_n_t, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_9 = PyNumber_Negative(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_v_n_t, __pyx_v_sse_tau); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_13 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_log); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_13 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_v_n_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_n_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_v_n_t_1, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_2, __pyx_v_n_t_0) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_n_t_0);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_n_t_0, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Add(__pyx_t_13, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_i_tau, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":1354
 * 
 *             # Likelihood ration test statistic
 *             lrt = 2 * (i_tau_l + i_tau_r - i_tau)             # <<<<<<<<<<<<<<
 * 
 *         return lrt
 */
    __pyx_t_11 = PyNumber_Add(__pyx_v_i_tau_l, __pyx_v_i_tau_r); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_11, __pyx_v_i_tau); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_int_2, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF_SET(__pyx_v_lrt, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "causalml/inference/tree/uplift.pyx":1320
 *         n_r_t_0 = rightNodeSummary[0][1]
 * 
 *         for treatment_left, treatment_right in zip(leftNodeSummary[1:], rightNodeSummary[1:]):             # <<<<<<<<<<<<<<
 *             # Treatment sample size left & right child node
 *             n_l_t_1 = treatment_left[1]
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1356
 *             lrt = 2 * (i_tau_l + i_tau_r - i_tau)
 * 
 *         return lrt             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_lrt);
  __pyx_r = __pyx_v_lrt;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1287
 * 
 *     @staticmethod
 *     def evaluate_CIT(currentNodeSummary, leftNodeSummary, rightNodeSummary, y_l, y_r, w_l, w_r, y, w):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate likelihood ratio test statistic as split evaluation criterion for a given node
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_CIT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lrt);
  __Pyx_XDECREF(__pyx_v_n_l_t_0);
  __Pyx_XDECREF(__pyx_v_n_r_t_0);
  __Pyx_XDECREF(__pyx_v_treatment_left);
  __Pyx_XDECREF(__pyx_v_treatment_right);
  __Pyx_XDECREF(__pyx_v_n_l_t_1);
  __Pyx_XDECREF(__pyx_v_n_r_t_1);
  __Pyx_XDECREF(__pyx_v_n_l_t);
  __Pyx_XDECREF(__pyx_v_n_r_t);
  __Pyx_XDECREF(__pyx_v_n_t);
  __Pyx_XDECREF(__pyx_v_n_t_1);
  __Pyx_XDECREF(__pyx_v_n_t_0);
  __Pyx_XDECREF(__pyx_v_sse_tau_l);
  __Pyx_XDECREF(__pyx_v_sse_tau_r);
  __Pyx_XDECREF(__pyx_v_sse_tau);
  __Pyx_XDECREF(__pyx_v_i_tau_l);
  __Pyx_XDECREF(__pyx_v_i_tau_r);
  __Pyx_XDECREF(__pyx_v_i_tau);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1359
 * 
 *     @staticmethod
 *     def arr_evaluate_CIT(np.ndarray[P_TYPE_t, ndim=1] cur_node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] cur_node_summary_n,
 *                          np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_47arr_evaluate_CIT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_46arr_evaluate_CIT[] = "\n        Calculate likelihood ratio test statistic as split evaluation criterion for a given node\n        \n        NOTE: n_class should be 2.\n\n        Args\n        ----\n        cur_node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        cur_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n        left_node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the left node, i.e. [P(Y=1|T=i)...]\n        left_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the left node, i.e. [N(T=i)...]\n        right_node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the right node, i.e. [P(Y=1|T=i)...]\n        right_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the right node, i.e. [N(T=i)...]\n                \n        Returns\n        -------\n        lrt : Likelihood ratio test statistic\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_47arr_evaluate_CIT = {"arr_evaluate_CIT", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_47arr_evaluate_CIT, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_46arr_evaluate_CIT};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_47arr_evaluate_CIT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_cur_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_cur_node_summary_n = 0;
  PyArrayObject *__pyx_v_left_node_summary_p = 0;
  PyArrayObject *__pyx_v_left_node_summary_n = 0;
  PyArrayObject *__pyx_v_right_node_summary_p = 0;
  PyArrayObject *__pyx_v_right_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_CIT (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cur_node_summary_p,&__pyx_n_s_cur_node_summary_n,&__pyx_n_s_left_node_summary_p,&__pyx_n_s_left_node_summary_n,&__pyx_n_s_right_node_summary_p,&__pyx_n_s_right_node_summary_n,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cur_node_summary_p)) != 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_cur_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, 1); __PYX_ERR(0, 1359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_node_summary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, 2); __PYX_ERR(0, 1359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, 3); __PYX_ERR(0, 1359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_node_summary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, 4); __PYX_ERR(0, 1359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, 5); __PYX_ERR(0, 1359, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_CIT") < 0)) __PYX_ERR(0, 1359, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_cur_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_cur_node_summary_n = ((PyArrayObject *)values[1]);
    __pyx_v_left_node_summary_p = ((PyArrayObject *)values[2]);
    __pyx_v_left_node_summary_n = ((PyArrayObject *)values[3]);
    __pyx_v_right_node_summary_p = ((PyArrayObject *)values[4]);
    __pyx_v_right_node_summary_n = ((PyArrayObject *)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_CIT", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1359, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_CIT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cur_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "cur_node_summary_p", 0))) __PYX_ERR(0, 1359, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cur_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "cur_node_summary_n", 0))) __PYX_ERR(0, 1360, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "left_node_summary_p", 0))) __PYX_ERR(0, 1361, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "left_node_summary_n", 0))) __PYX_ERR(0, 1362, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "right_node_summary_p", 0))) __PYX_ERR(0, 1363, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "right_node_summary_n", 0))) __PYX_ERR(0, 1364, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_46arr_evaluate_CIT(__pyx_self, __pyx_v_cur_node_summary_p, __pyx_v_cur_node_summary_n, __pyx_v_left_node_summary_p, __pyx_v_left_node_summary_n, __pyx_v_right_node_summary_p, __pyx_v_right_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_46arr_evaluate_CIT(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_cur_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_cur_node_summary_n, PyArrayObject *__pyx_v_left_node_summary_p, PyArrayObject *__pyx_v_left_node_summary_n, PyArrayObject *__pyx_v_right_node_summary_p, PyArrayObject *__pyx_v_right_node_summary_n) {
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_lrt;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_l_t_0;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_r_t_0;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_l_t_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_r_t_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_l_t;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_r_t;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_t;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_t_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_t_0;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sse_tau_l;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sse_tau_r;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sse_tau;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_i_tau_l;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_i_tau_r;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_i_tau;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cur_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_cur_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cur_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_cur_node_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_left_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_left_node_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_right_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_right_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_CIT", 0);
  __pyx_pybuffer_cur_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_cur_node_summary_p.refcount = 0;
  __pyx_pybuffernd_cur_node_summary_p.data = NULL;
  __pyx_pybuffernd_cur_node_summary_p.rcbuffer = &__pyx_pybuffer_cur_node_summary_p;
  __pyx_pybuffer_cur_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_cur_node_summary_n.refcount = 0;
  __pyx_pybuffernd_cur_node_summary_n.data = NULL;
  __pyx_pybuffernd_cur_node_summary_n.rcbuffer = &__pyx_pybuffer_cur_node_summary_n;
  __pyx_pybuffer_left_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_left_node_summary_p.refcount = 0;
  __pyx_pybuffernd_left_node_summary_p.data = NULL;
  __pyx_pybuffernd_left_node_summary_p.rcbuffer = &__pyx_pybuffer_left_node_summary_p;
  __pyx_pybuffer_left_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_left_node_summary_n.refcount = 0;
  __pyx_pybuffernd_left_node_summary_n.data = NULL;
  __pyx_pybuffernd_left_node_summary_n.rcbuffer = &__pyx_pybuffer_left_node_summary_n;
  __pyx_pybuffer_right_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_right_node_summary_p.refcount = 0;
  __pyx_pybuffernd_right_node_summary_p.data = NULL;
  __pyx_pybuffernd_right_node_summary_p.rcbuffer = &__pyx_pybuffer_right_node_summary_p;
  __pyx_pybuffer_right_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_right_node_summary_n.refcount = 0;
  __pyx_pybuffernd_right_node_summary_n.data = NULL;
  __pyx_pybuffernd_right_node_summary_n.rcbuffer = &__pyx_pybuffer_right_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_cur_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_cur_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cur_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cur_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_cur_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_cur_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_cur_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cur_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_cur_node_summary_n.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1401
 *         lrt : Likelihood ratio test statistic
 *         '''
 *         cdef P_TYPE_t lrt = 0.0             # <<<<<<<<<<<<<<
 * 
 *         # since will take log of these N, so use a double type
 */
  __pyx_v_lrt = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1406
 * 
 *         # Control sample size left & right child node
 *         cdef P_TYPE_t n_l_t_0 = left_node_summary_n[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_r_t_0 = right_node_summary_n[0]
 * 
 */
  __pyx_t_1 = 0;
  __pyx_v_n_l_t_0 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1407
 *         # Control sample size left & right child node
 *         cdef P_TYPE_t n_l_t_0 = left_node_summary_n[0]
 *         cdef P_TYPE_t n_r_t_0 = right_node_summary_n[0]             # <<<<<<<<<<<<<<
 * 
 *         # Treatment sample size left & right child node
 */
  __pyx_t_1 = 0;
  __pyx_v_n_r_t_0 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1410
 * 
 *         # Treatment sample size left & right child node
 *         cdef P_TYPE_t n_l_t_1 = left_node_summary_n[1]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_r_t_1 = right_node_summary_n[1]
 * 
 */
  __pyx_t_1 = 1;
  __pyx_v_n_l_t_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1411
 *         # Treatment sample size left & right child node
 *         cdef P_TYPE_t n_l_t_1 = left_node_summary_n[1]
 *         cdef P_TYPE_t n_r_t_1 = right_node_summary_n[1]             # <<<<<<<<<<<<<<
 * 
 *         # Total size of left & right node
 */
  __pyx_t_1 = 1;
  __pyx_v_n_r_t_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1414
 * 
 *         # Total size of left & right node
 *         cdef P_TYPE_t n_l_t = n_l_t_1 + n_l_t_0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_r_t = n_r_t_1 + n_r_t_0
 * 
 */
  __pyx_v_n_l_t = (__pyx_v_n_l_t_1 + __pyx_v_n_l_t_0);

  /* "causalml/inference/tree/uplift.pyx":1415
 *         # Total size of left & right node
 *         cdef P_TYPE_t n_l_t = n_l_t_1 + n_l_t_0
 *         cdef P_TYPE_t n_r_t = n_r_t_1 + n_r_t_0             # <<<<<<<<<<<<<<
 * 
 *         # Total size of parent node
 */
  __pyx_v_n_r_t = (__pyx_v_n_r_t_1 + __pyx_v_n_r_t_0);

  /* "causalml/inference/tree/uplift.pyx":1418
 * 
 *         # Total size of parent node
 *         cdef P_TYPE_t n_t = n_l_t + n_r_t             # <<<<<<<<<<<<<<
 * 
 *         # Total treatment & control size in parent node
 */
  __pyx_v_n_t = (__pyx_v_n_l_t + __pyx_v_n_r_t);

  /* "causalml/inference/tree/uplift.pyx":1421
 * 
 *         # Total treatment & control size in parent node
 *         cdef P_TYPE_t n_t_1 = n_l_t_1 + n_r_t_1             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_t_0 = n_l_t_0 + n_r_t_0
 * 
 */
  __pyx_v_n_t_1 = (__pyx_v_n_l_t_1 + __pyx_v_n_r_t_1);

  /* "causalml/inference/tree/uplift.pyx":1422
 *         # Total treatment & control size in parent node
 *         cdef P_TYPE_t n_t_1 = n_l_t_1 + n_r_t_1
 *         cdef P_TYPE_t n_t_0 = n_l_t_0 + n_r_t_0             # <<<<<<<<<<<<<<
 * 
 *         # NOTE: the original code for sse_tau_l and sse_tau_r does not seem to follow the paper.
 */
  __pyx_v_n_t_0 = (__pyx_v_n_l_t_0 + __pyx_v_n_r_t_0);

  /* "causalml/inference/tree/uplift.pyx":1431
 * 
 *         # Standard squared error of left child node
 *         cdef P_TYPE_t sse_tau_l = n_l_t_0 * left_node_summary_p[0] * (1.0 - left_node_summary_p[0]) + n_l_t_1 * left_node_summary_p[1] * (1.0 - left_node_summary_p[1])             # <<<<<<<<<<<<<<
 * 
 *         # Standard squared error of right child node
 */
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 1;
  __pyx_t_4 = 1;
  __pyx_v_sse_tau_l = (((__pyx_v_n_l_t_0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides)))) + ((__pyx_v_n_l_t_1 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_left_node_summary_p.diminfo[0].strides)))));

  /* "causalml/inference/tree/uplift.pyx":1434
 * 
 *         # Standard squared error of right child node
 *         cdef P_TYPE_t sse_tau_r = n_r_t_0 * right_node_summary_p[0] * (1.0 - right_node_summary_p[0]) + n_r_t_1 * right_node_summary_p[1] * (1.0 - right_node_summary_p[1])             # <<<<<<<<<<<<<<
 * 
 *         # Standard squared error of parent child node
 */
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 1;
  __pyx_t_1 = 1;
  __pyx_v_sse_tau_r = (((__pyx_v_n_r_t_0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides)))) + ((__pyx_v_n_r_t_1 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_right_node_summary_p.diminfo[0].strides)))));

  /* "causalml/inference/tree/uplift.pyx":1437
 * 
 *         # Standard squared error of parent child node
 *         cdef P_TYPE_t sse_tau = n_t_0 * cur_node_summary_p[0] * (1.0 - cur_node_summary_p[0]) + n_t_1 * cur_node_summary_p[1] * (1.0 - cur_node_summary_p[1])             # <<<<<<<<<<<<<<
 * 
 *         # Maximized log-likelihood function
 */
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 1;
  __pyx_t_4 = 1;
  __pyx_v_sse_tau = (((__pyx_v_n_t_0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_cur_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_cur_node_summary_p.diminfo[0].strides)))) + ((__pyx_v_n_t_1 * (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_cur_node_summary_p.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_cur_node_summary_p.diminfo[0].strides)))));

  /* "causalml/inference/tree/uplift.pyx":1440
 * 
 *         # Maximized log-likelihood function
 *         cdef P_TYPE_t i_tau_l = - (n_l_t / 2.0) * log(n_l_t * sse_tau_l) + n_l_t_1 * log(n_l_t_1) + n_l_t_0 * log(n_l_t_0)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t i_tau_r = - (n_r_t / 2.0) * log(n_r_t * sse_tau_r) + n_r_t_1 * log(n_r_t_1) + n_r_t_0 * log(n_r_t_0)
 *         cdef P_TYPE_t i_tau = - (n_t / 2.0) * log(n_t * sse_tau) + n_t_1 * log(n_t_1) + n_t_0 * log(n_t_0)
 */
  __pyx_v_i_tau_l = ((((-(__pyx_v_n_l_t / ((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)2.0))) * log((__pyx_v_n_l_t * __pyx_v_sse_tau_l))) + (__pyx_v_n_l_t_1 * log(__pyx_v_n_l_t_1))) + (__pyx_v_n_l_t_0 * log(__pyx_v_n_l_t_0)));

  /* "causalml/inference/tree/uplift.pyx":1441
 *         # Maximized log-likelihood function
 *         cdef P_TYPE_t i_tau_l = - (n_l_t / 2.0) * log(n_l_t * sse_tau_l) + n_l_t_1 * log(n_l_t_1) + n_l_t_0 * log(n_l_t_0)
 *         cdef P_TYPE_t i_tau_r = - (n_r_t / 2.0) * log(n_r_t * sse_tau_r) + n_r_t_1 * log(n_r_t_1) + n_r_t_0 * log(n_r_t_0)             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t i_tau = - (n_t / 2.0) * log(n_t * sse_tau) + n_t_1 * log(n_t_1) + n_t_0 * log(n_t_0)
 * 
 */
  __pyx_v_i_tau_r = ((((-(__pyx_v_n_r_t / ((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)2.0))) * log((__pyx_v_n_r_t * __pyx_v_sse_tau_r))) + (__pyx_v_n_r_t_1 * log(__pyx_v_n_r_t_1))) + (__pyx_v_n_r_t_0 * log(__pyx_v_n_r_t_0)));

  /* "causalml/inference/tree/uplift.pyx":1442
 *         cdef P_TYPE_t i_tau_l = - (n_l_t / 2.0) * log(n_l_t * sse_tau_l) + n_l_t_1 * log(n_l_t_1) + n_l_t_0 * log(n_l_t_0)
 *         cdef P_TYPE_t i_tau_r = - (n_r_t / 2.0) * log(n_r_t * sse_tau_r) + n_r_t_1 * log(n_r_t_1) + n_r_t_0 * log(n_r_t_0)
 *         cdef P_TYPE_t i_tau = - (n_t / 2.0) * log(n_t * sse_tau) + n_t_1 * log(n_t_1) + n_t_0 * log(n_t_0)             # <<<<<<<<<<<<<<
 * 
 *         # Likelihood ration test statistic
 */
  __pyx_v_i_tau = ((((-(__pyx_v_n_t / ((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)2.0))) * log((__pyx_v_n_t * __pyx_v_sse_tau))) + (__pyx_v_n_t_1 * log(__pyx_v_n_t_1))) + (__pyx_v_n_t_0 * log(__pyx_v_n_t_0)));

  /* "causalml/inference/tree/uplift.pyx":1445
 * 
 *         # Likelihood ration test statistic
 *         lrt = 2 * (i_tau_l + i_tau_r - i_tau)             # <<<<<<<<<<<<<<
 * 
 *         return lrt
 */
  __pyx_v_lrt = (2.0 * ((__pyx_v_i_tau_l + __pyx_v_i_tau_r) - __pyx_v_i_tau));

  /* "causalml/inference/tree/uplift.pyx":1447
 *         lrt = 2 * (i_tau_l + i_tau_r - i_tau)
 * 
 *         return lrt             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_lrt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1359
 * 
 *     @staticmethod
 *     def arr_evaluate_CIT(np.ndarray[P_TYPE_t, ndim=1] cur_node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] cur_node_summary_n,
 *                          np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_CIT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_node_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_node_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1450
 * 
 *     @staticmethod
 *     def evaluate_IDDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_49evaluate_IDDP(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_48evaluate_IDDP[] = "\n        Calculate Delta P as split evaluation criterion for a given node.\n        \n        Args\n        ----\n        nodeSummary : dictionary\n            The tree node summary statistics, produced by tree_node_summary() method.\n        control_name : string\n            The control group name.\n        Returns\n        -------\n        d_res : Delta P\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_49evaluate_IDDP = {"evaluate_IDDP", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_49evaluate_IDDP, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_48evaluate_IDDP};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_49evaluate_IDDP(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_IDDP (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_48evaluate_IDDP(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_48evaluate_IDDP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_d_res = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_IDDP", 0);

  /* "causalml/inference/tree/uplift.pyx":1464
 *         d_res : Delta P
 *         '''
 *         pc = nodeSummary[0][0]             # <<<<<<<<<<<<<<
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nodeSummary, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1465
 *         '''
 *         pc = nodeSummary[0][0]
 *         d_res = 0             # <<<<<<<<<<<<<<
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_d_res = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":1466
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += treatment_group[0] - pc
 *         return d_res
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_nodeSummary, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1466, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1466, __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, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1466, __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, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1466, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1467
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_treatment_group, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_pc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_d_res, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_d_res, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1466
 *         pc = nodeSummary[0][0]
 *         d_res = 0
 *         for treatment_group in nodeSummary[1:]:             # <<<<<<<<<<<<<<
 *             d_res += treatment_group[0] - pc
 *         return d_res
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1468
 *         for treatment_group in nodeSummary[1:]:
 *             d_res += treatment_group[0] - pc
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_d_res);
  __pyx_r = __pyx_v_d_res;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1450
 * 
 *     @staticmethod
 *     def evaluate_IDDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_IDDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_d_res);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1471
 * 
 *     @staticmethod
 *     def arr_evaluate_IDDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                           np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_51arr_evaluate_IDDP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_50arr_evaluate_IDDP[] = "\n        Calculate Delta P as split evaluation criterion for a given node.\n        \n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : Delta P\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_51arr_evaluate_IDDP = {"arr_evaluate_IDDP", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_51arr_evaluate_IDDP, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_50arr_evaluate_IDDP};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_51arr_evaluate_IDDP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_IDDP (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_IDDP", 1, 2, 2, 1); __PYX_ERR(0, 1471, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_IDDP") < 0)) __PYX_ERR(0, 1471, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_IDDP", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1471, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_IDDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 1471, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 1472, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_50arr_evaluate_IDDP(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_50arr_evaluate_IDDP(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_IDDP", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1471, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1471, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1491
 *         d_res : Delta P
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":1492
 *         '''
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 */
  __pyx_t_1 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1493
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for i in range(1, n_class):
 */
  __pyx_v_d_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1494
 *         cdef P_TYPE_t p_c = node_summary_p[0]
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1495
 *         cdef P_TYPE_t d_res = 0.0
 *         cdef int i = 0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             d_res += node_summary_p[i] - p_c
 *         return d_res
 */
  __pyx_t_2 = __pyx_v_n_class;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "causalml/inference/tree/uplift.pyx":1496
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c             # <<<<<<<<<<<<<<
 *         return d_res
 * 
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_v_d_res = (__pyx_v_d_res + ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) - __pyx_v_p_c));
  }

  /* "causalml/inference/tree/uplift.pyx":1497
 *         for i in range(1, n_class):
 *             d_res += node_summary_p[i] - p_c
 *         return d_res             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_d_res); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1471
 * 
 *     @staticmethod
 *     def arr_evaluate_IDDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                           np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_IDDP", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1500
 * 
 *     @staticmethod
 *     def evaluate_CTS(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_53evaluate_CTS(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_52evaluate_CTS[] = "\n        Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.\n\n        Args\n        ----\n        nodeSummary : list of list\n            The tree node summary statistics, [P(Y=1|T), N(T)], produced by tree_node_summary() method.\n\n        Returns\n        -------\n        d_res : CTS score\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_53evaluate_CTS = {"evaluate_CTS", (PyCFunction)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_53evaluate_CTS, METH_O, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_52evaluate_CTS};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_53evaluate_CTS(PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_CTS (wrapper)", 0);
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_52evaluate_CTS(__pyx_self, ((PyObject *)__pyx_v_nodeSummary));

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_52evaluate_CTS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nodeSummary) {
  PyObject *__pyx_8genexpr1__pyx_v_stat = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_CTS", 0);

  /* "causalml/inference/tree/uplift.pyx":1513
 *         d_res : CTS score
 *         '''
 *         return -max([stat[0] for stat in nodeSummary])             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1513, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_nodeSummary)) || PyTuple_CheckExact(__pyx_v_nodeSummary)) {
      __pyx_t_2 = __pyx_v_nodeSummary; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_nodeSummary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1513, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1513, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1513, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1513, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1513, __pyx_L5_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1513, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1513, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_stat, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_stat, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1513, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1513, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_stat); __pyx_8genexpr1__pyx_v_stat = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_stat); __pyx_8genexpr1__pyx_v_stat = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1513, __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;

  /* "causalml/inference/tree/uplift.pyx":1500
 * 
 *     @staticmethod
 *     def evaluate_CTS(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.evaluate_CTS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_stat);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1516
 * 
 *     @staticmethod
 *     def arr_evaluate_CTS(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_55arr_evaluate_CTS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_54arr_evaluate_CTS[] = "\n        Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.\n\n        Args\n        ----\n        node_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            The positive probabilities of each of the control\n            and treament groups of the current node, i.e. [P(Y=1|T=i)...]\n        node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        Returns\n        -------\n        d_res : CTS score\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_55arr_evaluate_CTS = {"arr_evaluate_CTS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_55arr_evaluate_CTS, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_54arr_evaluate_CTS};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_55arr_evaluate_CTS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_node_summary_p = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_evaluate_CTS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node_summary_p,&__pyx_n_s_node_summary_n,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_node_summary_p)) != 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_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_evaluate_CTS", 1, 2, 2, 1); __PYX_ERR(0, 1516, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_evaluate_CTS") < 0)) __PYX_ERR(0, 1516, __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_node_summary_p = ((PyArrayObject *)values[0]);
    __pyx_v_node_summary_n = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_evaluate_CTS", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_CTS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_p), __pyx_ptype_5numpy_ndarray, 1, "node_summary_p", 0))) __PYX_ERR(0, 1516, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_summary_n), __pyx_ptype_5numpy_ndarray, 1, "node_summary_n", 0))) __PYX_ERR(0, 1517, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_54arr_evaluate_CTS(__pyx_self, __pyx_v_node_summary_p, __pyx_v_node_summary_n);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_54arr_evaluate_CTS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_node_summary_p, CYTHON_UNUSED PyArrayObject *__pyx_v_node_summary_n) {
  int __pyx_v_n_class;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_d_res;
  int __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_n;
  __Pyx_Buffer __pyx_pybuffer_node_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_summary_p;
  __Pyx_Buffer __pyx_pybuffer_node_summary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_evaluate_CTS", 0);
  __pyx_pybuffer_node_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_p.refcount = 0;
  __pyx_pybuffernd_node_summary_p.data = NULL;
  __pyx_pybuffernd_node_summary_p.rcbuffer = &__pyx_pybuffer_node_summary_p;
  __pyx_pybuffer_node_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_node_summary_n.refcount = 0;
  __pyx_pybuffernd_node_summary_n.data = NULL;
  __pyx_pybuffernd_node_summary_n.rcbuffer = &__pyx_pybuffer_node_summary_n;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1516, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_p.diminfo[0].strides = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_p.diminfo[0].shape = __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1516, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_summary_n.diminfo[0].strides = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_summary_n.diminfo[0].shape = __pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1538
 *         # not sure why use negative for CTS, but in calculating the
 *         # gain, it is adjusted back so as to maximize the gain.
 *         cdef int n_class = node_summary_p.shape[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t d_res = node_summary_p[0]
 *         cdef int i = 0
 */
  __pyx_v_n_class = (__pyx_v_node_summary_p->dimensions[0]);

  /* "causalml/inference/tree/uplift.pyx":1539
 *         # gain, it is adjusted back so as to maximize the gain.
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t d_res = node_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         for i in range(1, n_class):
 */
  __pyx_t_1 = 0;
  __pyx_v_d_res = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":1540
 *         cdef int n_class = node_summary_p.shape[0]
 *         cdef P_TYPE_t d_res = node_summary_p[0]
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         for i in range(1, n_class):
 *             if node_summary_p[i] > d_res:
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1541
 *         cdef P_TYPE_t d_res = node_summary_p[0]
 *         cdef int i = 0
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             if node_summary_p[i] > d_res:
 *                 d_res = node_summary_p[i]
 */
  __pyx_t_2 = __pyx_v_n_class;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "causalml/inference/tree/uplift.pyx":1542
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             if node_summary_p[i] > d_res:             # <<<<<<<<<<<<<<
 *                 d_res = node_summary_p[i]
 *         return -d_res
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_5 = (((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides)) > __pyx_v_d_res) != 0);
    if (__pyx_t_5) {

      /* "causalml/inference/tree/uplift.pyx":1543
 *         for i in range(1, n_class):
 *             if node_summary_p[i] > d_res:
 *                 d_res = node_summary_p[i]             # <<<<<<<<<<<<<<
 *         return -d_res
 * 
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_d_res = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_node_summary_p.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":1542
 *         cdef int i = 0
 *         for i in range(1, n_class):
 *             if node_summary_p[i] > d_res:             # <<<<<<<<<<<<<<
 *                 d_res = node_summary_p[i]
 *         return -d_res
 */
    }
  }

  /* "causalml/inference/tree/uplift.pyx":1544
 *             if node_summary_p[i] > d_res:
 *                 d_res = node_summary_p[i]
 *         return -d_res             # <<<<<<<<<<<<<<
 * 
 *     def normI(self, n_c: cython.int, n_c_left: cython.int, n_t: list, n_t_left: list, alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyFloat_FromDouble((-__pyx_v_d_res)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1516
 * 
 *     @staticmethod
 *     def arr_evaluate_CTS(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_evaluate_CTS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_summary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1546
 *         return -d_res
 * 
 *     def normI(self, n_c: cython.int, n_c_left: cython.int, n_t: list, n_t_left: list, alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:             # <<<<<<<<<<<<<<
 *         '''
 *         Normalization factor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_57normI(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_56normI[] = "\n        Normalization factor.\n\n        Args\n        ----\n        currentNodeSummary : list of list\n            The summary statistics of the current tree node, [P(Y=1|T), N(T)].\n\n        leftNodeSummary : list of list\n            The summary statistics of the left tree node, [P(Y=1|T), N(T)].\n\n        alpha : float\n            The weight used to balance different normalization parts.\n\n        Returns\n        -------\n        norm_res : float\n            Normalization factor.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_57normI = {"normI", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_57normI, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_56normI};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_57normI(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  int __pyx_v_n_c;
  int __pyx_v_n_c_left;
  PyObject *__pyx_v_n_t = 0;
  PyObject *__pyx_v_n_t_left = 0;
  float __pyx_v_alpha;
  float __pyx_v_currentDivergence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normI (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n_c,&__pyx_n_s_n_c_left,&__pyx_n_s_n_t,&__pyx_n_s_n_t_left,&__pyx_n_s_alpha,&__pyx_n_s_currentDivergence,0};
    PyObject* values[7] = {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  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_self)) != 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_n_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normI", 0, 5, 7, 1); __PYX_ERR(0, 1546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_c_left)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normI", 0, 5, 7, 2); __PYX_ERR(0, 1546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normI", 0, 5, 7, 3); __PYX_ERR(0, 1546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_t_left)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("normI", 0, 5, 7, 4); __PYX_ERR(0, 1546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          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_currentDivergence);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normI") < 0)) __PYX_ERR(0, 1546, __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);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_n_c = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1546, __pyx_L3_error)
    __pyx_v_n_c_left = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n_c_left == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1546, __pyx_L3_error)
    __pyx_v_n_t = ((PyObject*)values[3]);
    __pyx_v_n_t_left = ((PyObject*)values[4]);
    if (values[5]) {
      __pyx_v_alpha = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_alpha == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1546, __pyx_L3_error)
    } else {
      __pyx_v_alpha = ((float)((double)0.9));
    }
    if (values[6]) {
      __pyx_v_currentDivergence = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_currentDivergence == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1546, __pyx_L3_error)
    } else {
      __pyx_v_currentDivergence = ((float)((double)0.0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normI", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1546, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.normI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_t), (&PyList_Type), 1, "n_t", 1))) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_t_left), (&PyList_Type), 1, "n_t_left", 1))) __PYX_ERR(0, 1546, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_56normI(__pyx_self, __pyx_v_self, __pyx_v_n_c, __pyx_v_n_c_left, __pyx_v_n_t, __pyx_v_n_t_left, __pyx_v_alpha, __pyx_v_currentDivergence);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_56normI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_n_c, int __pyx_v_n_c_left, PyObject *__pyx_v_n_t, PyObject *__pyx_v_n_t_left, float __pyx_v_alpha, float __pyx_v_currentDivergence) {
  float __pyx_v_norm_res;
  float __pyx_v_pt_a;
  float __pyx_v_pc_a;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_pt_a_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  float __pyx_t_5;
  int __pyx_t_6;
  float __pyx_t_7;
  float __pyx_t_8;
  struct __pyx_opt_args_8causalml_9inference_4tree_6uplift_entropyH __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("normI", 0);

  /* "causalml/inference/tree/uplift.pyx":1567
 *         '''
 * 
 *         norm_res: cython.float = 0.             # <<<<<<<<<<<<<<
 *         pt_a: cython.float
 *         pc_a: cython.float
 */
  __pyx_v_norm_res = 0.;

  /* "causalml/inference/tree/uplift.pyx":1571
 *         pc_a: cython.float
 * 
 *         pt_a = 1. * np.sum(n_t_left) / (np.sum(n_t) + 0.1)             # <<<<<<<<<<<<<<
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_n_t_left) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n_t_left);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_float_1_, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_n_t);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyFloat_AddObjC(__pyx_t_1, __pyx_float_0_1, 0.1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1571, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_pt_a = __pyx_t_5;

  /* "causalml/inference/tree/uplift.pyx":1572
 * 
 *         pt_a = 1. * np.sum(n_t_left) / (np.sum(n_t) + 0.1)
 *         pc_a = 1. * n_c_left / (n_c + 0.1)             # <<<<<<<<<<<<<<
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:
 */
  __pyx_v_pc_a = ((1. * __pyx_v_n_c_left) / (__pyx_v_n_c + 0.1));

  /* "causalml/inference/tree/uplift.pyx":1574
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:             # <<<<<<<<<<<<<<
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * currentDivergence)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IDDP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "causalml/inference/tree/uplift.pyx":1576
 *         if self.evaluationFunction == self.evaluate_IDDP:
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * currentDivergence)             # <<<<<<<<<<<<<<
 *             norm_res += (1. * np.sum(n_t) / (np.sum(n_t) + n_c) * entropyH(pt_a))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyFloat_FromDouble((1. * __pyx_v_n_c)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9.__pyx_n = 1;
    __pyx_t_9.q = __pyx_t_7;
    __pyx_t_8 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_t_5, &__pyx_t_9); if (unlikely(__pyx_t_8 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1576, __pyx_L1_error)
    __pyx_v_norm_res = (__pyx_v_norm_res + (__pyx_t_8 * __pyx_v_currentDivergence));

    /* "causalml/inference/tree/uplift.pyx":1577
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * currentDivergence)
 *             norm_res += (1. * np.sum(n_t) / (np.sum(n_t) + n_c) * entropyH(pt_a))             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_norm_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_float_1_, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_v_pt_a, NULL); if (unlikely(__pyx_t_8 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1577, __pyx_L1_error)
    __pyx_t_2 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_norm_res = __pyx_t_8;

    /* "causalml/inference/tree/uplift.pyx":1574
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:             # <<<<<<<<<<<<<<
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * currentDivergence)
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":1581
 *         else:
 *             # Normalization Part 1
 *             norm_res += (alpha * entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * kl_divergence(pt_a, pc_a))             # <<<<<<<<<<<<<<
 *             # Normalization Part 2 & 3
 *             for i in range(len(n_t)):
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __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 && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_float_1_, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_4, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyFloat_FromDouble((1. * __pyx_v_n_c)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_n_t);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9.__pyx_n = 1;
    __pyx_t_9.q = __pyx_t_7;
    __pyx_t_5 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_t_8, &__pyx_t_9); if (unlikely(__pyx_t_5 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L1_error)
    __pyx_t_7 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(__pyx_v_pt_a, __pyx_v_pc_a); if (unlikely(__pyx_t_7 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1581, __pyx_L1_error)
    __pyx_v_norm_res = (__pyx_v_norm_res + ((__pyx_v_alpha * __pyx_t_5) * __pyx_t_7));

    /* "causalml/inference/tree/uplift.pyx":1583
 *             norm_res += (alpha * entropyH(1. * np.sum(n_t) / (np.sum(n_t) + n_c), 1. * n_c / (np.sum(n_t) + n_c)) * kl_divergence(pt_a, pc_a))
 *             # Normalization Part 2 & 3
 *             for i in range(len(n_t)):             # <<<<<<<<<<<<<<
 *                 pt_a_i = 1. * n_t_left[i] / (n_t[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * n_t[i] / (n_t[i] + n_c), 1. * n_c / (n_t[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 */
    if (unlikely(__pyx_v_n_t == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 1583, __pyx_L1_error)
    }
    __pyx_t_11 = PyList_GET_SIZE(__pyx_v_n_t); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1583, __pyx_L1_error)
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "causalml/inference/tree/uplift.pyx":1584
 *             # Normalization Part 2 & 3
 *             for i in range(len(n_t)):
 *                 pt_a_i = 1. * n_t_left[i] / (n_t[i] + 0.1)             # <<<<<<<<<<<<<<
 *                 norm_res += ((1 - alpha) * entropyH(1. * n_t[i] / (n_t[i] + n_c), 1. * n_c / (n_t[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 *                 norm_res += (1. * n_t[i] / (np.sum(n_t) + n_c) * entropyH(pt_a_i))
 */
      if (unlikely(__pyx_v_n_t_left == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1584, __pyx_L1_error)
      }
      __pyx_t_2 = PyNumber_Multiply(__pyx_float_1_, PyList_GET_ITEM(__pyx_v_n_t_left, __pyx_v_i)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_n_t == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1584, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyFloat_AddObjC(PyList_GET_ITEM(__pyx_v_n_t, __pyx_v_i), __pyx_float_0_1, 0.1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pt_a_i, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "causalml/inference/tree/uplift.pyx":1585
 *             for i in range(len(n_t)):
 *                 pt_a_i = 1. * n_t_left[i] / (n_t[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * n_t[i] / (n_t[i] + n_c), 1. * n_c / (n_t[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))             # <<<<<<<<<<<<<<
 *                 norm_res += (1. * n_t[i] / (np.sum(n_t) + n_c) * entropyH(pt_a_i))
 *         # Normalization Part 4
 */
      if (unlikely(__pyx_v_n_t == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1585, __pyx_L1_error)
      }
      __pyx_t_10 = PyNumber_Multiply(__pyx_float_1_, PyList_GET_ITEM(__pyx_v_n_t, __pyx_v_i)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(__pyx_v_n_t == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1585, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Add(PyList_GET_ITEM(__pyx_v_n_t, __pyx_v_i), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble((1. * __pyx_v_n_c)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__pyx_v_n_t == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1585, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyNumber_Add(PyList_GET_ITEM(__pyx_v_n_t, __pyx_v_i), __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9.__pyx_n = 1;
      __pyx_t_9.q = __pyx_t_5;
      __pyx_t_8 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_t_7, &__pyx_t_9); if (unlikely(__pyx_t_8 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error)
      __pyx_t_2 = PyNumber_Multiply(__pyx_float_1_, __pyx_v_pt_a_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(__pyx_t_5, __pyx_v_pc_a); if (unlikely(__pyx_t_7 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L1_error)
      __pyx_v_norm_res = (__pyx_v_norm_res + (((1.0 - __pyx_v_alpha) * __pyx_t_8) * __pyx_t_7));

      /* "causalml/inference/tree/uplift.pyx":1586
 *                 pt_a_i = 1. * n_t_left[i] / (n_t[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * n_t[i] / (n_t[i] + n_c), 1. * n_c / (n_t[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 *                 norm_res += (1. * n_t[i] / (np.sum(n_t) + n_c) * entropyH(pt_a_i))             # <<<<<<<<<<<<<<
 *         # Normalization Part 4
 *         norm_res += 1. * n_c / (np.sum(n_t) + n_c) * entropyH(pc_a)
 */
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_norm_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_n_t == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1586, __pyx_L1_error)
      }
      __pyx_t_10 = PyNumber_Multiply(__pyx_float_1_, PyList_GET_ITEM(__pyx_v_n_t, __pyx_v_i)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_n_t);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_pt_a_i); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L1_error)
      __pyx_t_8 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_t_7, NULL); if (unlikely(__pyx_t_8 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L1_error)
      __pyx_t_4 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_norm_res = __pyx_t_8;
    }
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":1588
 *                 norm_res += (1. * n_t[i] / (np.sum(n_t) + n_c) * entropyH(pt_a_i))
 *         # Normalization Part 4
 *         norm_res += 1. * n_c / (np.sum(n_t) + n_c) * entropyH(pc_a)             # <<<<<<<<<<<<<<
 * 
 *         # Normalization Part 5
 */
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_norm_res); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyFloat_FromDouble((1. * __pyx_v_n_c)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_n_t) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n_t);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_v_pc_a, NULL); if (unlikely(__pyx_t_8 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1588, __pyx_L1_error)
  __pyx_t_1 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_norm_res = __pyx_t_8;

  /* "causalml/inference/tree/uplift.pyx":1591
 * 
 *         # Normalization Part 5
 *         norm_res += 0.5             # <<<<<<<<<<<<<<
 *         return norm_res
 * 
 */
  __pyx_v_norm_res = (__pyx_v_norm_res + 0.5);

  /* "causalml/inference/tree/uplift.pyx":1592
 *         # Normalization Part 5
 *         norm_res += 0.5
 *         return norm_res             # <<<<<<<<<<<<<<
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_norm_res); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1546
 *         return -d_res
 * 
 *     def normI(self, n_c: cython.int, n_c_left: cython.int, n_t: list, n_t_left: list, alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:             # <<<<<<<<<<<<<<
 *         '''
 *         Normalization factor.
 */

  /* 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_10);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.normI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pt_a_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1594
 *         return norm_res
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,             # <<<<<<<<<<<<<<
 *                   alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:
 *         '''
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_59arr_normI(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_58arr_normI[] = "\n        Normalization factor.\n\n        Args\n        ----\n        cur_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the current node, i.e. [N(T=i)...]\n\n        left_node_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            The counts of each of the control\n            and treament groups of the left node, i.e. [N(T=i)...]\n\n        alpha : float\n            The weight used to balance different normalization parts.\n\n        Returns\n        -------\n        norm_res : float\n            Normalization factor.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_59arr_normI = {"arr_normI", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_59arr_normI, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_58arr_normI};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_59arr_normI(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_cur_node_summary_n = 0;
  PyObject *__pyx_v_left_node_summary_n = 0;
  float __pyx_v_alpha;
  float __pyx_v_currentDivergence;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arr_normI (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cur_node_summary_n,&__pyx_n_s_left_node_summary_n,&__pyx_n_s_alpha,&__pyx_n_s_currentDivergence,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_cur_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_normI", 0, 3, 5, 1); __PYX_ERR(0, 1594, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_node_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arr_normI", 0, 3, 5, 2); __PYX_ERR(0, 1594, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          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_currentDivergence);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arr_normI") < 0)) __PYX_ERR(0, 1594, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_cur_node_summary_n = values[1];
    __pyx_v_left_node_summary_n = values[2];
    if (values[3]) {
      __pyx_v_alpha = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_alpha == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1595, __pyx_L3_error)
    } else {
      __pyx_v_alpha = ((float)((double)0.9));
    }
    if (values[4]) {
      __pyx_v_currentDivergence = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_currentDivergence == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1595, __pyx_L3_error)
    } else {
      __pyx_v_currentDivergence = ((float)((double)0.0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arr_normI", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1594, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_normI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_58arr_normI(__pyx_self, __pyx_v_self, __pyx_v_cur_node_summary_n, __pyx_v_left_node_summary_n, __pyx_v_alpha, __pyx_v_currentDivergence);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_58arr_normI(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cur_node_summary_n, PyObject *__pyx_v_left_node_summary_n, float __pyx_v_alpha, float __pyx_v_currentDivergence) {
  __Pyx_memviewslice __pyx_v_cur_summary_n = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_left_summary_n = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_n_class;
  int __pyx_v_i;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_norm_res;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_c_left;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_pt_a;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_pt_a_i;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_pc_a;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sum_n_t_left;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_sum_n_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  float __pyx_t_10;
  struct __pyx_opt_args_8causalml_9inference_4tree_6uplift_entropyH __pyx_t_11;
  float __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arr_normI", 0);

  /* "causalml/inference/tree/uplift.pyx":1619
 *             Normalization factor.
 *         '''
 *         cdef N_TYPE_t[::1] cur_summary_n = cur_node_summary_n             # <<<<<<<<<<<<<<
 *         cdef N_TYPE_t[::1] left_summary_n = left_node_summary_n
 *         cdef int n_class = cur_summary_n.shape[0]
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t(__pyx_v_cur_node_summary_n, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1619, __pyx_L1_error)
  __pyx_v_cur_summary_n = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "causalml/inference/tree/uplift.pyx":1620
 *         '''
 *         cdef N_TYPE_t[::1] cur_summary_n = cur_node_summary_n
 *         cdef N_TYPE_t[::1] left_summary_n = left_node_summary_n             # <<<<<<<<<<<<<<
 *         cdef int n_class = cur_summary_n.shape[0]
 *         cdef int i = 0
 */
  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t(__pyx_v_left_node_summary_n, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __pyx_v_left_summary_n = __pyx_t_1;
  __pyx_t_1.memview = NULL;
  __pyx_t_1.data = NULL;

  /* "causalml/inference/tree/uplift.pyx":1621
 *         cdef N_TYPE_t[::1] cur_summary_n = cur_node_summary_n
 *         cdef N_TYPE_t[::1] left_summary_n = left_node_summary_n
 *         cdef int n_class = cur_summary_n.shape[0]             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 * 
 */
  __pyx_v_n_class = (__pyx_v_cur_summary_n.shape[0]);

  /* "causalml/inference/tree/uplift.pyx":1622
 *         cdef N_TYPE_t[::1] left_summary_n = left_node_summary_n
 *         cdef int n_class = cur_summary_n.shape[0]
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 * 
 *         cdef P_TYPE_t norm_res = 0.0
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1624
 *         cdef int i = 0
 * 
 *         cdef P_TYPE_t norm_res = 0.0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_c = cur_summary_n[0]
 *         cdef P_TYPE_t n_c_left = left_summary_n[0]
 */
  __pyx_v_norm_res = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1625
 * 
 *         cdef P_TYPE_t norm_res = 0.0
 *         cdef P_TYPE_t n_c = cur_summary_n[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_c_left = left_summary_n[0]
 *         cdef P_TYPE_t pt_a = 0.0, pt_a_i = 0.0, pc_a = 0.0, sum_n_t_left = 0.0, sum_n_t = 0.0
 */
  __pyx_t_2 = 0;
  __pyx_v_n_c = (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_2)) )));

  /* "causalml/inference/tree/uplift.pyx":1626
 *         cdef P_TYPE_t norm_res = 0.0
 *         cdef P_TYPE_t n_c = cur_summary_n[0]
 *         cdef P_TYPE_t n_c_left = left_summary_n[0]             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t pt_a = 0.0, pt_a_i = 0.0, pc_a = 0.0, sum_n_t_left = 0.0, sum_n_t = 0.0
 * 
 */
  __pyx_t_2 = 0;
  __pyx_v_n_c_left = (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_left_summary_n.data) + __pyx_t_2)) )));

  /* "causalml/inference/tree/uplift.pyx":1627
 *         cdef P_TYPE_t n_c = cur_summary_n[0]
 *         cdef P_TYPE_t n_c_left = left_summary_n[0]
 *         cdef P_TYPE_t pt_a = 0.0, pt_a_i = 0.0, pc_a = 0.0, sum_n_t_left = 0.0, sum_n_t = 0.0             # <<<<<<<<<<<<<<
 * 
 *         for i in range(1, n_class):
 */
  __pyx_v_pt_a = 0.0;
  __pyx_v_pt_a_i = 0.0;
  __pyx_v_pc_a = 0.0;
  __pyx_v_sum_n_t_left = 0.0;
  __pyx_v_sum_n_t = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1629
 *         cdef P_TYPE_t pt_a = 0.0, pt_a_i = 0.0, pc_a = 0.0, sum_n_t_left = 0.0, sum_n_t = 0.0
 * 
 *         for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *             sum_n_t_left += left_summary_n[i]
 *             sum_n_t += cur_summary_n[i]
 */
  __pyx_t_3 = __pyx_v_n_class;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "causalml/inference/tree/uplift.pyx":1630
 * 
 *         for i in range(1, n_class):
 *             sum_n_t_left += left_summary_n[i]             # <<<<<<<<<<<<<<
 *             sum_n_t += cur_summary_n[i]
 * 
 */
    __pyx_t_2 = __pyx_v_i;
    __pyx_v_sum_n_t_left = (__pyx_v_sum_n_t_left + (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_left_summary_n.data) + __pyx_t_2)) ))));

    /* "causalml/inference/tree/uplift.pyx":1631
 *         for i in range(1, n_class):
 *             sum_n_t_left += left_summary_n[i]
 *             sum_n_t += cur_summary_n[i]             # <<<<<<<<<<<<<<
 * 
 *         pt_a = 1. * sum_n_t_left / (sum_n_t + 0.1)
 */
    __pyx_t_2 = __pyx_v_i;
    __pyx_v_sum_n_t = (__pyx_v_sum_n_t + (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_2)) ))));
  }

  /* "causalml/inference/tree/uplift.pyx":1633
 *             sum_n_t += cur_summary_n[i]
 * 
 *         pt_a = 1. * sum_n_t_left / (sum_n_t + 0.1)             # <<<<<<<<<<<<<<
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 */
  __pyx_v_pt_a = ((1. * __pyx_v_sum_n_t_left) / (__pyx_v_sum_n_t + 0.1));

  /* "causalml/inference/tree/uplift.pyx":1634
 * 
 *         pt_a = 1. * sum_n_t_left / (sum_n_t + 0.1)
 *         pc_a = 1. * n_c_left / (n_c + 0.1)             # <<<<<<<<<<<<<<
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:
 */
  __pyx_v_pc_a = ((1. * __pyx_v_n_c_left) / (__pyx_v_n_c + 0.1));

  /* "causalml/inference/tree/uplift.pyx":1636
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:             # <<<<<<<<<<<<<<
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * currentDivergence)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IDDP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_9) {

    /* "causalml/inference/tree/uplift.pyx":1638
 *         if self.evaluationFunction == self.evaluate_IDDP:
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * currentDivergence)             # <<<<<<<<<<<<<<
 *             norm_res += (1. * sum_n_t / (sum_n_t + n_c) * entropyH(pt_a))
 * 
 */
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.q = ((1. * __pyx_v_n_c) / (__pyx_v_sum_n_t + __pyx_v_n_c));
    __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(((1. * __pyx_v_sum_n_t) / (__pyx_v_sum_n_t + __pyx_v_n_c)), &__pyx_t_11); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1638, __pyx_L1_error)
    __pyx_v_norm_res = (__pyx_v_norm_res + (__pyx_t_10 * __pyx_v_currentDivergence));

    /* "causalml/inference/tree/uplift.pyx":1639
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * currentDivergence)
 *             norm_res += (1. * sum_n_t / (sum_n_t + n_c) * entropyH(pt_a))             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_v_pt_a, NULL); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1639, __pyx_L1_error)
    __pyx_v_norm_res = (__pyx_v_norm_res + (((1. * __pyx_v_sum_n_t) / (__pyx_v_sum_n_t + __pyx_v_n_c)) * __pyx_t_10));

    /* "causalml/inference/tree/uplift.pyx":1636
 *         pc_a = 1. * n_c_left / (n_c + 0.1)
 * 
 *         if self.evaluationFunction == self.evaluate_IDDP:             # <<<<<<<<<<<<<<
 *             # Normalization Part 1
 *             norm_res += (entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * currentDivergence)
 */
    goto __pyx_L5;
  }

  /* "causalml/inference/tree/uplift.pyx":1643
 *         else:
 *             # Normalization Part 1
 *             norm_res += (alpha * entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * kl_divergence(pt_a, pc_a))             # <<<<<<<<<<<<<<
 *             # Normalization Part 2 & 3
 *             for i in range(1, n_class):
 */
  /*else*/ {
    __pyx_t_11.__pyx_n = 1;
    __pyx_t_11.q = ((1. * __pyx_v_n_c) / (__pyx_v_sum_n_t + __pyx_v_n_c));
    __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(((1. * __pyx_v_sum_n_t) / (__pyx_v_sum_n_t + __pyx_v_n_c)), &__pyx_t_11); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1643, __pyx_L1_error)
    __pyx_t_12 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence(__pyx_v_pt_a, __pyx_v_pc_a); if (unlikely(__pyx_t_12 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1643, __pyx_L1_error)
    __pyx_v_norm_res = (__pyx_v_norm_res + ((__pyx_v_alpha * __pyx_t_10) * __pyx_t_12));

    /* "causalml/inference/tree/uplift.pyx":1645
 *             norm_res += (alpha * entropyH(1. * sum_n_t / (sum_n_t + n_c), 1. * n_c / (sum_n_t + n_c)) * kl_divergence(pt_a, pc_a))
 *             # Normalization Part 2 & 3
 *             for i in range(1, n_class):             # <<<<<<<<<<<<<<
 *                 pt_a_i = 1. * left_summary_n[i] / (cur_summary_n[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * cur_summary_n[i] / (cur_summary_n[i] + n_c), 1. * n_c / (cur_summary_n[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 */
    __pyx_t_3 = __pyx_v_n_class;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "causalml/inference/tree/uplift.pyx":1646
 *             # Normalization Part 2 & 3
 *             for i in range(1, n_class):
 *                 pt_a_i = 1. * left_summary_n[i] / (cur_summary_n[i] + 0.1)             # <<<<<<<<<<<<<<
 *                 norm_res += ((1 - alpha) * entropyH(1. * cur_summary_n[i] / (cur_summary_n[i] + n_c), 1. * n_c / (cur_summary_n[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 *                 norm_res += (1. * cur_summary_n[i] / (sum_n_t + n_c) * entropyH(pt_a_i))
 */
      __pyx_t_2 = __pyx_v_i;
      __pyx_t_13 = __pyx_v_i;
      __pyx_v_pt_a_i = ((1. * (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_left_summary_n.data) + __pyx_t_2)) )))) / ((*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_13)) ))) + 0.1));

      /* "causalml/inference/tree/uplift.pyx":1647
 *             for i in range(1, n_class):
 *                 pt_a_i = 1. * left_summary_n[i] / (cur_summary_n[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * cur_summary_n[i] / (cur_summary_n[i] + n_c), 1. * n_c / (cur_summary_n[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))             # <<<<<<<<<<<<<<
 *                 norm_res += (1. * cur_summary_n[i] / (sum_n_t + n_c) * entropyH(pt_a_i))
 *         # Normalization Part 4
 */
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_2 = __pyx_v_i;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_11.__pyx_n = 1;
      __pyx_t_11.q = ((1. * __pyx_v_n_c) / ((*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_14)) ))) + __pyx_v_n_c));
      __pyx_t_12 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH((((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(1. * (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_13)) ))))) / ((*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_2)) ))) + __pyx_v_n_c)), &__pyx_t_11); if (unlikely(__pyx_t_12 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1647, __pyx_L1_error)
      __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_kl_divergence((1. * __pyx_v_pt_a_i), __pyx_v_pc_a); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1647, __pyx_L1_error)
      __pyx_v_norm_res = (__pyx_v_norm_res + (((1.0 - __pyx_v_alpha) * __pyx_t_12) * __pyx_t_10));

      /* "causalml/inference/tree/uplift.pyx":1648
 *                 pt_a_i = 1. * left_summary_n[i] / (cur_summary_n[i] + 0.1)
 *                 norm_res += ((1 - alpha) * entropyH(1. * cur_summary_n[i] / (cur_summary_n[i] + n_c), 1. * n_c / (cur_summary_n[i] + n_c)) * kl_divergence(1. * pt_a_i, pc_a))
 *                 norm_res += (1. * cur_summary_n[i] / (sum_n_t + n_c) * entropyH(pt_a_i))             # <<<<<<<<<<<<<<
 *         # Normalization Part 4
 *         norm_res += 1. * n_c / (sum_n_t + n_c) * entropyH(pc_a)
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_v_pt_a_i, NULL); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1648, __pyx_L1_error)
      __pyx_v_norm_res = (__pyx_v_norm_res + ((((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)(1. * (*((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) ( /* dim=0 */ ((char *) (((__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *) __pyx_v_cur_summary_n.data) + __pyx_t_14)) ))))) / (__pyx_v_sum_n_t + __pyx_v_n_c)) * __pyx_t_10));
    }
  }
  __pyx_L5:;

  /* "causalml/inference/tree/uplift.pyx":1650
 *                 norm_res += (1. * cur_summary_n[i] / (sum_n_t + n_c) * entropyH(pt_a_i))
 *         # Normalization Part 4
 *         norm_res += 1. * n_c / (sum_n_t + n_c) * entropyH(pc_a)             # <<<<<<<<<<<<<<
 * 
 *         # Normalization Part 5
 */
  __pyx_t_10 = __pyx_f_8causalml_9inference_4tree_6uplift_entropyH(__pyx_v_pc_a, NULL); if (unlikely(__pyx_t_10 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L1_error)
  __pyx_v_norm_res = (__pyx_v_norm_res + (((1. * __pyx_v_n_c) / (__pyx_v_sum_n_t + __pyx_v_n_c)) * __pyx_t_10));

  /* "causalml/inference/tree/uplift.pyx":1653
 * 
 *         # Normalization Part 5
 *         norm_res += 0.5             # <<<<<<<<<<<<<<
 *         return norm_res
 * 
 */
  __pyx_v_norm_res = (__pyx_v_norm_res + 0.5);

  /* "causalml/inference/tree/uplift.pyx":1654
 *         # Normalization Part 5
 *         norm_res += 0.5
 *         return norm_res             # <<<<<<<<<<<<<<
 * 
 *     def tree_node_summary(self, treatment_idx, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_norm_res); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1594
 *         return norm_res
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,             # <<<<<<<<<<<<<<
 *                   alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:
 *         '''
 */

  /* function exit code */
  __pyx_L1_error:;
  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.arr_normI", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_cur_summary_n, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_left_summary_n, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1656
 *         return norm_res
 * 
 *     def tree_node_summary(self, treatment_idx, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node summary statistics.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_61tree_node_summary(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_60tree_node_summary[] = "\n        Tree node summary statistics.\n\n        Args\n        ----\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        min_samples_treatment: int, optional (default=10)\n            The minimum number of samples required of the experiment group t be split at a leaf node.\n        n_reg :  int, optional (default=10)\n            The regularization parameter defined in Rzepakowski et al. 2012,\n            the weight (in terms of sample size) of the parent node influence\n            on the child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n        parentNodeSummary : list of list\n            The positive probabilities and sample sizes of each of the control and treatment groups\n            in the parent node.\n\n        Returns\n        -------\n        nodeSummary : list of list\n            The positive probabilities and sample sizes of each of the control and treatment groups\n            in the current node.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_61tree_node_summary = {"tree_node_summary", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_61tree_node_summary, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_60tree_node_summary};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_61tree_node_summary(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  PyObject *__pyx_v_parentNodeSummary = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tree_node_summary (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,&__pyx_n_s_parentNodeSummary,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[4] = ((PyObject *)((PyObject *)__pyx_int_100));
    values[5] = ((PyObject *)((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  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_self)) != 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_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary", 0, 3, 6, 1); __PYX_ERR(0, 1656, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary", 0, 3, 6, 2); __PYX_ERR(0, 1656, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_samples_treatment);
          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_n_reg);
          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_parentNodeSummary);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tree_node_summary") < 0)) __PYX_ERR(0, 1656, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_self = values[0];
    __pyx_v_treatment_idx = values[1];
    __pyx_v_y = values[2];
    __pyx_v_min_samples_treatment = values[3];
    __pyx_v_n_reg = values[4];
    __pyx_v_parentNodeSummary = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tree_node_summary", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1656, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_60tree_node_summary(__pyx_self, __pyx_v_self, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_min_samples_treatment, __pyx_v_n_reg, __pyx_v_parentNodeSummary);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_60tree_node_summary(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary) {
  PyObject *__pyx_v_counts = NULL;
  PyObject *__pyx_v_nodeSummary = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_v_n_pos = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tree_node_summary", 0);

  /* "causalml/inference/tree/uplift.pyx":1683
 *         '''
 *         # counts: [[N(Y=0, T=0), N(Y=1, T=0)], [N(Y=0, T=1), N(Y=1, T=1)], ...]
 *         counts = self.group_uniqueCounts(treatment_idx, y)             # <<<<<<<<<<<<<<
 * 
 *         # nodeSummary: [[P(Y=1|T=0), N(T=0)], [P(Y=1|T=1), N(T=1)], ...]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_group_uniqueCounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_treatment_idx, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_treatment_idx, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_treatment_idx);
    __Pyx_GIVEREF(__pyx_v_treatment_idx);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_treatment_idx);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_counts = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1686
 * 
 *         # nodeSummary: [[P(Y=1|T=0), N(T=0)], [P(Y=1|T=1), N(T=1)], ...]
 *         nodeSummary = []             # <<<<<<<<<<<<<<
 *         # Iterate the control and treatment groups
 *         for i, count in enumerate(counts):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nodeSummary = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1688
 *         nodeSummary = []
 *         # Iterate the control and treatment groups
 *         for i, count in enumerate(counts):             # <<<<<<<<<<<<<<
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_counts)) || PyTuple_CheckExact(__pyx_v_counts)) {
    __pyx_t_2 = __pyx_v_counts; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_counts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1688, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1688, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1688, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1688, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1688, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1688, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":1689
 *         # Iterate the control and treatment groups
 *         for i, count in enumerate(counts):
 *             n_pos = count[1]             # <<<<<<<<<<<<<<
 *             n = count[0] + n_pos
 *             if parentNodeSummary is None:
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_count, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1689, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_n_pos, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":1690
 *         for i, count in enumerate(counts):
 *             n_pos = count[1]
 *             n = count[0] + n_pos             # <<<<<<<<<<<<<<
 *             if parentNodeSummary is None:
 *                 p = n_pos / n if n > 0 else 0.
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_count, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_v_n_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":1691
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 *             if parentNodeSummary is None:             # <<<<<<<<<<<<<<
 *                 p = n_pos / n if n > 0 else 0.
 *             elif n > min_samples_treatment:
 */
    __pyx_t_8 = (__pyx_v_parentNodeSummary == Py_None);
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "causalml/inference/tree/uplift.pyx":1692
 *             n = count[0] + n_pos
 *             if parentNodeSummary is None:
 *                 p = n_pos / n if n > 0 else 0.             # <<<<<<<<<<<<<<
 *             elif n > min_samples_treatment:
 *                 p = (n_pos + parentNodeSummary[i][0] * n_reg) / (n + n_reg)
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1692, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1692, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_9) {
        __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_n_pos, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1692, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __Pyx_INCREF(__pyx_float_0_);
        __pyx_t_3 = __pyx_float_0_;
      }
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":1691
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 *             if parentNodeSummary is None:             # <<<<<<<<<<<<<<
 *                 p = n_pos / n if n > 0 else 0.
 *             elif n > min_samples_treatment:
 */
      goto __pyx_L5;
    }

    /* "causalml/inference/tree/uplift.pyx":1693
 *             if parentNodeSummary is None:
 *                 p = n_pos / n if n > 0 else 0.
 *             elif n > min_samples_treatment:             # <<<<<<<<<<<<<<
 *                 p = (n_pos + parentNodeSummary[i][0] * n_reg) / (n + n_reg)
 *             else:
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_n, __pyx_v_min_samples_treatment, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1693, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1693, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "causalml/inference/tree/uplift.pyx":1694
 *                 p = n_pos / n if n > 0 else 0.
 *             elif n > min_samples_treatment:
 *                 p = (n_pos + parentNodeSummary[i][0] * n_reg) / (n + n_reg)             # <<<<<<<<<<<<<<
 *             else:
 *                 p = parentNodeSummary[i][0]
 */
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_parentNodeSummary, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_v_n_reg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_v_n_pos, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_v_n, __pyx_v_n_reg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "causalml/inference/tree/uplift.pyx":1693
 *             if parentNodeSummary is None:
 *                 p = n_pos / n if n > 0 else 0.
 *             elif n > min_samples_treatment:             # <<<<<<<<<<<<<<
 *                 p = (n_pos + parentNodeSummary[i][0] * n_reg) / (n + n_reg)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "causalml/inference/tree/uplift.pyx":1696
 *                 p = (n_pos + parentNodeSummary[i][0] * n_reg) / (n + n_reg)
 *             else:
 *                 p = parentNodeSummary[i][0]             # <<<<<<<<<<<<<<
 * 
 *             nodeSummary.append([p, n])
 */
    /*else*/ {
      __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_parentNodeSummary, __pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L5:;

    /* "causalml/inference/tree/uplift.pyx":1698
 *                 p = parentNodeSummary[i][0]
 * 
 *             nodeSummary.append([p, n])             # <<<<<<<<<<<<<<
 * 
 *         return nodeSummary
 */
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_p);
    __Pyx_GIVEREF(__pyx_v_p);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_p);
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_n);
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodeSummary, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":1688
 *         nodeSummary = []
 *         # Iterate the control and treatment groups
 *         for i, count in enumerate(counts):             # <<<<<<<<<<<<<<
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1700
 *             nodeSummary.append([p, n])
 * 
 *         return nodeSummary             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_nodeSummary);
  __pyx_r = __pyx_v_nodeSummary;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1656
 *         return norm_res
 * 
 *     def tree_node_summary(self, treatment_idx, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node summary statistics.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_counts);
  __Pyx_XDECREF(__pyx_v_nodeSummary);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XDECREF(__pyx_v_n_pos);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1703
 * 
 *     @staticmethod
 *     def tree_node_summary_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                                  np.ndarray[Y_TYPE_t, ndim=1] y,
 *                                  np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_63tree_node_summary_to_arr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_62tree_node_summary_to_arr[] = "\n        Tree node summary statistics.\n        Modified from tree_node_summary, to use different format for the summary.\n        Instead of [[P(Y=1|T=0), N(T=0)], [P(Y=1|T=1), N(T=1)], ...],\n        use two arrays [N(T=i)...] and [P(Y=1|T=i)...].\n\n        Args\n        ----\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n            Has type numpy.int8.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n            Has type numpy.int8.\n        out_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            To be filled with the positive probabilities of each of the control\n            and treament groups of the current node.\n        out_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            To be filled with the counts of each of the control\n            and treament groups of the current node.\n        buf_count_arr : array of shape [2*n_class]\n            Has type numpy.int32.\n            To be use as temporary buffer for group_uniqueCounts_to_arr.\n        parentNodeSummary_p : array of shape [n_class]\n            The positive probabilities of each of the control and treatment groups\n            in the parent node.\n        has_parent_summary : bool as int\n            If True (non-zero), then parentNodeSummary_p is a valid parent node summary probabilities.\n            If False (0), assume no parent node summary and parentNodeSummary_p is not touched.\n        min_samples_treatment: int, optional (default=10)\n            The minimum number of samples required of the experiment group t be split at a leaf node.\n        n_reg :  int, optional (default=10)\n            The regularization parameter defined in Rzepakowski et al. 2012,\n            the weight (in terms of sample size) of the parent node influence\n            on the child node, o""nly effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n\n        Returns\n        -------\n        No return values, but will modify out_summary_p and out_summary_n.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_63tree_node_summary_to_arr = {"tree_node_summary_to_arr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_63tree_node_summary_to_arr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_62tree_node_summary_to_arr};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_63tree_node_summary_to_arr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_treatment_idx = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out_summary_p = 0;
  PyArrayObject *__pyx_v_out_summary_n = 0;
  PyArrayObject *__pyx_v_buf_count_arr = 0;
  PyArrayObject *__pyx_v_parentNodeSummary_p = 0;
  int __pyx_v_has_parent_summary;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tree_node_summary_to_arr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_out_summary_p,&__pyx_n_s_out_summary_n,&__pyx_n_s_buf_count_arr,&__pyx_n_s_parentNodeSummary_p,&__pyx_n_s_has_parent_summary,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[7] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[8] = ((PyObject *)((PyObject *)__pyx_int_100));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 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_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 1); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_summary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 2); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 3); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buf_count_arr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 4); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parentNodeSummary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 5); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_has_parent_summary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, 6); __PYX_ERR(0, 1703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_samples_treatment);
          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_n_reg);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tree_node_summary_to_arr") < 0)) __PYX_ERR(0, 1703, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_treatment_idx = ((PyArrayObject *)values[0]);
    __pyx_v_y = ((PyArrayObject *)values[1]);
    __pyx_v_out_summary_p = ((PyArrayObject *)values[2]);
    __pyx_v_out_summary_n = ((PyArrayObject *)values[3]);
    __pyx_v_buf_count_arr = ((PyArrayObject *)values[4]);
    __pyx_v_parentNodeSummary_p = ((PyArrayObject *)values[5]);
    __pyx_v_has_parent_summary = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_has_parent_summary == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1709, __pyx_L3_error)
    __pyx_v_min_samples_treatment = values[7];
    __pyx_v_n_reg = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tree_node_summary_to_arr", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary_to_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_treatment_idx), __pyx_ptype_5numpy_ndarray, 1, "treatment_idx", 0))) __PYX_ERR(0, 1703, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) __PYX_ERR(0, 1704, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_summary_p), __pyx_ptype_5numpy_ndarray, 1, "out_summary_p", 0))) __PYX_ERR(0, 1705, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_summary_n), __pyx_ptype_5numpy_ndarray, 1, "out_summary_n", 0))) __PYX_ERR(0, 1706, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf_count_arr), __pyx_ptype_5numpy_ndarray, 1, "buf_count_arr", 0))) __PYX_ERR(0, 1707, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parentNodeSummary_p), __pyx_ptype_5numpy_ndarray, 1, "parentNodeSummary_p", 0))) __PYX_ERR(0, 1708, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_62tree_node_summary_to_arr(__pyx_self, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_out_summary_p, __pyx_v_out_summary_n, __pyx_v_buf_count_arr, __pyx_v_parentNodeSummary_p, __pyx_v_has_parent_summary, __pyx_v_min_samples_treatment, __pyx_v_n_reg);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_62tree_node_summary_to_arr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_treatment_idx, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_out_summary_p, PyArrayObject *__pyx_v_out_summary_n, PyArrayObject *__pyx_v_buf_count_arr, PyArrayObject *__pyx_v_parentNodeSummary_p, int __pyx_v_has_parent_summary, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg) {
  int __pyx_v_i;
  int __pyx_v_n_class;
  int __pyx_v_n;
  int __pyx_v_n_pos;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p;
  int __pyx_v_n_min_sams;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_reg_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_buf_count_arr;
  __Pyx_Buffer __pyx_pybuffer_buf_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_summary_n;
  __Pyx_Buffer __pyx_pybuffer_out_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_summary_p;
  __Pyx_Buffer __pyx_pybuffer_out_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_parentNodeSummary_p;
  __Pyx_Buffer __pyx_pybuffer_parentNodeSummary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_treatment_idx;
  __Pyx_Buffer __pyx_pybuffer_treatment_idx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  double __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tree_node_summary_to_arr", 0);
  __pyx_pybuffer_treatment_idx.pybuffer.buf = NULL;
  __pyx_pybuffer_treatment_idx.refcount = 0;
  __pyx_pybuffernd_treatment_idx.data = NULL;
  __pyx_pybuffernd_treatment_idx.rcbuffer = &__pyx_pybuffer_treatment_idx;
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_out_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_out_summary_p.refcount = 0;
  __pyx_pybuffernd_out_summary_p.data = NULL;
  __pyx_pybuffernd_out_summary_p.rcbuffer = &__pyx_pybuffer_out_summary_p;
  __pyx_pybuffer_out_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_out_summary_n.refcount = 0;
  __pyx_pybuffernd_out_summary_n.data = NULL;
  __pyx_pybuffernd_out_summary_n.rcbuffer = &__pyx_pybuffer_out_summary_n;
  __pyx_pybuffer_buf_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_buf_count_arr.refcount = 0;
  __pyx_pybuffernd_buf_count_arr.data = NULL;
  __pyx_pybuffernd_buf_count_arr.rcbuffer = &__pyx_pybuffer_buf_count_arr;
  __pyx_pybuffer_parentNodeSummary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_parentNodeSummary_p.refcount = 0;
  __pyx_pybuffernd_parentNodeSummary_p.data = NULL;
  __pyx_pybuffernd_parentNodeSummary_p.rcbuffer = &__pyx_pybuffer_parentNodeSummary_p;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_treatment_idx, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_TR_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_treatment_idx.diminfo[0].strides = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_treatment_idx.diminfo[0].shape = __pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_Y_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_summary_p.diminfo[0].strides = __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_summary_p.diminfo[0].shape = __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_summary_n.diminfo[0].strides = __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_summary_n.diminfo[0].shape = __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_buf_count_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_buf_count_arr.diminfo[0].strides = __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buf_count_arr.diminfo[0].shape = __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_parentNodeSummary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  }
  __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides = __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].shape = __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1755
 *         '''
 *         # buf_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         group_uniqueCounts_to_arr(treatment_idx, y, buf_count_arr)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_group_uniqueCounts_to_arr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, ((PyObject *)__pyx_v_treatment_idx), ((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_buf_count_arr)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, ((PyObject *)__pyx_v_treatment_idx), ((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_buf_count_arr)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_treatment_idx));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_treatment_idx));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_treatment_idx));
    __Pyx_INCREF(((PyObject *)__pyx_v_y));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, ((PyObject *)__pyx_v_y));
    __Pyx_INCREF(((PyObject *)__pyx_v_buf_count_arr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_buf_count_arr));
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, ((PyObject *)__pyx_v_buf_count_arr));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1757
 *         group_uniqueCounts_to_arr(treatment_idx, y, buf_count_arr)
 * 
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         cdef int n_class = buf_count_arr.shape[0] / 2
 *         cdef int n = 0
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1758
 * 
 *         cdef int i = 0
 *         cdef int n_class = buf_count_arr.shape[0] / 2             # <<<<<<<<<<<<<<
 *         cdef int n = 0
 *         cdef int n_pos = 0
 */
  __pyx_v_n_class = (((long)(__pyx_v_buf_count_arr->dimensions[0])) / 2);

  /* "causalml/inference/tree/uplift.pyx":1759
 *         cdef int i = 0
 *         cdef int n_class = buf_count_arr.shape[0] / 2
 *         cdef int n = 0             # <<<<<<<<<<<<<<
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0
 */
  __pyx_v_n = 0;

  /* "causalml/inference/tree/uplift.pyx":1760
 *         cdef int n_class = buf_count_arr.shape[0] / 2
 *         cdef int n = 0
 *         cdef int n_pos = 0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment
 */
  __pyx_v_n_pos = 0;

  /* "causalml/inference/tree/uplift.pyx":1761
 *         cdef int n = 0
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0             # <<<<<<<<<<<<<<
 *         cdef int n_min_sams = min_samples_treatment
 *         cdef P_TYPE_t n_reg_p = n_reg
 */
  __pyx_v_p = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1762
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_reg_p = n_reg
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_min_samples_treatment); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1762, __pyx_L1_error)
  __pyx_v_n_min_sams = __pyx_t_4;

  /* "causalml/inference/tree/uplift.pyx":1763
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment
 *         cdef P_TYPE_t n_reg_p = n_reg             # <<<<<<<<<<<<<<
 * 
 *         # out_summary_p: [P(Y=1|T=i)...]
 */
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_n_reg); if (unlikely((__pyx_t_6 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1763, __pyx_L1_error)
  __pyx_v_n_reg_p = __pyx_t_6;

  /* "causalml/inference/tree/uplift.pyx":1767
 *         # out_summary_p: [P(Y=1|T=i)...]
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:             # <<<<<<<<<<<<<<
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)
 */
  __pyx_t_7 = ((__pyx_v_has_parent_summary == 0) != 0);
  if (__pyx_t_7) {

    /* "causalml/inference/tree/uplift.pyx":1768
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:
 *             for i in range(n_class):             # <<<<<<<<<<<<<<
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = buf_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 */
    __pyx_t_4 = __pyx_v_n_class;
    __pyx_t_8 = __pyx_t_4;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "causalml/inference/tree/uplift.pyx":1769
 *         if has_parent_summary == 0:
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)             # <<<<<<<<<<<<<<
 *                 n = buf_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 */
      __pyx_t_10 = ((2 * __pyx_v_i) + 1);
      __pyx_v_n_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf_count_arr.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":1770
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = buf_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)             # <<<<<<<<<<<<<<
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n
 */
      __pyx_t_10 = (2 * __pyx_v_i);
      __pyx_v_n = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf_count_arr.diminfo[0].strides)) + __pyx_v_n_pos);

      /* "causalml/inference/tree/uplift.pyx":1771
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = buf_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.             # <<<<<<<<<<<<<<
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p
 */
      if (((__pyx_v_n > 0) != 0)) {
        __pyx_t_11 = (((double)__pyx_v_n_pos) / ((double)__pyx_v_n));
      } else {
        __pyx_t_11 = 0.;
      }
      __pyx_v_p = __pyx_t_11;

      /* "causalml/inference/tree/uplift.pyx":1772
 *                 n = buf_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n             # <<<<<<<<<<<<<<
 *                 out_summary_p[i] = p
 *         else:
 */
      __pyx_t_10 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_out_summary_n.diminfo[0].strides) = __pyx_v_n;

      /* "causalml/inference/tree/uplift.pyx":1773
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(n_class):
 */
      __pyx_t_10 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_out_summary_p.diminfo[0].strides) = __pyx_v_p;
    }

    /* "causalml/inference/tree/uplift.pyx":1767
 *         # out_summary_p: [P(Y=1|T=i)...]
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:             # <<<<<<<<<<<<<<
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1] # N(Y=1|T=i)
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":1775
 *                 out_summary_p[i] = p
 *         else:
 *             for i in range(n_class):             # <<<<<<<<<<<<<<
 *                 n_pos = buf_count_arr[2*i + 1]
 *                 n = buf_count_arr[2*i] + n_pos
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_n_class;
    __pyx_t_8 = __pyx_t_4;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "causalml/inference/tree/uplift.pyx":1776
 *         else:
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1]             # <<<<<<<<<<<<<<
 *                 n = buf_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:
 */
      __pyx_t_10 = ((2 * __pyx_v_i) + 1);
      __pyx_v_n_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf_count_arr.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":1777
 *             for i in range(n_class):
 *                 n_pos = buf_count_arr[2*i + 1]
 *                 n = buf_count_arr[2*i] + n_pos             # <<<<<<<<<<<<<<
 *                 if n > n_min_sams:
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 */
      __pyx_t_10 = (2 * __pyx_v_i);
      __pyx_v_n = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_buf_count_arr.diminfo[0].strides)) + __pyx_v_n_pos);

      /* "causalml/inference/tree/uplift.pyx":1778
 *                 n_pos = buf_count_arr[2*i + 1]
 *                 n = buf_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:             # <<<<<<<<<<<<<<
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 */
      __pyx_t_7 = ((__pyx_v_n > __pyx_v_n_min_sams) != 0);
      if (__pyx_t_7) {

        /* "causalml/inference/tree/uplift.pyx":1779
 *                 n = buf_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)             # <<<<<<<<<<<<<<
 *                 else:
 *                     p = parentNodeSummary_p[i]
 */
        __pyx_t_10 = __pyx_v_i;
        __pyx_v_p = ((__pyx_v_n_pos + ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides)) * __pyx_v_n_reg_p)) / (((double)__pyx_v_n) + __pyx_v_n_reg_p));

        /* "causalml/inference/tree/uplift.pyx":1778
 *                 n_pos = buf_count_arr[2*i + 1]
 *                 n = buf_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:             # <<<<<<<<<<<<<<
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 */
        goto __pyx_L8;
      }

      /* "causalml/inference/tree/uplift.pyx":1781
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 *                     p = parentNodeSummary_p[i]             # <<<<<<<<<<<<<<
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p
 */
      /*else*/ {
        __pyx_t_10 = __pyx_v_i;
        __pyx_v_p = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides));
      }
      __pyx_L8:;

      /* "causalml/inference/tree/uplift.pyx":1782
 *                 else:
 *                     p = parentNodeSummary_p[i]
 *                 out_summary_n[i] = n             # <<<<<<<<<<<<<<
 *                 out_summary_p[i] = p
 * 
 */
      __pyx_t_10 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_out_summary_n.diminfo[0].strides) = __pyx_v_n;

      /* "causalml/inference/tree/uplift.pyx":1783
 *                     p = parentNodeSummary_p[i]
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
      __pyx_t_10 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_out_summary_p.diminfo[0].strides) = __pyx_v_p;
    }
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":1703
 * 
 *     @staticmethod
 *     def tree_node_summary_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                                  np.ndarray[Y_TYPE_t, ndim=1] y,
 *                                  np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary_to_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buf_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_treatment_idx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1786
 * 
 *     @staticmethod
 *     def tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             np.ndarray[N_TYPE_t, ndim=1] group_count_arr,
 *             np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_65tree_node_summary_from_counts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_64tree_node_summary_from_counts[] = "Tree node summary statistics.\n\n        Modified from tree_node_summary_to_arr, to use different\n        format for the summary and to calculate based on already\n        calculated group counts.  Instead of [[P(Y=1|T=0), N(T=0)],\n        [P(Y=1|T=1), N(T=1)], ...], use two arrays [N(T=i)...] and\n        [P(Y=1|T=i)...].\n\n        Args\n        ----\n        group_count_arr : array of shape [2*n_class]\n            Has type numpy.int32.\n            The grounp counts, where entry 2*i is N(Y=0, T=i),\n            and entry 2*i+1 is N(Y=1, T=i).\n        out_summary_p : array of shape [n_class]\n            Has type numpy.double.\n            To be filled with the positive probabilities of each of the control\n            and treament groups of the current node.\n        out_summary_n : array of shape [n_class]\n            Has type numpy.int32.\n            To be filled with the counts of each of the control\n            and treament groups of the current node.\n        parentNodeSummary_p : array of shape [n_class]\n            The positive probabilities of each of the control and treatment groups\n            in the parent node.\n        has_parent_summary : bool as int\n            If True (non-zero), then parentNodeSummary_p is a valid parent node summary probabilities.\n            If False (0), assume no parent node summary and parentNodeSummary_p is not touched.\n        min_samples_treatment: int, optional (default=10)\n            The minimum number of samples required of the experiment group t be split at a leaf node.\n        n_reg :  int, optional (default=10)\n            The regularization parameter defined in Rzepakowski et al. 2012,\n            the weight (in terms of sample size) of the parent node influence\n            on the child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n\n        Returns\n        -------\n        No return values, but will modify out_summary_p and out_summary_n.\n\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_65tree_node_summary_from_counts = {"tree_node_summary_from_counts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_65tree_node_summary_from_counts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_64tree_node_summary_from_counts};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_65tree_node_summary_from_counts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_group_count_arr = 0;
  PyArrayObject *__pyx_v_out_summary_p = 0;
  PyArrayObject *__pyx_v_out_summary_n = 0;
  PyArrayObject *__pyx_v_parentNodeSummary_p = 0;
  int __pyx_v_has_parent_summary;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tree_node_summary_from_counts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_group_count_arr,&__pyx_n_s_out_summary_p,&__pyx_n_s_out_summary_n,&__pyx_n_s_parentNodeSummary_p,&__pyx_n_s_has_parent_summary,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[6] = ((PyObject *)((PyObject *)__pyx_int_100));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_group_count_arr)) != 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_out_summary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_from_counts", 0, 5, 7, 1); __PYX_ERR(0, 1786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_summary_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_from_counts", 0, 5, 7, 2); __PYX_ERR(0, 1786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parentNodeSummary_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_from_counts", 0, 5, 7, 3); __PYX_ERR(0, 1786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_has_parent_summary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tree_node_summary_from_counts", 0, 5, 7, 4); __PYX_ERR(0, 1786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_samples_treatment);
          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_n_reg);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tree_node_summary_from_counts") < 0)) __PYX_ERR(0, 1786, __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);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_group_count_arr = ((PyArrayObject *)values[0]);
    __pyx_v_out_summary_p = ((PyArrayObject *)values[1]);
    __pyx_v_out_summary_n = ((PyArrayObject *)values[2]);
    __pyx_v_parentNodeSummary_p = ((PyArrayObject *)values[3]);
    __pyx_v_has_parent_summary = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_has_parent_summary == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1791, __pyx_L3_error)
    __pyx_v_min_samples_treatment = values[5];
    __pyx_v_n_reg = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tree_node_summary_from_counts", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1786, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary_from_counts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group_count_arr), __pyx_ptype_5numpy_ndarray, 1, "group_count_arr", 0))) __PYX_ERR(0, 1787, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_summary_p), __pyx_ptype_5numpy_ndarray, 1, "out_summary_p", 0))) __PYX_ERR(0, 1788, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_summary_n), __pyx_ptype_5numpy_ndarray, 1, "out_summary_n", 0))) __PYX_ERR(0, 1789, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parentNodeSummary_p), __pyx_ptype_5numpy_ndarray, 1, "parentNodeSummary_p", 0))) __PYX_ERR(0, 1790, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_64tree_node_summary_from_counts(__pyx_self, __pyx_v_group_count_arr, __pyx_v_out_summary_p, __pyx_v_out_summary_n, __pyx_v_parentNodeSummary_p, __pyx_v_has_parent_summary, __pyx_v_min_samples_treatment, __pyx_v_n_reg);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_64tree_node_summary_from_counts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_group_count_arr, PyArrayObject *__pyx_v_out_summary_p, PyArrayObject *__pyx_v_out_summary_n, PyArrayObject *__pyx_v_parentNodeSummary_p, int __pyx_v_has_parent_summary, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg) {
  int __pyx_v_i;
  int __pyx_v_n_class;
  int __pyx_v_n;
  int __pyx_v_n_pos;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p;
  int __pyx_v_n_min_sams;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_n_reg_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_group_count_arr;
  __Pyx_Buffer __pyx_pybuffer_group_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_summary_n;
  __Pyx_Buffer __pyx_pybuffer_out_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out_summary_p;
  __Pyx_Buffer __pyx_pybuffer_out_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_parentNodeSummary_p;
  __Pyx_Buffer __pyx_pybuffer_parentNodeSummary_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tree_node_summary_from_counts", 0);
  __pyx_pybuffer_group_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_group_count_arr.refcount = 0;
  __pyx_pybuffernd_group_count_arr.data = NULL;
  __pyx_pybuffernd_group_count_arr.rcbuffer = &__pyx_pybuffer_group_count_arr;
  __pyx_pybuffer_out_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_out_summary_p.refcount = 0;
  __pyx_pybuffernd_out_summary_p.data = NULL;
  __pyx_pybuffernd_out_summary_p.rcbuffer = &__pyx_pybuffer_out_summary_p;
  __pyx_pybuffer_out_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_out_summary_n.refcount = 0;
  __pyx_pybuffernd_out_summary_n.data = NULL;
  __pyx_pybuffernd_out_summary_n.rcbuffer = &__pyx_pybuffer_out_summary_n;
  __pyx_pybuffer_parentNodeSummary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_parentNodeSummary_p.refcount = 0;
  __pyx_pybuffernd_parentNodeSummary_p.data = NULL;
  __pyx_pybuffernd_parentNodeSummary_p.rcbuffer = &__pyx_pybuffer_parentNodeSummary_p;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_group_count_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1786, __pyx_L1_error)
  }
  __pyx_pybuffernd_group_count_arr.diminfo[0].strides = __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_group_count_arr.diminfo[0].shape = __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_summary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1786, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_summary_p.diminfo[0].strides = __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_summary_p.diminfo[0].shape = __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_out_summary_n, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1786, __pyx_L1_error)
  }
  __pyx_pybuffernd_out_summary_n.diminfo[0].strides = __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out_summary_n.diminfo[0].shape = __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_parentNodeSummary_p, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1786, __pyx_L1_error)
  }
  __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides = __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].shape = __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.shape[0];

  /* "causalml/inference/tree/uplift.pyx":1835
 *         '''
 *         # group_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         cdef int n_class = group_count_arr.shape[0] / 2
 *         cdef int n = 0
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1836
 *         # group_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         cdef int i = 0
 *         cdef int n_class = group_count_arr.shape[0] / 2             # <<<<<<<<<<<<<<
 *         cdef int n = 0
 *         cdef int n_pos = 0
 */
  __pyx_v_n_class = (((long)(__pyx_v_group_count_arr->dimensions[0])) / 2);

  /* "causalml/inference/tree/uplift.pyx":1837
 *         cdef int i = 0
 *         cdef int n_class = group_count_arr.shape[0] / 2
 *         cdef int n = 0             # <<<<<<<<<<<<<<
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0
 */
  __pyx_v_n = 0;

  /* "causalml/inference/tree/uplift.pyx":1838
 *         cdef int n_class = group_count_arr.shape[0] / 2
 *         cdef int n = 0
 *         cdef int n_pos = 0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment
 */
  __pyx_v_n_pos = 0;

  /* "causalml/inference/tree/uplift.pyx":1839
 *         cdef int n = 0
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0             # <<<<<<<<<<<<<<
 *         cdef int n_min_sams = min_samples_treatment
 *         cdef P_TYPE_t n_reg_p = n_reg
 */
  __pyx_v_p = 0.0;

  /* "causalml/inference/tree/uplift.pyx":1840
 *         cdef int n_pos = 0
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t n_reg_p = n_reg
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_min_samples_treatment); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1840, __pyx_L1_error)
  __pyx_v_n_min_sams = __pyx_t_1;

  /* "causalml/inference/tree/uplift.pyx":1841
 *         cdef P_TYPE_t p = 0.0
 *         cdef int n_min_sams = min_samples_treatment
 *         cdef P_TYPE_t n_reg_p = n_reg             # <<<<<<<<<<<<<<
 * 
 *         # out_summary_p: [P(Y=1|T=i)...]
 */
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_n_reg); if (unlikely((__pyx_t_2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1841, __pyx_L1_error)
  __pyx_v_n_reg_p = __pyx_t_2;

  /* "causalml/inference/tree/uplift.pyx":1845
 *         # out_summary_p: [P(Y=1|T=i)...]
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:             # <<<<<<<<<<<<<<
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)
 */
  __pyx_t_3 = ((__pyx_v_has_parent_summary == 0) != 0);
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":1846
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:
 *             for i in range(n_class):             # <<<<<<<<<<<<<<
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = group_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 */
    __pyx_t_1 = __pyx_v_n_class;
    __pyx_t_4 = __pyx_t_1;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "causalml/inference/tree/uplift.pyx":1847
 *         if has_parent_summary == 0:
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)             # <<<<<<<<<<<<<<
 *                 n = group_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 */
      __pyx_t_6 = ((2 * __pyx_v_i) + 1);
      __pyx_v_n_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_group_count_arr.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":1848
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = group_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)             # <<<<<<<<<<<<<<
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n
 */
      __pyx_t_6 = (2 * __pyx_v_i);
      __pyx_v_n = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_group_count_arr.diminfo[0].strides)) + __pyx_v_n_pos);

      /* "causalml/inference/tree/uplift.pyx":1849
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)
 *                 n = group_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.             # <<<<<<<<<<<<<<
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p
 */
      if (((__pyx_v_n > 0) != 0)) {
        __pyx_t_7 = (((double)__pyx_v_n_pos) / ((double)__pyx_v_n));
      } else {
        __pyx_t_7 = 0.;
      }
      __pyx_v_p = __pyx_t_7;

      /* "causalml/inference/tree/uplift.pyx":1850
 *                 n = group_count_arr[2*i] + n_pos # N(Y=0|T=i) + N(Y=1|T=i) == N(T=i)
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n             # <<<<<<<<<<<<<<
 *                 out_summary_p[i] = p
 *         else:
 */
      __pyx_t_6 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_out_summary_n.diminfo[0].strides) = __pyx_v_n;

      /* "causalml/inference/tree/uplift.pyx":1851
 *                 p = (n_pos / <double> n) if n > 0 else 0.
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(n_class):
 */
      __pyx_t_6 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_out_summary_p.diminfo[0].strides) = __pyx_v_p;
    }

    /* "causalml/inference/tree/uplift.pyx":1845
 *         # out_summary_p: [P(Y=1|T=i)...]
 *         # out_summary_n: [N(T=i) ... ]
 *         if has_parent_summary == 0:             # <<<<<<<<<<<<<<
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1] # N(Y=1|T=i)
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":1853
 *                 out_summary_p[i] = p
 *         else:
 *             for i in range(n_class):             # <<<<<<<<<<<<<<
 *                 n_pos = group_count_arr[2*i + 1]
 *                 n = group_count_arr[2*i] + n_pos
 */
  /*else*/ {
    __pyx_t_1 = __pyx_v_n_class;
    __pyx_t_4 = __pyx_t_1;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "causalml/inference/tree/uplift.pyx":1854
 *         else:
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1]             # <<<<<<<<<<<<<<
 *                 n = group_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:
 */
      __pyx_t_6 = ((2 * __pyx_v_i) + 1);
      __pyx_v_n_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_group_count_arr.diminfo[0].strides));

      /* "causalml/inference/tree/uplift.pyx":1855
 *             for i in range(n_class):
 *                 n_pos = group_count_arr[2*i + 1]
 *                 n = group_count_arr[2*i] + n_pos             # <<<<<<<<<<<<<<
 *                 if n > n_min_sams:
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 */
      __pyx_t_6 = (2 * __pyx_v_i);
      __pyx_v_n = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_group_count_arr.diminfo[0].strides)) + __pyx_v_n_pos);

      /* "causalml/inference/tree/uplift.pyx":1856
 *                 n_pos = group_count_arr[2*i + 1]
 *                 n = group_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:             # <<<<<<<<<<<<<<
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 */
      __pyx_t_3 = ((__pyx_v_n > __pyx_v_n_min_sams) != 0);
      if (__pyx_t_3) {

        /* "causalml/inference/tree/uplift.pyx":1857
 *                 n = group_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)             # <<<<<<<<<<<<<<
 *                 else:
 *                     p = parentNodeSummary_p[i]
 */
        __pyx_t_6 = __pyx_v_i;
        __pyx_v_p = ((__pyx_v_n_pos + ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides)) * __pyx_v_n_reg_p)) / (((double)__pyx_v_n) + __pyx_v_n_reg_p));

        /* "causalml/inference/tree/uplift.pyx":1856
 *                 n_pos = group_count_arr[2*i + 1]
 *                 n = group_count_arr[2*i] + n_pos
 *                 if n > n_min_sams:             # <<<<<<<<<<<<<<
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 */
        goto __pyx_L8;
      }

      /* "causalml/inference/tree/uplift.pyx":1859
 *                     p = (n_pos + parentNodeSummary_p[i] * n_reg_p) / (<double> n + n_reg_p)
 *                 else:
 *                     p = parentNodeSummary_p[i]             # <<<<<<<<<<<<<<
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p
 */
      /*else*/ {
        __pyx_t_6 = __pyx_v_i;
        __pyx_v_p = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_parentNodeSummary_p.diminfo[0].strides));
      }
      __pyx_L8:;

      /* "causalml/inference/tree/uplift.pyx":1860
 *                 else:
 *                     p = parentNodeSummary_p[i]
 *                 out_summary_n[i] = n             # <<<<<<<<<<<<<<
 *                 out_summary_p[i] = p
 * 
 */
      __pyx_t_6 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_out_summary_n.diminfo[0].strides) = __pyx_v_n;

      /* "causalml/inference/tree/uplift.pyx":1861
 *                     p = parentNodeSummary_p[i]
 *                 out_summary_n[i] = n
 *                 out_summary_p[i] = p             # <<<<<<<<<<<<<<
 * 
 *     def uplift_classification_results(self, treatment_idx, y):
 */
      __pyx_t_6 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_out_summary_p.diminfo[0].strides) = __pyx_v_p;
    }
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":1786
 * 
 *     @staticmethod
 *     def tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             np.ndarray[N_TYPE_t, ndim=1] group_count_arr,
 *             np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.tree_node_summary_from_counts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_group_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parentNodeSummary_p.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1863
 *                 out_summary_p[i] = p
 * 
 *     def uplift_classification_results(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Classification probability for each treatment in the tree node.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_67uplift_classification_results(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_66uplift_classification_results[] = "\n        Classification probability for each treatment in the tree node.\n\n        Args\n        ----\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group index for each unit.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n\n        Returns\n        -------\n        res : list of list\n            The positive probabilities P(Y = 1) of each of the control and treatment groups\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_67uplift_classification_results = {"uplift_classification_results", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_67uplift_classification_results, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_66uplift_classification_results};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_67uplift_classification_results(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("uplift_classification_results (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("uplift_classification_results", 1, 3, 3, 1); __PYX_ERR(0, 1863, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("uplift_classification_results", 1, 3, 3, 2); __PYX_ERR(0, 1863, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uplift_classification_results") < 0)) __PYX_ERR(0, 1863, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_treatment_idx = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("uplift_classification_results", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1863, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.uplift_classification_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_66uplift_classification_results(__pyx_self, __pyx_v_self, __pyx_v_treatment_idx, __pyx_v_y);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_66uplift_classification_results(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_counts = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_v_n_pos = NULL;
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("uplift_classification_results", 0);

  /* "causalml/inference/tree/uplift.pyx":1880
 *         '''
 *         # counts: [[N(Y=0, T=0), N(Y=1, T=0)], [N(Y=0, T=1), N(Y=1, T=1)], ...]
 *         counts = self.group_uniqueCounts(treatment_idx, y)             # <<<<<<<<<<<<<<
 *         res = []
 *         for count in counts:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_group_uniqueCounts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_treatment_idx, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_treatment_idx, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_treatment_idx);
    __Pyx_GIVEREF(__pyx_v_treatment_idx);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_treatment_idx);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_counts = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1881
 *         # counts: [[N(Y=0, T=0), N(Y=1, T=0)], [N(Y=0, T=1), N(Y=1, T=1)], ...]
 *         counts = self.group_uniqueCounts(treatment_idx, y)
 *         res = []             # <<<<<<<<<<<<<<
 *         for count in counts:
 *             n_pos = count[1]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1882
 *         counts = self.group_uniqueCounts(treatment_idx, y)
 *         res = []
 *         for count in counts:             # <<<<<<<<<<<<<<
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 */
  if (likely(PyList_CheckExact(__pyx_v_counts)) || PyTuple_CheckExact(__pyx_v_counts)) {
    __pyx_t_1 = __pyx_v_counts; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_counts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1882, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1882, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1882, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1882, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_count, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1883
 *         res = []
 *         for count in counts:
 *             n_pos = count[1]             # <<<<<<<<<<<<<<
 *             n = count[0] + n_pos
 *             p = n_pos / n if n > 0 else 0.
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_count, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_n_pos, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":1884
 *         for count in counts:
 *             n_pos = count[1]
 *             n = count[0] + n_pos             # <<<<<<<<<<<<<<
 *             p = n_pos / n if n > 0 else 0.
 *             res.append(p)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_count, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_v_n_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":1885
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 *             p = n_pos / n if n > 0 else 0.             # <<<<<<<<<<<<<<
 *             res.append(p)
 *         return res
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1885, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_n_pos, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_INCREF(__pyx_float_0_);
      __pyx_t_5 = __pyx_float_0_;
    }
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":1886
 *             n = count[0] + n_pos
 *             p = n_pos / n if n > 0 else 0.
 *             res.append(p)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_p); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1886, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":1882
 *         counts = self.group_uniqueCounts(treatment_idx, y)
 *         res = []
 *         for count in counts:             # <<<<<<<<<<<<<<
 *             n_pos = count[1]
 *             n = count[0] + n_pos
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1887
 *             p = n_pos / n if n > 0 else 0.
 *             res.append(p)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":1863
 *                 out_summary_p[i] = p
 * 
 *     def uplift_classification_results(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Classification probability for each treatment in the tree node.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.uplift_classification_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_counts);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XDECREF(__pyx_v_n_pos);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":1889
 *         return res
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *                              early_stopping_eval_diff_scale=1, max_depth=10,
 *                              min_samples_leaf=100, depth=1,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_69growDecisionTreeFrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_68growDecisionTreeFrom[] = "\n        Train the uplift decision tree.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n        treatment_idx : array-like, shape = [num_samples]\n            An array containing the treatment group idx for each unit.\n            The dtype should be numpy.int8.\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n        X_val : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to valid the uplift model.\n        treatment_val_idx : array-like, shape = [num_samples]\n            An array containing the validation treatment group idx for each unit.\n        y_val : array-like, shape = [num_samples]\n            An array containing the validation outcome of interest for each unit.\n        max_depth: int, optional (default=10)\n            The maximum depth of the tree.\n        min_samples_leaf: int, optional (default=100)\n            The minimum number of samples required to be split at a leaf node.\n        depth : int, optional (default = 1)\n            The current depth.\n        min_samples_treatment: int, optional (default=10)\n            The minimum number of samples required of the experiment group to be split at a leaf node.\n        n_reg: int, optional (default=10)\n            The regularization parameter defined in Rzepakowski et al. 2012,\n            the weight (in terms of sample size) of the parent node influence\n            on the child node, only effective for 'KL', 'ED', 'Chi', 'CTS' methods.\n        parentNodeSummary_p : array-like, shape [n_class]\n            Node summary probability statistics of the parent tree node.\n\n        Returns\n        -------\n        object of DecisionTree class\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_69growDecisionTreeFrom = {"growDecisionTreeFrom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_69growDecisionTreeFrom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_68growDecisionTreeFrom};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_69growDecisionTreeFrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment_idx = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_X_val = 0;
  PyObject *__pyx_v_treatment_val_idx = 0;
  PyObject *__pyx_v_y_val = 0;
  PyObject *__pyx_v_early_stopping_eval_diff_scale = 0;
  PyObject *__pyx_v_max_depth = 0;
  PyObject *__pyx_v_min_samples_leaf = 0;
  PyObject *__pyx_v_depth = 0;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  PyObject *__pyx_v_parentNodeSummary_p = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("growDecisionTreeFrom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment_idx,&__pyx_n_s_y,&__pyx_n_s_X_val,&__pyx_n_s_treatment_val_idx,&__pyx_n_s_y_val,&__pyx_n_s_early_stopping_eval_diff_scale,&__pyx_n_s_max_depth,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_depth,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,&__pyx_n_s_parentNodeSummary_p,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[7] = ((PyObject *)((PyObject *)__pyx_int_1));
    values[8] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[9] = ((PyObject *)((PyObject *)__pyx_int_100));
    values[10] = ((PyObject *)((PyObject *)__pyx_int_1));
    values[11] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[12] = ((PyObject *)((PyObject *)__pyx_int_100));

    /* "causalml/inference/tree/uplift.pyx":1893
 *                              min_samples_leaf=100, depth=1,
 *                              min_samples_treatment=10, n_reg=100,
 *                              parentNodeSummary_p=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Train the uplift decision tree.
 */
    values[13] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 1); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 2); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 3); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 4); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_val_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 5); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, 6); __PYX_ERR(0, 1889, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_early_stopping_eval_diff_scale);
          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_max_depth);
          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_min_samples_leaf);
          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_depth);
          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_min_samples_treatment);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_reg);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parentNodeSummary_p);
          if (value) { values[13] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "growDecisionTreeFrom") < 0)) __PYX_ERR(0, 1889, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment_idx = values[2];
    __pyx_v_y = values[3];
    __pyx_v_X_val = values[4];
    __pyx_v_treatment_val_idx = values[5];
    __pyx_v_y_val = values[6];
    __pyx_v_early_stopping_eval_diff_scale = values[7];
    __pyx_v_max_depth = values[8];
    __pyx_v_min_samples_leaf = values[9];
    __pyx_v_depth = values[10];
    __pyx_v_min_samples_treatment = values[11];
    __pyx_v_n_reg = values[12];
    __pyx_v_parentNodeSummary_p = values[13];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("growDecisionTreeFrom", 0, 7, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1889, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.growDecisionTreeFrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_68growDecisionTreeFrom(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_X_val, __pyx_v_treatment_val_idx, __pyx_v_y_val, __pyx_v_early_stopping_eval_diff_scale, __pyx_v_max_depth, __pyx_v_min_samples_leaf, __pyx_v_depth, __pyx_v_min_samples_treatment, __pyx_v_n_reg, __pyx_v_parentNodeSummary_p);

  /* "causalml/inference/tree/uplift.pyx":1889
 *         return res
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *                              early_stopping_eval_diff_scale=1, max_depth=10,
 *                              min_samples_leaf=100, depth=1,
 */

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_68growDecisionTreeFrom(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment_idx, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val_idx, PyObject *__pyx_v_y_val, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_depth, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_parentNodeSummary_p) {
  int __pyx_v_n_class;
  PyArrayObject *__pyx_v_left_count_arr = 0;
  PyArrayObject *__pyx_v_right_count_arr = 0;
  PyArrayObject *__pyx_v_total_count_arr = 0;
  PyArrayObject *__pyx_v_val_left_count_arr = 0;
  PyArrayObject *__pyx_v_val_right_count_arr = 0;
  PyArrayObject *__pyx_v_val_total_count_arr = 0;
  PyArrayObject *__pyx_v_cur_summary_p = 0;
  PyArrayObject *__pyx_v_cur_summary_n = 0;
  PyArrayObject *__pyx_v_left_summary_p = 0;
  PyArrayObject *__pyx_v_left_summary_n = 0;
  PyArrayObject *__pyx_v_right_summary_p = 0;
  PyArrayObject *__pyx_v_right_summary_n = 0;
  PyArrayObject *__pyx_v_val_left_summary_p = 0;
  PyArrayObject *__pyx_v_val_left_summary_n = 0;
  PyArrayObject *__pyx_v_val_right_summary_p = 0;
  PyArrayObject *__pyx_v_val_right_summary_n = 0;
  int __pyx_v_has_parent_summary;
  PyObject *__pyx_v_parent_summary_p = NULL;
  int __pyx_v_i;
  PyObject *__pyx_v_currentNodeSummary = NULL;
  PyObject *__pyx_v_currentScore = NULL;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_maxAbsDiff;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_maxDiff;
  int __pyx_v_bestTreatment;
  int __pyx_v_suboptTreatment;
  int __pyx_v_maxDiffTreatment;
  PyObject *__pyx_v_maxDiffSign = NULL;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_c;
  __pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t __pyx_v_n_t;
  int __pyx_v_i_tr;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_p_t;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_v_diff;
  PyObject *__pyx_v_p_value = NULL;
  PyObject *__pyx_v_upliftScore = NULL;
  PyObject *__pyx_v_bestGain = NULL;
  PyObject *__pyx_v_bestGainImp = NULL;
  PyObject *__pyx_v_bestAttribute = NULL;
  PyObject *__pyx_v_best_col = NULL;
  PyObject *__pyx_v_best_value = NULL;
  PyObject *__pyx_v_len_X = NULL;
  CYTHON_UNUSED Py_ssize_t __pyx_v_len_X_val;
  PyObject *__pyx_v_c_num_percentiles = NULL;
  PyObject *__pyx_v_c_cat_percentiles = NULL;
  PyObject *__pyx_v_columnCount = NULL;
  PyObject *__pyx_v_max_features = NULL;
  PyObject *__pyx_v_col = NULL;
  PyObject *__pyx_v_columnValues = NULL;
  PyObject *__pyx_v_lsUnique = NULL;
  int __pyx_v_is_split_by_gt;
  PyObject *__pyx_v_lspercentile = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_len_X_l = NULL;
  PyObject *__pyx_v_len_X_r = NULL;
  PyObject *__pyx_v_p = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_len_X_val_l = NULL;
  int __pyx_v_early_stopping_flag;
  int __pyx_v_k;
  PyObject *__pyx_v_node_mst = NULL;
  PyObject *__pyx_v_leftScore1 = NULL;
  PyObject *__pyx_v_rightScore2 = NULL;
  PyObject *__pyx_v_gain = NULL;
  PyObject *__pyx_v_gain_for_imp = NULL;
  PyObject *__pyx_v_currentDivergence = NULL;
  PyObject *__pyx_v_norm_factor = NULL;
  PyObject *__pyx_v_X_l = NULL;
  PyObject *__pyx_v_X_r = NULL;
  PyObject *__pyx_v_w_l = NULL;
  PyObject *__pyx_v_w_r = NULL;
  PyObject *__pyx_v_y_l = NULL;
  PyObject *__pyx_v_y_r = NULL;
  PyObject *__pyx_v_X_val_l = NULL;
  PyObject *__pyx_v_X_val_r = NULL;
  PyObject *__pyx_v_w_val_l = NULL;
  PyObject *__pyx_v_w_val_r = NULL;
  PyObject *__pyx_v_y_val_l = NULL;
  PyObject *__pyx_v_y_val_r = NULL;
  PyObject *__pyx_v_best_set_left = NULL;
  PyObject *__pyx_v_best_set_right = NULL;
  PyObject *__pyx_v_dcY = NULL;
  PyObject *__pyx_v_summary = NULL;
  PyObject *__pyx_v_trueBranch = NULL;
  PyObject *__pyx_v_falseBranch = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cur_summary_n;
  __Pyx_Buffer __pyx_pybuffer_cur_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_cur_summary_p;
  __Pyx_Buffer __pyx_pybuffer_cur_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_count_arr;
  __Pyx_Buffer __pyx_pybuffer_left_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_summary_n;
  __Pyx_Buffer __pyx_pybuffer_left_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_summary_p;
  __Pyx_Buffer __pyx_pybuffer_left_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_count_arr;
  __Pyx_Buffer __pyx_pybuffer_right_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_summary_n;
  __Pyx_Buffer __pyx_pybuffer_right_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_summary_p;
  __Pyx_Buffer __pyx_pybuffer_right_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_total_count_arr;
  __Pyx_Buffer __pyx_pybuffer_total_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_left_count_arr;
  __Pyx_Buffer __pyx_pybuffer_val_left_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_left_summary_n;
  __Pyx_Buffer __pyx_pybuffer_val_left_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_left_summary_p;
  __Pyx_Buffer __pyx_pybuffer_val_left_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_right_count_arr;
  __Pyx_Buffer __pyx_pybuffer_val_right_count_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_right_summary_n;
  __Pyx_Buffer __pyx_pybuffer_val_right_summary_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_right_summary_p;
  __Pyx_Buffer __pyx_pybuffer_val_right_summary_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_val_total_count_arr;
  __Pyx_Buffer __pyx_pybuffer_val_total_count_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyArrayObject *__pyx_t_12 = NULL;
  PyArrayObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyArrayObject *__pyx_t_16 = NULL;
  PyArrayObject *__pyx_t_17 = NULL;
  PyArrayObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  PyArrayObject *__pyx_t_20 = NULL;
  int __pyx_t_21;
  PyArrayObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyArrayObject *__pyx_t_26 = NULL;
  PyArrayObject *__pyx_t_27 = NULL;
  int __pyx_t_28;
  int __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  PyObject *__pyx_t_33 = NULL;
  PyObject *__pyx_t_34 = NULL;
  PyObject *(*__pyx_t_35)(PyObject *);
  PyObject *__pyx_t_36 = NULL;
  long __pyx_t_37;
  long __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  PyObject *__pyx_t_41 = NULL;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_42;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_43;
  __pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t __pyx_t_44;
  PyObject *(*__pyx_t_45)(PyObject *);
  PyObject *__pyx_t_46 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("growDecisionTreeFrom", 0);
  __pyx_pybuffer_left_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_left_count_arr.refcount = 0;
  __pyx_pybuffernd_left_count_arr.data = NULL;
  __pyx_pybuffernd_left_count_arr.rcbuffer = &__pyx_pybuffer_left_count_arr;
  __pyx_pybuffer_right_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_right_count_arr.refcount = 0;
  __pyx_pybuffernd_right_count_arr.data = NULL;
  __pyx_pybuffernd_right_count_arr.rcbuffer = &__pyx_pybuffer_right_count_arr;
  __pyx_pybuffer_total_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_total_count_arr.refcount = 0;
  __pyx_pybuffernd_total_count_arr.data = NULL;
  __pyx_pybuffernd_total_count_arr.rcbuffer = &__pyx_pybuffer_total_count_arr;
  __pyx_pybuffer_val_left_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_val_left_count_arr.refcount = 0;
  __pyx_pybuffernd_val_left_count_arr.data = NULL;
  __pyx_pybuffernd_val_left_count_arr.rcbuffer = &__pyx_pybuffer_val_left_count_arr;
  __pyx_pybuffer_val_right_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_val_right_count_arr.refcount = 0;
  __pyx_pybuffernd_val_right_count_arr.data = NULL;
  __pyx_pybuffernd_val_right_count_arr.rcbuffer = &__pyx_pybuffer_val_right_count_arr;
  __pyx_pybuffer_val_total_count_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_val_total_count_arr.refcount = 0;
  __pyx_pybuffernd_val_total_count_arr.data = NULL;
  __pyx_pybuffernd_val_total_count_arr.rcbuffer = &__pyx_pybuffer_val_total_count_arr;
  __pyx_pybuffer_cur_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_cur_summary_p.refcount = 0;
  __pyx_pybuffernd_cur_summary_p.data = NULL;
  __pyx_pybuffernd_cur_summary_p.rcbuffer = &__pyx_pybuffer_cur_summary_p;
  __pyx_pybuffer_cur_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_cur_summary_n.refcount = 0;
  __pyx_pybuffernd_cur_summary_n.data = NULL;
  __pyx_pybuffernd_cur_summary_n.rcbuffer = &__pyx_pybuffer_cur_summary_n;
  __pyx_pybuffer_left_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_left_summary_p.refcount = 0;
  __pyx_pybuffernd_left_summary_p.data = NULL;
  __pyx_pybuffernd_left_summary_p.rcbuffer = &__pyx_pybuffer_left_summary_p;
  __pyx_pybuffer_left_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_left_summary_n.refcount = 0;
  __pyx_pybuffernd_left_summary_n.data = NULL;
  __pyx_pybuffernd_left_summary_n.rcbuffer = &__pyx_pybuffer_left_summary_n;
  __pyx_pybuffer_right_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_right_summary_p.refcount = 0;
  __pyx_pybuffernd_right_summary_p.data = NULL;
  __pyx_pybuffernd_right_summary_p.rcbuffer = &__pyx_pybuffer_right_summary_p;
  __pyx_pybuffer_right_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_right_summary_n.refcount = 0;
  __pyx_pybuffernd_right_summary_n.data = NULL;
  __pyx_pybuffernd_right_summary_n.rcbuffer = &__pyx_pybuffer_right_summary_n;
  __pyx_pybuffer_val_left_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_val_left_summary_p.refcount = 0;
  __pyx_pybuffernd_val_left_summary_p.data = NULL;
  __pyx_pybuffernd_val_left_summary_p.rcbuffer = &__pyx_pybuffer_val_left_summary_p;
  __pyx_pybuffer_val_left_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_val_left_summary_n.refcount = 0;
  __pyx_pybuffernd_val_left_summary_n.data = NULL;
  __pyx_pybuffernd_val_left_summary_n.rcbuffer = &__pyx_pybuffer_val_left_summary_n;
  __pyx_pybuffer_val_right_summary_p.pybuffer.buf = NULL;
  __pyx_pybuffer_val_right_summary_p.refcount = 0;
  __pyx_pybuffernd_val_right_summary_p.data = NULL;
  __pyx_pybuffernd_val_right_summary_p.rcbuffer = &__pyx_pybuffer_val_right_summary_p;
  __pyx_pybuffer_val_right_summary_n.pybuffer.buf = NULL;
  __pyx_pybuffer_val_right_summary_n.refcount = 0;
  __pyx_pybuffernd_val_right_summary_n.data = NULL;
  __pyx_pybuffernd_val_right_summary_n.rcbuffer = &__pyx_pybuffer_val_right_summary_n;

  /* "causalml/inference/tree/uplift.pyx":1932
 *         '''
 * 
 *         if len(X) == 0:             # <<<<<<<<<<<<<<
 *             return DecisionTree(classes_=self.classes_)
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1932, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 == 0) != 0);
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":1933
 * 
 *         if len(X) == 0:
 *             return DecisionTree(classes_=self.classes_)             # <<<<<<<<<<<<<<
 * 
 *         assert treatment_idx.dtype == TR_TYPE
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DecisionTree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_classes, __pyx_t_5) < 0) __PYX_ERR(0, 1933, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1933, __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_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":1932
 *         '''
 * 
 *         if len(X) == 0:             # <<<<<<<<<<<<<<
 *             return DecisionTree(classes_=self.classes_)
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":1935
 *             return DecisionTree(classes_=self.classes_)
 * 
 *         assert treatment_idx.dtype == TR_TYPE             # <<<<<<<<<<<<<<
 *         assert y.dtype == Y_TYPE
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_treatment_idx, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_TR_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1935, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 1935, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":1936
 * 
 *         assert treatment_idx.dtype == TR_TYPE
 *         assert y.dtype == Y_TYPE             # <<<<<<<<<<<<<<
 * 
 *         # some temporary buffers for node summaries
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_y, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Y_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1936, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 1936, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":1939
 * 
 *         # some temporary buffers for node summaries
 *         cdef int n_class = self.n_class             # <<<<<<<<<<<<<<
 *         # buffers for group counts, right can be derived from total and left
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_n_class = __pyx_t_6;

  /* "causalml/inference/tree/uplift.pyx":1941
 *         cdef int n_class = self.n_class
 *         # buffers for group counts, right can be derived from total and left
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1941, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_left_count_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1941, __pyx_L1_error)
    } else {__pyx_pybuffernd_left_count_arr.diminfo[0].strides = __pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_count_arr.diminfo[0].shape = __pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_left_count_arr = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":1942
 *         # buffers for group counts, right can be derived from total and left
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *         # for X_val if any, allocate if needed below
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1942, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_right_count_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1942, __pyx_L1_error)
    } else {__pyx_pybuffernd_right_count_arr.diminfo[0].strides = __pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_count_arr.diminfo[0].shape = __pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_right_count_arr = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":1943
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         # for X_val if any, allocate if needed below
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_left_count_arr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyNumber_Multiply(__pyx_int_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1943, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_total_count_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1943, __pyx_L1_error)
    } else {__pyx_pybuffernd_total_count_arr.diminfo[0].strides = __pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_total_count_arr.diminfo[0].shape = __pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_total_count_arr = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1949
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_total_count_arr
 *         # buffers for node summary
 *         cdef np.ndarray[P_TYPE_t, ndim=1] cur_summary_p = np.zeros(self.n_class, dtype = P_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] cur_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1949, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cur_summary_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1949, __pyx_L1_error)
    } else {__pyx_pybuffernd_cur_summary_p.diminfo[0].strides = __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cur_summary_p.diminfo[0].shape = __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_cur_summary_p = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1950
 *         # buffers for node summary
 *         cdef np.ndarray[P_TYPE_t, ndim=1] cur_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] cur_summary_n = np.zeros(self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[P_TYPE_t, ndim=1] left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1950, __pyx_L1_error)
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_cur_summary_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1950, __pyx_L1_error)
    } else {__pyx_pybuffernd_cur_summary_n.diminfo[0].strides = __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cur_summary_n.diminfo[0].shape = __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_12 = 0;
  __pyx_v_cur_summary_n = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":1951
 *         cdef np.ndarray[P_TYPE_t, ndim=1] cur_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] cur_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1951, __pyx_L1_error)
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_left_summary_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1951, __pyx_L1_error)
    } else {__pyx_pybuffernd_left_summary_p.diminfo[0].strides = __pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_summary_p.diminfo[0].shape = __pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_13 = 0;
  __pyx_v_left_summary_p = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1952
 *         cdef np.ndarray[N_TYPE_t, ndim=1] cur_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[P_TYPE_t, ndim=1] right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1952, __pyx_L1_error)
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_left_summary_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1952, __pyx_L1_error)
    } else {__pyx_pybuffernd_left_summary_n.diminfo[0].strides = __pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_summary_n.diminfo[0].shape = __pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_14 = 0;
  __pyx_v_left_summary_n = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1953
 *         cdef np.ndarray[P_TYPE_t, ndim=1] left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         # for val left and right summary
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1953, __pyx_L1_error)
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_right_summary_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1953, __pyx_L1_error)
    } else {__pyx_pybuffernd_right_summary_p.diminfo[0].strides = __pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_summary_p.diminfo[0].shape = __pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_15 = 0;
  __pyx_v_right_summary_p = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":1954
 *         cdef np.ndarray[N_TYPE_t, ndim=1] left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         # for val left and right summary
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1954, __pyx_L1_error)
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_right_summary_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1954, __pyx_L1_error)
    } else {__pyx_pybuffernd_right_summary_n.diminfo[0].strides = __pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_summary_n.diminfo[0].shape = __pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_16 = 0;
  __pyx_v_right_summary_n = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1956
 *         cdef np.ndarray[N_TYPE_t, ndim=1] right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         # for val left and right summary
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1956, __pyx_L1_error)
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_val_left_summary_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1956, __pyx_L1_error)
    } else {__pyx_pybuffernd_val_left_summary_p.diminfo[0].strides = __pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_left_summary_p.diminfo[0].shape = __pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_17 = 0;
  __pyx_v_val_left_summary_p = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1957
 *         # for val left and right summary
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1957, __pyx_L1_error)
  __pyx_t_18 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_val_left_summary_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1957, __pyx_L1_error)
    } else {__pyx_pybuffernd_val_left_summary_n.diminfo[0].strides = __pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_left_summary_n.diminfo[0].shape = __pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_18 = 0;
  __pyx_v_val_left_summary_n = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":1958
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_left_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)             # <<<<<<<<<<<<<<
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1958, __pyx_L1_error)
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_val_right_summary_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1958, __pyx_L1_error)
    } else {__pyx_pybuffernd_val_right_summary_p.diminfo[0].strides = __pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_right_summary_p.diminfo[0].shape = __pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_19 = 0;
  __pyx_v_val_right_summary_p = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1959
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_left_summary_n = np.zeros(self.n_class, dtype = N_TYPE)
 *         cdef np.ndarray[P_TYPE_t, ndim=1] val_right_summary_p = np.zeros(self.n_class, dtype = P_TYPE)
 *         cdef np.ndarray[N_TYPE_t, ndim=1] val_right_summary_n = np.zeros(self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 * 
 *         # dummy
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1959, __pyx_L1_error)
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_val_right_summary_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1959, __pyx_L1_error)
    } else {__pyx_pybuffernd_val_right_summary_n.diminfo[0].strides = __pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_right_summary_n.diminfo[0].shape = __pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_20 = 0;
  __pyx_v_val_right_summary_n = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1962
 * 
 *         # dummy
 *         cdef int has_parent_summary = 0             # <<<<<<<<<<<<<<
 *         if parentNodeSummary_p is None:
 *             parent_summary_p = np.zeros(self.n_class, dtype = P_TYPE) # dummy for calling tree_node_summary_to_arr
 */
  __pyx_v_has_parent_summary = 0;

  /* "causalml/inference/tree/uplift.pyx":1963
 *         # dummy
 *         cdef int has_parent_summary = 0
 *         if parentNodeSummary_p is None:             # <<<<<<<<<<<<<<
 *             parent_summary_p = np.zeros(self.n_class, dtype = P_TYPE) # dummy for calling tree_node_summary_to_arr
 *             has_parent_summary = 0
 */
  __pyx_t_2 = (__pyx_v_parentNodeSummary_p == Py_None);
  __pyx_t_21 = (__pyx_t_2 != 0);
  if (__pyx_t_21) {

    /* "causalml/inference/tree/uplift.pyx":1964
 *         cdef int has_parent_summary = 0
 *         if parentNodeSummary_p is None:
 *             parent_summary_p = np.zeros(self.n_class, dtype = P_TYPE) # dummy for calling tree_node_summary_to_arr             # <<<<<<<<<<<<<<
 *             has_parent_summary = 0
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_P_TYPE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_parent_summary_p = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":1965
 *         if parentNodeSummary_p is None:
 *             parent_summary_p = np.zeros(self.n_class, dtype = P_TYPE) # dummy for calling tree_node_summary_to_arr
 *             has_parent_summary = 0             # <<<<<<<<<<<<<<
 *         else:
 *             parent_summary_p = parentNodeSummary_p
 */
    __pyx_v_has_parent_summary = 0;

    /* "causalml/inference/tree/uplift.pyx":1963
 *         # dummy
 *         cdef int has_parent_summary = 0
 *         if parentNodeSummary_p is None:             # <<<<<<<<<<<<<<
 *             parent_summary_p = np.zeros(self.n_class, dtype = P_TYPE) # dummy for calling tree_node_summary_to_arr
 *             has_parent_summary = 0
 */
    goto __pyx_L4;
  }

  /* "causalml/inference/tree/uplift.pyx":1967
 *             has_parent_summary = 0
 *         else:
 *             parent_summary_p = parentNodeSummary_p             # <<<<<<<<<<<<<<
 *             has_parent_summary = 1
 * 
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_parentNodeSummary_p);
    __pyx_v_parent_summary_p = __pyx_v_parentNodeSummary_p;

    /* "causalml/inference/tree/uplift.pyx":1968
 *         else:
 *             parent_summary_p = parentNodeSummary_p
 *             has_parent_summary = 1             # <<<<<<<<<<<<<<
 * 
 *         cdef int i = 0
 */
    __pyx_v_has_parent_summary = 1;
  }
  __pyx_L4:;

  /* "causalml/inference/tree/uplift.pyx":1970
 *             has_parent_summary = 1
 * 
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 * 
 *         # preparation: fill in the total count, then for each
 */
  __pyx_v_i = 0;

  /* "causalml/inference/tree/uplift.pyx":1977
 * 
 *         # group_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         group_uniqueCounts_to_arr(treatment_idx, y, total_count_arr)             # <<<<<<<<<<<<<<
 *         if X_val is not None:
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_group_uniqueCounts_to_arr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_treatment_idx, __pyx_v_y, ((PyObject *)__pyx_v_total_count_arr)};
    __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_treatment_idx, __pyx_v_y, ((PyObject *)__pyx_v_total_count_arr)};
    __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_treatment_idx);
    __Pyx_GIVEREF(__pyx_v_treatment_idx);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_treatment_idx);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_y);
    __Pyx_INCREF(((PyObject *)__pyx_v_total_count_arr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_total_count_arr));
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, ((PyObject *)__pyx_v_total_count_arr));
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":1978
 *         # group_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         group_uniqueCounts_to_arr(treatment_idx, y, total_count_arr)
 *         if X_val is not None:             # <<<<<<<<<<<<<<
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
  __pyx_t_21 = (__pyx_v_X_val != Py_None);
  __pyx_t_2 = (__pyx_t_21 != 0);
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":1979
 *         group_uniqueCounts_to_arr(treatment_idx, y, total_count_arr)
 *         if X_val is not None:
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1979, __pyx_L1_error)
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_val_left_count_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
        }
        __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
      }
      __pyx_pybuffernd_val_left_count_arr.diminfo[0].strides = __pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_left_count_arr.diminfo[0].shape = __pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1979, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_val_left_count_arr = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":1980
 *         if X_val is not None:
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *             val_total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             group_uniqueCounts_to_arr(treatment_val_idx, y_val, val_total_count_arr)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Multiply(__pyx_int_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1980, __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_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1980, __pyx_L1_error)
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_val_right_count_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
        }
        __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_val_right_count_arr.diminfo[0].strides = __pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_right_count_arr.diminfo[0].shape = __pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1980, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_val_right_count_arr = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":1981
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)             # <<<<<<<<<<<<<<
 *             group_uniqueCounts_to_arr(treatment_val_idx, y_val, val_total_count_arr)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_N_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1981, __pyx_L1_error)
    __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_val_total_count_arr, &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
        }
        __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
      }
      __pyx_pybuffernd_val_total_count_arr.diminfo[0].strides = __pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_val_total_count_arr.diminfo[0].shape = __pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1981, __pyx_L1_error)
    }
    __pyx_t_27 = 0;
    __pyx_v_val_total_count_arr = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":1982
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_total_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             group_uniqueCounts_to_arr(treatment_val_idx, y_val, val_total_count_arr)             # <<<<<<<<<<<<<<
 * 
 *         # Current node summary: [P(Y=1|T=i)...] and [N(T=i)...]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_group_uniqueCounts_to_arr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_treatment_val_idx, __pyx_v_y_val, ((PyObject *)__pyx_v_val_total_count_arr)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1982, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_treatment_val_idx, __pyx_v_y_val, ((PyObject *)__pyx_v_val_total_count_arr)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1982, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1982, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_treatment_val_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_val_idx);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_treatment_val_idx);
      __Pyx_INCREF(__pyx_v_y_val);
      __Pyx_GIVEREF(__pyx_v_y_val);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y_val);
      __Pyx_INCREF(((PyObject *)__pyx_v_val_total_count_arr));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_val_total_count_arr));
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, ((PyObject *)__pyx_v_val_total_count_arr));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1982, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":1978
 *         # group_count_arr: [N(Y=0, T=0), N(Y=1, T=0), N(Y=0, T=1), N(Y=1, T=1), ...]
 *         group_uniqueCounts_to_arr(treatment_idx, y, total_count_arr)
 *         if X_val is not None:             # <<<<<<<<<<<<<<
 *             val_left_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 *             val_right_count_arr = np.zeros(2 * self.n_class, dtype = N_TYPE)
 */
  }

  /* "causalml/inference/tree/uplift.pyx":1985
 * 
 *         # Current node summary: [P(Y=1|T=i)...] and [N(T=i)...]
 *         self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             total_count_arr,
 *             cur_summary_p, cur_summary_n,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary_from_counts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1989
 *             cur_summary_p, cur_summary_n,
 *             parent_summary_p,
 *             has_parent_summary,             # <<<<<<<<<<<<<<
 *             min_samples_treatment=min_samples_treatment,
 *             n_reg=n_reg
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_has_parent_summary); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "causalml/inference/tree/uplift.pyx":1985
 * 
 *         # Current node summary: [P(Y=1|T=i)...] and [N(T=i)...]
 *         self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             total_count_arr,
 *             cur_summary_p, cur_summary_n,
 */
  __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_total_count_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_total_count_arr));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_total_count_arr));
  __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_cur_summary_p));
  __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_n));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_n));
  PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_v_cur_summary_n));
  __Pyx_INCREF(__pyx_v_parent_summary_p);
  __Pyx_GIVEREF(__pyx_v_parent_summary_p);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_parent_summary_p);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":1990
 *             parent_summary_p,
 *             has_parent_summary,
 *             min_samples_treatment=min_samples_treatment,             # <<<<<<<<<<<<<<
 *             n_reg=n_reg
 *             )
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_samples_treatment, __pyx_v_min_samples_treatment) < 0) __PYX_ERR(0, 1990, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1991
 *             has_parent_summary,
 *             min_samples_treatment=min_samples_treatment,
 *             n_reg=n_reg             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 1990, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1985
 * 
 *         # Current node summary: [P(Y=1|T=i)...] and [N(T=i)...]
 *         self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             total_count_arr,
 *             cur_summary_p, cur_summary_n,
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1998
 * 
 *         # Current node summary: [[P(Y=1|T=i), N(T=i)]...]
 *         currentNodeSummary = []             # <<<<<<<<<<<<<<
 *         for i in range(n_class):
 *             currentNodeSummary.append([cur_summary_p[i], cur_summary_n[i]])
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_currentNodeSummary = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":1999
 *         # Current node summary: [[P(Y=1|T=i), N(T=i)]...]
 *         currentNodeSummary = []
 *         for i in range(n_class):             # <<<<<<<<<<<<<<
 *             currentNodeSummary.append([cur_summary_p[i], cur_summary_n[i]])
 *         #
 */
  __pyx_t_6 = __pyx_v_n_class;
  __pyx_t_28 = __pyx_t_6;
  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
    __pyx_v_i = __pyx_t_29;

    /* "causalml/inference/tree/uplift.pyx":2000
 *         currentNodeSummary = []
 *         for i in range(n_class):
 *             currentNodeSummary.append([cur_summary_p[i], cur_summary_n[i]])             # <<<<<<<<<<<<<<
 *         #
 * 
 */
    __pyx_t_30 = __pyx_v_i;
    __pyx_t_5 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_p.diminfo[0].strides))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_30 = __pyx_v_i;
    __pyx_t_4 = __Pyx_PyInt_From_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_n.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_31 = __Pyx_PyList_Append(__pyx_v_currentNodeSummary, __pyx_t_7); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 2000, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }

  /* "causalml/inference/tree/uplift.pyx":2003
 *         #
 * 
 *         if self.evaluationFunction == self.evaluate_IT or self.evaluationFunction == self.evaluate_CIT:             # <<<<<<<<<<<<<<
 *             currentScore = 0
 *         else:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_IT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!__pyx_t_21) {
  } else {
    __pyx_t_2 = __pyx_t_21;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_CIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_2 = __pyx_t_21;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":2004
 * 
 *         if self.evaluationFunction == self.evaluate_IT or self.evaluationFunction == self.evaluate_CIT:
 *             currentScore = 0             # <<<<<<<<<<<<<<
 *         else:
 *             currentScore = self.arr_eval_func(cur_summary_p, cur_summary_n)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_currentScore = __pyx_int_0;

    /* "causalml/inference/tree/uplift.pyx":2003
 *         #
 * 
 *         if self.evaluationFunction == self.evaluate_IT or self.evaluationFunction == self.evaluate_CIT:             # <<<<<<<<<<<<<<
 *             currentScore = 0
 *         else:
 */
    goto __pyx_L8;
  }

  /* "causalml/inference/tree/uplift.pyx":2006
 *             currentScore = 0
 *         else:
 *             currentScore = self.arr_eval_func(cur_summary_p, cur_summary_n)             # <<<<<<<<<<<<<<
 * 
 *         # Prune Stats:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_cur_summary_p), ((PyObject *)__pyx_v_cur_summary_n)};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_cur_summary_p), ((PyObject *)__pyx_v_cur_summary_n)};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
      __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_n));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_n));
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_n));
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_currentScore = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L8:;

  /* "causalml/inference/tree/uplift.pyx":2009
 * 
 *         # Prune Stats:
 *         cdef P_TYPE_t maxAbsDiff = 0.0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t maxDiff = -1.
 *         cdef int bestTreatment = 0       # treatment index for the control group, also used in returning the tree for this node
 */
  __pyx_v_maxAbsDiff = 0.0;

  /* "causalml/inference/tree/uplift.pyx":2010
 *         # Prune Stats:
 *         cdef P_TYPE_t maxAbsDiff = 0.0
 *         cdef P_TYPE_t maxDiff = -1.             # <<<<<<<<<<<<<<
 *         cdef int bestTreatment = 0       # treatment index for the control group, also used in returning the tree for this node
 *         cdef int suboptTreatment = 0     # treatment index for the control group
 */
  __pyx_v_maxDiff = -1.;

  /* "causalml/inference/tree/uplift.pyx":2011
 *         cdef P_TYPE_t maxAbsDiff = 0.0
 *         cdef P_TYPE_t maxDiff = -1.
 *         cdef int bestTreatment = 0       # treatment index for the control group, also used in returning the tree for this node             # <<<<<<<<<<<<<<
 *         cdef int suboptTreatment = 0     # treatment index for the control group
 *         cdef int maxDiffTreatment = 0    # treatment index for the control group, also used in returning the tree for this node
 */
  __pyx_v_bestTreatment = 0;

  /* "causalml/inference/tree/uplift.pyx":2012
 *         cdef P_TYPE_t maxDiff = -1.
 *         cdef int bestTreatment = 0       # treatment index for the control group, also used in returning the tree for this node
 *         cdef int suboptTreatment = 0     # treatment index for the control group             # <<<<<<<<<<<<<<
 *         cdef int maxDiffTreatment = 0    # treatment index for the control group, also used in returning the tree for this node
 *         maxDiffSign = 0 # also used in returning the tree for this node
 */
  __pyx_v_suboptTreatment = 0;

  /* "causalml/inference/tree/uplift.pyx":2013
 *         cdef int bestTreatment = 0       # treatment index for the control group, also used in returning the tree for this node
 *         cdef int suboptTreatment = 0     # treatment index for the control group
 *         cdef int maxDiffTreatment = 0    # treatment index for the control group, also used in returning the tree for this node             # <<<<<<<<<<<<<<
 *         maxDiffSign = 0 # also used in returning the tree for this node
 *         # adapted to new current node summary format
 */
  __pyx_v_maxDiffTreatment = 0;

  /* "causalml/inference/tree/uplift.pyx":2014
 *         cdef int suboptTreatment = 0     # treatment index for the control group
 *         cdef int maxDiffTreatment = 0    # treatment index for the control group, also used in returning the tree for this node
 *         maxDiffSign = 0 # also used in returning the tree for this node             # <<<<<<<<<<<<<<
 *         # adapted to new current node summary format
 *         cdef P_TYPE_t p_c = cur_summary_p[0]
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_maxDiffSign = __pyx_int_0;

  /* "causalml/inference/tree/uplift.pyx":2016
 *         maxDiffSign = 0 # also used in returning the tree for this node
 *         # adapted to new current node summary format
 *         cdef P_TYPE_t p_c = cur_summary_p[0]             # <<<<<<<<<<<<<<
 *         cdef N_TYPE_t n_c = cur_summary_n[0]
 *         cdef N_TYPE_t n_t = 0
 */
  __pyx_t_30 = 0;
  __pyx_v_p_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_p.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":2017
 *         # adapted to new current node summary format
 *         cdef P_TYPE_t p_c = cur_summary_p[0]
 *         cdef N_TYPE_t n_c = cur_summary_n[0]             # <<<<<<<<<<<<<<
 *         cdef N_TYPE_t n_t = 0
 *         cdef int i_tr = 0
 */
  __pyx_t_30 = 0;
  __pyx_v_n_c = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_n.diminfo[0].strides));

  /* "causalml/inference/tree/uplift.pyx":2018
 *         cdef P_TYPE_t p_c = cur_summary_p[0]
 *         cdef N_TYPE_t n_c = cur_summary_n[0]
 *         cdef N_TYPE_t n_t = 0             # <<<<<<<<<<<<<<
 *         cdef int i_tr = 0
 *         cdef P_TYPE_t p_t = 0.0, diff = 0.0
 */
  __pyx_v_n_t = 0;

  /* "causalml/inference/tree/uplift.pyx":2019
 *         cdef N_TYPE_t n_c = cur_summary_n[0]
 *         cdef N_TYPE_t n_t = 0
 *         cdef int i_tr = 0             # <<<<<<<<<<<<<<
 *         cdef P_TYPE_t p_t = 0.0, diff = 0.0
 * 
 */
  __pyx_v_i_tr = 0;

  /* "causalml/inference/tree/uplift.pyx":2020
 *         cdef N_TYPE_t n_t = 0
 *         cdef int i_tr = 0
 *         cdef P_TYPE_t p_t = 0.0, diff = 0.0             # <<<<<<<<<<<<<<
 * 
 *         for i_tr in range(1, n_class):
 */
  __pyx_v_p_t = 0.0;
  __pyx_v_diff = 0.0;

  /* "causalml/inference/tree/uplift.pyx":2022
 *         cdef P_TYPE_t p_t = 0.0, diff = 0.0
 * 
 *         for i_tr in range(1, n_class):             # <<<<<<<<<<<<<<
 *             p_t = cur_summary_p[i_tr]
 *             # P(Y=1|T=t) - P(Y=1|T=0)
 */
  __pyx_t_6 = __pyx_v_n_class;
  __pyx_t_28 = __pyx_t_6;
  for (__pyx_t_29 = 1; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
    __pyx_v_i_tr = __pyx_t_29;

    /* "causalml/inference/tree/uplift.pyx":2023
 * 
 *         for i_tr in range(1, n_class):
 *             p_t = cur_summary_p[i_tr]             # <<<<<<<<<<<<<<
 *             # P(Y=1|T=t) - P(Y=1|T=0)
 *             diff = p_t - p_c
 */
    __pyx_t_30 = __pyx_v_i_tr;
    __pyx_v_p_t = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_p.diminfo[0].strides));

    /* "causalml/inference/tree/uplift.pyx":2025
 *             p_t = cur_summary_p[i_tr]
 *             # P(Y=1|T=t) - P(Y=1|T=0)
 *             diff = p_t - p_c             # <<<<<<<<<<<<<<
 *             if fabs(diff) >= maxAbsDiff:
 *                 maxDiffTreatment = i_tr
 */
    __pyx_v_diff = (__pyx_v_p_t - __pyx_v_p_c);

    /* "causalml/inference/tree/uplift.pyx":2026
 *             # P(Y=1|T=t) - P(Y=1|T=0)
 *             diff = p_t - p_c
 *             if fabs(diff) >= maxAbsDiff:             # <<<<<<<<<<<<<<
 *                 maxDiffTreatment = i_tr
 *                 maxDiffSign = np.sign(diff)
 */
    __pyx_t_2 = ((fabs(__pyx_v_diff) >= __pyx_v_maxAbsDiff) != 0);
    if (__pyx_t_2) {

      /* "causalml/inference/tree/uplift.pyx":2027
 *             diff = p_t - p_c
 *             if fabs(diff) >= maxAbsDiff:
 *                 maxDiffTreatment = i_tr             # <<<<<<<<<<<<<<
 *                 maxDiffSign = np.sign(diff)
 *                 maxAbsDiff = fabs(diff)
 */
      __pyx_v_maxDiffTreatment = __pyx_v_i_tr;

      /* "causalml/inference/tree/uplift.pyx":2028
 *             if fabs(diff) >= maxAbsDiff:
 *                 maxDiffTreatment = i_tr
 *                 maxDiffSign = np.sign(diff)             # <<<<<<<<<<<<<<
 *                 maxAbsDiff = fabs(diff)
 *             if diff >= maxDiff:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sign); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_diff); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __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_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_maxDiffSign, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2029
 *                 maxDiffTreatment = i_tr
 *                 maxDiffSign = np.sign(diff)
 *                 maxAbsDiff = fabs(diff)             # <<<<<<<<<<<<<<
 *             if diff >= maxDiff:
 *                 maxDiff = diff
 */
      __pyx_v_maxAbsDiff = fabs(__pyx_v_diff);

      /* "causalml/inference/tree/uplift.pyx":2026
 *             # P(Y=1|T=t) - P(Y=1|T=0)
 *             diff = p_t - p_c
 *             if fabs(diff) >= maxAbsDiff:             # <<<<<<<<<<<<<<
 *                 maxDiffTreatment = i_tr
 *                 maxDiffSign = np.sign(diff)
 */
    }

    /* "causalml/inference/tree/uplift.pyx":2030
 *                 maxDiffSign = np.sign(diff)
 *                 maxAbsDiff = fabs(diff)
 *             if diff >= maxDiff:             # <<<<<<<<<<<<<<
 *                 maxDiff = diff
 *                 suboptTreatment = i_tr
 */
    __pyx_t_2 = ((__pyx_v_diff >= __pyx_v_maxDiff) != 0);
    if (__pyx_t_2) {

      /* "causalml/inference/tree/uplift.pyx":2031
 *                 maxAbsDiff = fabs(diff)
 *             if diff >= maxDiff:
 *                 maxDiff = diff             # <<<<<<<<<<<<<<
 *                 suboptTreatment = i_tr
 *                 if diff > 0:
 */
      __pyx_v_maxDiff = __pyx_v_diff;

      /* "causalml/inference/tree/uplift.pyx":2032
 *             if diff >= maxDiff:
 *                 maxDiff = diff
 *                 suboptTreatment = i_tr             # <<<<<<<<<<<<<<
 *                 if diff > 0:
 *                     bestTreatment = i_tr
 */
      __pyx_v_suboptTreatment = __pyx_v_i_tr;

      /* "causalml/inference/tree/uplift.pyx":2033
 *                 maxDiff = diff
 *                 suboptTreatment = i_tr
 *                 if diff > 0:             # <<<<<<<<<<<<<<
 *                     bestTreatment = i_tr
 *         if maxDiff > 0:
 */
      __pyx_t_2 = ((__pyx_v_diff > 0.0) != 0);
      if (__pyx_t_2) {

        /* "causalml/inference/tree/uplift.pyx":2034
 *                 suboptTreatment = i_tr
 *                 if diff > 0:
 *                     bestTreatment = i_tr             # <<<<<<<<<<<<<<
 *         if maxDiff > 0:
 *             p_t = cur_summary_p[bestTreatment]
 */
        __pyx_v_bestTreatment = __pyx_v_i_tr;

        /* "causalml/inference/tree/uplift.pyx":2033
 *                 maxDiff = diff
 *                 suboptTreatment = i_tr
 *                 if diff > 0:             # <<<<<<<<<<<<<<
 *                     bestTreatment = i_tr
 *         if maxDiff > 0:
 */
      }

      /* "causalml/inference/tree/uplift.pyx":2030
 *                 maxDiffSign = np.sign(diff)
 *                 maxAbsDiff = fabs(diff)
 *             if diff >= maxDiff:             # <<<<<<<<<<<<<<
 *                 maxDiff = diff
 *                 suboptTreatment = i_tr
 */
    }
  }

  /* "causalml/inference/tree/uplift.pyx":2035
 *                 if diff > 0:
 *                     bestTreatment = i_tr
 *         if maxDiff > 0:             # <<<<<<<<<<<<<<
 *             p_t = cur_summary_p[bestTreatment]
 *             n_t = cur_summary_n[bestTreatment]
 */
  __pyx_t_2 = ((__pyx_v_maxDiff > 0.0) != 0);
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":2036
 *                     bestTreatment = i_tr
 *         if maxDiff > 0:
 *             p_t = cur_summary_p[bestTreatment]             # <<<<<<<<<<<<<<
 *             n_t = cur_summary_n[bestTreatment]
 *         else:
 */
    __pyx_t_30 = __pyx_v_bestTreatment;
    __pyx_v_p_t = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_p.diminfo[0].strides));

    /* "causalml/inference/tree/uplift.pyx":2037
 *         if maxDiff > 0:
 *             p_t = cur_summary_p[bestTreatment]
 *             n_t = cur_summary_n[bestTreatment]             # <<<<<<<<<<<<<<
 *         else:
 *             p_t = cur_summary_p[suboptTreatment]
 */
    __pyx_t_30 = __pyx_v_bestTreatment;
    __pyx_v_n_t = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_n.diminfo[0].strides));

    /* "causalml/inference/tree/uplift.pyx":2035
 *                 if diff > 0:
 *                     bestTreatment = i_tr
 *         if maxDiff > 0:             # <<<<<<<<<<<<<<
 *             p_t = cur_summary_p[bestTreatment]
 *             n_t = cur_summary_n[bestTreatment]
 */
    goto __pyx_L16;
  }

  /* "causalml/inference/tree/uplift.pyx":2039
 *             n_t = cur_summary_n[bestTreatment]
 *         else:
 *             p_t = cur_summary_p[suboptTreatment]             # <<<<<<<<<<<<<<
 *             n_t = cur_summary_n[suboptTreatment]
 *         p_value = (1. - stats.norm.cdf(fabs(p_c - p_t) / sqrt(p_t * (1 - p_t) / n_t + p_c * (1 - p_c) / n_c))) * 2
 */
  /*else*/ {
    __pyx_t_30 = __pyx_v_suboptTreatment;
    __pyx_v_p_t = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_p.diminfo[0].strides));

    /* "causalml/inference/tree/uplift.pyx":2040
 *         else:
 *             p_t = cur_summary_p[suboptTreatment]
 *             n_t = cur_summary_n[suboptTreatment]             # <<<<<<<<<<<<<<
 *         p_value = (1. - stats.norm.cdf(fabs(p_c - p_t) / sqrt(p_t * (1 - p_t) / n_t + p_c * (1 - p_c) / n_c))) * 2
 *         upliftScore = [maxDiff, p_value]
 */
    __pyx_t_30 = __pyx_v_suboptTreatment;
    __pyx_v_n_t = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cur_summary_n.diminfo[0].strides));
  }
  __pyx_L16:;

  /* "causalml/inference/tree/uplift.pyx":2041
 *             p_t = cur_summary_p[suboptTreatment]
 *             n_t = cur_summary_n[suboptTreatment]
 *         p_value = (1. - stats.norm.cdf(fabs(p_c - p_t) / sqrt(p_t * (1 - p_t) / n_t + p_c * (1 - p_c) / n_c))) * 2             # <<<<<<<<<<<<<<
 *         upliftScore = [maxDiff, p_value]
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_stats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cdf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble((fabs((__pyx_v_p_c - __pyx_v_p_t)) / sqrt((((__pyx_v_p_t * (1.0 - __pyx_v_p_t)) / ((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)__pyx_v_n_t)) + ((__pyx_v_p_c * (1.0 - __pyx_v_p_c)) / ((__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t)__pyx_v_n_c)))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_, __pyx_t_7, 1., 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_p_value = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":2042
 *             n_t = cur_summary_n[suboptTreatment]
 *         p_value = (1. - stats.norm.cdf(fabs(p_c - p_t) / sqrt(p_t * (1 - p_t) / n_t + p_c * (1 - p_c) / n_c))) * 2
 *         upliftScore = [maxDiff, p_value]             # <<<<<<<<<<<<<<
 * 
 *         bestGain = 0.0
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_maxDiff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_p_value);
  __Pyx_GIVEREF(__pyx_v_p_value);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_p_value);
  __pyx_t_7 = 0;
  __pyx_v_upliftScore = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2044
 *         upliftScore = [maxDiff, p_value]
 * 
 *         bestGain = 0.0             # <<<<<<<<<<<<<<
 *         bestGainImp = 0.0
 *         bestAttribute = None
 */
  __Pyx_INCREF(__pyx_float_0_0);
  __pyx_v_bestGain = __pyx_float_0_0;

  /* "causalml/inference/tree/uplift.pyx":2045
 * 
 *         bestGain = 0.0
 *         bestGainImp = 0.0             # <<<<<<<<<<<<<<
 *         bestAttribute = None
 *         # keep mostly scalar when finding best split, then get the structural value after finding the best split
 */
  __Pyx_INCREF(__pyx_float_0_0);
  __pyx_v_bestGainImp = __pyx_float_0_0;

  /* "causalml/inference/tree/uplift.pyx":2046
 *         bestGain = 0.0
 *         bestGainImp = 0.0
 *         bestAttribute = None             # <<<<<<<<<<<<<<
 *         # keep mostly scalar when finding best split, then get the structural value after finding the best split
 *         best_col = None
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_bestAttribute = ((PyObject*)Py_None);

  /* "causalml/inference/tree/uplift.pyx":2048
 *         bestAttribute = None
 *         # keep mostly scalar when finding best split, then get the structural value after finding the best split
 *         best_col = None             # <<<<<<<<<<<<<<
 *         best_value = None
 *         len_X = len(X)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_best_col = Py_None;

  /* "causalml/inference/tree/uplift.pyx":2049
 *         # keep mostly scalar when finding best split, then get the structural value after finding the best split
 *         best_col = None
 *         best_value = None             # <<<<<<<<<<<<<<
 *         len_X = len(X)
 *         len_X_val = len(X_val) if X_val is not None else 0
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_best_value = Py_None;

  /* "causalml/inference/tree/uplift.pyx":2050
 *         best_col = None
 *         best_value = None
 *         len_X = len(X)             # <<<<<<<<<<<<<<
 *         len_X_val = len(X_val) if X_val is not None else 0
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2050, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_len_X = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2051
 *         best_value = None
 *         len_X = len(X)
 *         len_X_val = len(X_val) if X_val is not None else 0             # <<<<<<<<<<<<<<
 * 
 *         c_num_percentiles = [3, 5, 10, 20, 30, 50, 70, 80, 90, 95, 97]
 */
  __pyx_t_2 = (__pyx_v_X_val != Py_None);
  if ((__pyx_t_2 != 0)) {
    __pyx_t_32 = PyObject_Length(__pyx_v_X_val); if (unlikely(__pyx_t_32 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2051, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_32;
  } else {
    __pyx_t_1 = 0;
  }
  __pyx_v_len_X_val = __pyx_t_1;

  /* "causalml/inference/tree/uplift.pyx":2053
 *         len_X_val = len(X_val) if X_val is not None else 0
 * 
 *         c_num_percentiles = [3, 5, 10, 20, 30, 50, 70, 80, 90, 95, 97]             # <<<<<<<<<<<<<<
 *         c_cat_percentiles = [10, 50, 90]
 * 
 */
  __pyx_t_3 = PyList_New(11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
  __Pyx_INCREF(__pyx_int_5);
  __Pyx_GIVEREF(__pyx_int_5);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_5);
  __Pyx_INCREF(__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_10);
  __Pyx_INCREF(__pyx_int_20);
  __Pyx_GIVEREF(__pyx_int_20);
  PyList_SET_ITEM(__pyx_t_3, 3, __pyx_int_20);
  __Pyx_INCREF(__pyx_int_30);
  __Pyx_GIVEREF(__pyx_int_30);
  PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_30);
  __Pyx_INCREF(__pyx_int_50);
  __Pyx_GIVEREF(__pyx_int_50);
  PyList_SET_ITEM(__pyx_t_3, 5, __pyx_int_50);
  __Pyx_INCREF(__pyx_int_70);
  __Pyx_GIVEREF(__pyx_int_70);
  PyList_SET_ITEM(__pyx_t_3, 6, __pyx_int_70);
  __Pyx_INCREF(__pyx_int_80);
  __Pyx_GIVEREF(__pyx_int_80);
  PyList_SET_ITEM(__pyx_t_3, 7, __pyx_int_80);
  __Pyx_INCREF(__pyx_int_90);
  __Pyx_GIVEREF(__pyx_int_90);
  PyList_SET_ITEM(__pyx_t_3, 8, __pyx_int_90);
  __Pyx_INCREF(__pyx_int_95);
  __Pyx_GIVEREF(__pyx_int_95);
  PyList_SET_ITEM(__pyx_t_3, 9, __pyx_int_95);
  __Pyx_INCREF(__pyx_int_97);
  __Pyx_GIVEREF(__pyx_int_97);
  PyList_SET_ITEM(__pyx_t_3, 10, __pyx_int_97);
  __pyx_v_c_num_percentiles = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2054
 * 
 *         c_num_percentiles = [3, 5, 10, 20, 30, 50, 70, 80, 90, 95, 97]
 *         c_cat_percentiles = [10, 50, 90]             # <<<<<<<<<<<<<<
 * 
 *         # last column is the result/target column, 2nd to the last is the treatment group
 */
  __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_10);
  __Pyx_GIVEREF(__pyx_int_10);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_10);
  __Pyx_INCREF(__pyx_int_50);
  __Pyx_GIVEREF(__pyx_int_50);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_50);
  __Pyx_INCREF(__pyx_int_90);
  __Pyx_GIVEREF(__pyx_int_90);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_90);
  __pyx_v_c_cat_percentiles = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2057
 * 
 *         # last column is the result/target column, 2nd to the last is the treatment group
 *         columnCount = X.shape[1]             # <<<<<<<<<<<<<<
 *         if (self.max_features and self.max_features > 0 and self.max_features <= columnCount):
 *             max_features = self.max_features
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_columnCount = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":2058
 *         # last column is the result/target column, 2nd to the last is the treatment group
 *         columnCount = X.shape[1]
 *         if (self.max_features and self.max_features > 0 and self.max_features <= columnCount):             # <<<<<<<<<<<<<<
 *             max_features = self.max_features
 *         else:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_features); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_21) {
  } else {
    __pyx_t_2 = __pyx_t_21;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_features); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_21) {
  } else {
    __pyx_t_2 = __pyx_t_21;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_features); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_v_columnCount, Py_LE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_2 = __pyx_t_21;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":2059
 *         columnCount = X.shape[1]
 *         if (self.max_features and self.max_features > 0 and self.max_features <= columnCount):
 *             max_features = self.max_features             # <<<<<<<<<<<<<<
 *         else:
 *             max_features = columnCount
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_features); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_max_features = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":2058
 *         # last column is the result/target column, 2nd to the last is the treatment group
 *         columnCount = X.shape[1]
 *         if (self.max_features and self.max_features > 0 and self.max_features <= columnCount):             # <<<<<<<<<<<<<<
 *             max_features = self.max_features
 *         else:
 */
    goto __pyx_L17;
  }

  /* "causalml/inference/tree/uplift.pyx":2061
 *             max_features = self.max_features
 *         else:
 *             max_features = columnCount             # <<<<<<<<<<<<<<
 * 
 *         for col in list(self.random_state_.choice(a=range(columnCount), size=max_features, replace=False)):
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_columnCount);
    __pyx_v_max_features = __pyx_v_columnCount;
  }
  __pyx_L17:;

  /* "causalml/inference/tree/uplift.pyx":2063
 *             max_features = columnCount
 * 
 *         for col in list(self.random_state_.choice(a=range(columnCount), size=max_features, replace=False)):             # <<<<<<<<<<<<<<
 *             columnValues = X[:, col]
 *             # unique values
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_random_state_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_choice); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_columnCount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_a, __pyx_t_4) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_size, __pyx_v_max_features) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_replace, Py_False) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 2063, __pyx_L1_error)
    #else
    __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2063, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":2064
 * 
 *         for col in list(self.random_state_.choice(a=range(columnCount), size=max_features, replace=False)):
 *             columnValues = X[:, col]             # <<<<<<<<<<<<<<
 *             # unique values
 *             lsUnique = np.unique(columnValues)
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_slice__7);
    __Pyx_GIVEREF(__pyx_slice__7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_slice__7);
    __Pyx_INCREF(__pyx_v_col);
    __Pyx_GIVEREF(__pyx_v_col);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_col);
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_columnValues, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2066
 *             columnValues = X[:, col]
 *             # unique values
 *             lsUnique = np.unique(columnValues)             # <<<<<<<<<<<<<<
 * 
 *             if np.issubdtype(lsUnique.dtype, np.number):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_unique); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_columnValues) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_columnValues);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_lsUnique, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2068
 *             lsUnique = np.unique(columnValues)
 * 
 *             if np.issubdtype(lsUnique.dtype, np.number):             # <<<<<<<<<<<<<<
 *                 is_split_by_gt = True
 *                 if len(lsUnique) > 10:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_issubdtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_lsUnique, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_33 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_33)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_33);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_33, __pyx_t_5, ((PyObject *)__pyx_ptype_5numpy_number)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2068, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_33, __pyx_t_5, ((PyObject *)__pyx_ptype_5numpy_number)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2068, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_34 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      if (__pyx_t_33) {
        __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_33); __pyx_t_33 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_34, 0+__pyx_t_6, __pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_ptype_5numpy_number));
      __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5numpy_number));
      PyTuple_SET_ITEM(__pyx_t_34, 1+__pyx_t_6, ((PyObject *)__pyx_ptype_5numpy_number));
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_34, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "causalml/inference/tree/uplift.pyx":2069
 * 
 *             if np.issubdtype(lsUnique.dtype, np.number):
 *                 is_split_by_gt = True             # <<<<<<<<<<<<<<
 *                 if len(lsUnique) > 10:
 *                     lspercentile = np.percentile(columnValues, c_num_percentiles)
 */
      __pyx_v_is_split_by_gt = 1;

      /* "causalml/inference/tree/uplift.pyx":2070
 *             if np.issubdtype(lsUnique.dtype, np.number):
 *                 is_split_by_gt = True
 *                 if len(lsUnique) > 10:             # <<<<<<<<<<<<<<
 *                     lspercentile = np.percentile(columnValues, c_num_percentiles)
 *                 else:
 */
      __pyx_t_32 = PyObject_Length(__pyx_v_lsUnique); if (unlikely(__pyx_t_32 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2070, __pyx_L1_error)
      __pyx_t_2 = ((__pyx_t_32 > 10) != 0);
      if (__pyx_t_2) {

        /* "causalml/inference/tree/uplift.pyx":2071
 *                 is_split_by_gt = True
 *                 if len(lsUnique) > 10:
 *                     lspercentile = np.percentile(columnValues, c_num_percentiles)             # <<<<<<<<<<<<<<
 *                 else:
 *                     lspercentile = np.percentile(lsUnique, c_cat_percentiles)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2071, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_percentile); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2071, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_34))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_34);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_34);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_34, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_34)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_columnValues, __pyx_v_c_num_percentiles};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_34, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2071, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_34)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_columnValues, __pyx_v_c_num_percentiles};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_34, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2071, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2071, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_7) {
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
          }
          __Pyx_INCREF(__pyx_v_columnValues);
          __Pyx_GIVEREF(__pyx_v_columnValues);
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_columnValues);
          __Pyx_INCREF(__pyx_v_c_num_percentiles);
          __Pyx_GIVEREF(__pyx_v_c_num_percentiles);
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_c_num_percentiles);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_34, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2071, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_XDECREF_SET(__pyx_v_lspercentile, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "causalml/inference/tree/uplift.pyx":2070
 *             if np.issubdtype(lsUnique.dtype, np.number):
 *                 is_split_by_gt = True
 *                 if len(lsUnique) > 10:             # <<<<<<<<<<<<<<
 *                     lspercentile = np.percentile(columnValues, c_num_percentiles)
 *                 else:
 */
        goto __pyx_L24;
      }

      /* "causalml/inference/tree/uplift.pyx":2073
 *                     lspercentile = np.percentile(columnValues, c_num_percentiles)
 *                 else:
 *                     lspercentile = np.percentile(lsUnique, c_cat_percentiles)             # <<<<<<<<<<<<<<
 *                 lsUnique = np.unique(lspercentile)
 *             else:
 */
      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_34, __pyx_n_s_np); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2073, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_34, __pyx_n_s_percentile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2073, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __pyx_t_34 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_34)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_34);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_34, __pyx_v_lsUnique, __pyx_v_c_cat_percentiles};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2073, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_34, __pyx_v_lsUnique, __pyx_v_c_cat_percentiles};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2073, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2073, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_34) {
            __Pyx_GIVEREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_34); __pyx_t_34 = NULL;
          }
          __Pyx_INCREF(__pyx_v_lsUnique);
          __Pyx_GIVEREF(__pyx_v_lsUnique);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lsUnique);
          __Pyx_INCREF(__pyx_v_c_cat_percentiles);
          __Pyx_GIVEREF(__pyx_v_c_cat_percentiles);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_c_cat_percentiles);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2073, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_lspercentile, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L24:;

      /* "causalml/inference/tree/uplift.pyx":2074
 *                 else:
 *                     lspercentile = np.percentile(lsUnique, c_cat_percentiles)
 *                 lsUnique = np.unique(lspercentile)             # <<<<<<<<<<<<<<
 *             else:
 *                 # to split by equality check.
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_unique); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_lspercentile) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_lspercentile);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_lsUnique, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":2068
 *             lsUnique = np.unique(columnValues)
 * 
 *             if np.issubdtype(lsUnique.dtype, np.number):             # <<<<<<<<<<<<<<
 *                 is_split_by_gt = True
 *                 if len(lsUnique) > 10:
 */
      goto __pyx_L23;
    }

    /* "causalml/inference/tree/uplift.pyx":2077
 *             else:
 *                 # to split by equality check.
 *                 is_split_by_gt = False             # <<<<<<<<<<<<<<
 * 
 *             for value in lsUnique:
 */
    /*else*/ {
      __pyx_v_is_split_by_gt = 0;
    }
    __pyx_L23:;

    /* "causalml/inference/tree/uplift.pyx":2079
 *                 is_split_by_gt = False
 * 
 *             for value in lsUnique:             # <<<<<<<<<<<<<<
 *                 len_X_l = group_counts_by_divide(columnValues, value, is_split_by_gt, treatment_idx, y, left_count_arr)
 *                 len_X_r = len_X - len_X_l
 */
    if (likely(PyList_CheckExact(__pyx_v_lsUnique)) || PyTuple_CheckExact(__pyx_v_lsUnique)) {
      __pyx_t_3 = __pyx_v_lsUnique; __Pyx_INCREF(__pyx_t_3); __pyx_t_32 = 0;
      __pyx_t_35 = NULL;
    } else {
      __pyx_t_32 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lsUnique); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_35 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 2079, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_35)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_32 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_32); __Pyx_INCREF(__pyx_t_7); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 2079, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2079, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          if (__pyx_t_32 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_32); __Pyx_INCREF(__pyx_t_7); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 2079, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2079, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_35(__pyx_t_3);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2079, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2080
 * 
 *             for value in lsUnique:
 *                 len_X_l = group_counts_by_divide(columnValues, value, is_split_by_gt, treatment_idx, y, left_count_arr)             # <<<<<<<<<<<<<<
 *                 len_X_r = len_X - len_X_l
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_group_counts_by_divide); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_34 = __Pyx_PyBool_FromLong(__pyx_v_is_split_by_gt); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      __pyx_t_33 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_33)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_33);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[7] = {__pyx_t_33, __pyx_v_columnValues, __pyx_v_value, __pyx_t_34, __pyx_v_treatment_idx, __pyx_v_y, ((PyObject *)__pyx_v_left_count_arr)};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[7] = {__pyx_t_33, __pyx_v_columnValues, __pyx_v_value, __pyx_t_34, __pyx_v_treatment_idx, __pyx_v_y, ((PyObject *)__pyx_v_left_count_arr)};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      } else
      #endif
      {
        __pyx_t_36 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        if (__pyx_t_33) {
          __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_33); __pyx_t_33 = NULL;
        }
        __Pyx_INCREF(__pyx_v_columnValues);
        __Pyx_GIVEREF(__pyx_v_columnValues);
        PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, __pyx_v_columnValues);
        __Pyx_INCREF(__pyx_v_value);
        __Pyx_GIVEREF(__pyx_v_value);
        PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, __pyx_v_value);
        __Pyx_GIVEREF(__pyx_t_34);
        PyTuple_SET_ITEM(__pyx_t_36, 2+__pyx_t_6, __pyx_t_34);
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyTuple_SET_ITEM(__pyx_t_36, 3+__pyx_t_6, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_36, 4+__pyx_t_6, __pyx_v_y);
        __Pyx_INCREF(((PyObject *)__pyx_v_left_count_arr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_left_count_arr));
        PyTuple_SET_ITEM(__pyx_t_36, 5+__pyx_t_6, ((PyObject *)__pyx_v_left_count_arr));
        __pyx_t_34 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_36, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_len_X_l, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2081
 *             for value in lsUnique:
 *                 len_X_l = group_counts_by_divide(columnValues, value, is_split_by_gt, treatment_idx, y, left_count_arr)
 *                 len_X_r = len_X - len_X_l             # <<<<<<<<<<<<<<
 * 
 *                 # check the split validity on min_samples_leaf  372
 */
      __pyx_t_7 = PyNumber_Subtract(__pyx_v_len_X, __pyx_v_len_X_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_v_len_X_r, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2084
 * 
 *                 # check the split validity on min_samples_leaf  372
 *                 if (len_X_l < min_samples_leaf or len_X_r < min_samples_leaf):             # <<<<<<<<<<<<<<
 *                     continue
 *                 # summarize notes
 */
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_len_X_l, __pyx_v_min_samples_leaf, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2084, __pyx_L1_error)
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2084, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!__pyx_t_21) {
      } else {
        __pyx_t_2 = __pyx_t_21;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_len_X_r, __pyx_v_min_samples_leaf, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2084, __pyx_L1_error)
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2084, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __pyx_t_21;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_2) {

        /* "causalml/inference/tree/uplift.pyx":2085
 *                 # check the split validity on min_samples_leaf  372
 *                 if (len_X_l < min_samples_leaf or len_X_r < min_samples_leaf):
 *                     continue             # <<<<<<<<<<<<<<
 *                 # summarize notes
 *                 # Gain -- Entropy or Gini
 */
        goto __pyx_L25_continue;

        /* "causalml/inference/tree/uplift.pyx":2084
 * 
 *                 # check the split validity on min_samples_leaf  372
 *                 if (len_X_l < min_samples_leaf or len_X_r < min_samples_leaf):             # <<<<<<<<<<<<<<
 *                     continue
 *                 # summarize notes
 */
      }

      /* "causalml/inference/tree/uplift.pyx":2088
 *                 # summarize notes
 *                 # Gain -- Entropy or Gini
 *                 p = float(len_X_l) / len_X             # <<<<<<<<<<<<<<
 * 
 *                 # right branch group counts can be calculated from left branch counts and total counts
 */
      __pyx_t_7 = __Pyx_PyNumber_Float(__pyx_v_len_X_l); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_len_X); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2091
 * 
 *                 # right branch group counts can be calculated from left branch counts and total counts
 *                 for i in range(2 * n_class):             # <<<<<<<<<<<<<<
 *                     right_count_arr[i] = total_count_arr[i] - left_count_arr[i]
 * 
 */
      __pyx_t_37 = (2 * __pyx_v_n_class);
      __pyx_t_38 = __pyx_t_37;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_38; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "causalml/inference/tree/uplift.pyx":2092
 *                 # right branch group counts can be calculated from left branch counts and total counts
 *                 for i in range(2 * n_class):
 *                     right_count_arr[i] = total_count_arr[i] - left_count_arr[i]             # <<<<<<<<<<<<<<
 * 
 *                 # left and right node summary, into the temporary buffers {left,right}_summary_{p,n}
 */
        __pyx_t_30 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_i;
        __pyx_t_40 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_right_count_arr.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_total_count_arr.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_left_count_arr.diminfo[0].strides)));
      }

      /* "causalml/inference/tree/uplift.pyx":2095
 * 
 *                 # left and right node summary, into the temporary buffers {left,right}_summary_{p,n}
 *                 self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *                     left_count_arr,
 *                     left_summary_p, left_summary_n,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary_from_counts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2095, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "causalml/inference/tree/uplift.pyx":2101
 *                     1,
 *                     min_samples_treatment,
 *                     n_reg             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
      __pyx_t_36 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_36)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_36);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[8] = {__pyx_t_36, ((PyObject *)__pyx_v_left_count_arr), ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1, __pyx_v_min_samples_treatment, __pyx_v_n_reg};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2095, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[8] = {__pyx_t_36, ((PyObject *)__pyx_v_left_count_arr), ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1, __pyx_v_min_samples_treatment, __pyx_v_n_reg};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2095, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_34 = PyTuple_New(7+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2095, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        if (__pyx_t_36) {
          __Pyx_GIVEREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_36); __pyx_t_36 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_left_count_arr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_left_count_arr));
        PyTuple_SET_ITEM(__pyx_t_34, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_count_arr));
        __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
        PyTuple_SET_ITEM(__pyx_t_34, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
        __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
        PyTuple_SET_ITEM(__pyx_t_34, 2+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
        __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
        PyTuple_SET_ITEM(__pyx_t_34, 3+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_34, 4+__pyx_t_6, __pyx_int_1);
        __Pyx_INCREF(__pyx_v_min_samples_treatment);
        __Pyx_GIVEREF(__pyx_v_min_samples_treatment);
        PyTuple_SET_ITEM(__pyx_t_34, 5+__pyx_t_6, __pyx_v_min_samples_treatment);
        __Pyx_INCREF(__pyx_v_n_reg);
        __Pyx_GIVEREF(__pyx_v_n_reg);
        PyTuple_SET_ITEM(__pyx_t_34, 6+__pyx_t_6, __pyx_v_n_reg);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_34, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2095, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2104
 *                     )
 * 
 *                 self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *                     right_count_arr,
 *                     right_summary_p, right_summary_n,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary_from_counts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "causalml/inference/tree/uplift.pyx":2110
 *                     1,
 *                     min_samples_treatment,
 *                     n_reg             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
      __pyx_t_34 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_34)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_34);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[8] = {__pyx_t_34, ((PyObject *)__pyx_v_right_count_arr), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1, __pyx_v_min_samples_treatment, __pyx_v_n_reg};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[8] = {__pyx_t_34, ((PyObject *)__pyx_v_right_count_arr), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1, __pyx_v_min_samples_treatment, __pyx_v_n_reg};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_36 = PyTuple_New(7+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        if (__pyx_t_34) {
          __Pyx_GIVEREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_34); __pyx_t_34 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_right_count_arr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_right_count_arr));
        PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, ((PyObject *)__pyx_v_right_count_arr));
        __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
        PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
        __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
        PyTuple_SET_ITEM(__pyx_t_36, 2+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
        __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
        PyTuple_SET_ITEM(__pyx_t_36, 3+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_36, 4+__pyx_t_6, __pyx_int_1);
        __Pyx_INCREF(__pyx_v_min_samples_treatment);
        __Pyx_GIVEREF(__pyx_v_min_samples_treatment);
        PyTuple_SET_ITEM(__pyx_t_36, 5+__pyx_t_6, __pyx_v_min_samples_treatment);
        __Pyx_INCREF(__pyx_v_n_reg);
        __Pyx_GIVEREF(__pyx_v_n_reg);
        PyTuple_SET_ITEM(__pyx_t_36, 6+__pyx_t_6, __pyx_v_n_reg);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_36, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2113
 *                     )
 * 
 *                 if X_val is not None:             # <<<<<<<<<<<<<<
 *                     len_X_val_l = group_counts_by_divide(X_val[:, col], value, is_split_by_gt, treatment_val_idx, y_val, val_left_count_arr)
 * 
 */
      __pyx_t_2 = (__pyx_v_X_val != Py_None);
      __pyx_t_21 = (__pyx_t_2 != 0);
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2114
 * 
 *                 if X_val is not None:
 *                     len_X_val_l = group_counts_by_divide(X_val[:, col], value, is_split_by_gt, treatment_val_idx, y_val, val_left_count_arr)             # <<<<<<<<<<<<<<
 * 
 *                     # right branch group counts can be calculated from left branch counts and total counts
 */
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_group_counts_by_divide); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_36 = PyTuple_New(2); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_INCREF(__pyx_slice__7);
        __Pyx_GIVEREF(__pyx_slice__7);
        PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_slice__7);
        __Pyx_INCREF(__pyx_v_col);
        __Pyx_GIVEREF(__pyx_v_col);
        PyTuple_SET_ITEM(__pyx_t_36, 1, __pyx_v_col);
        __pyx_t_34 = __Pyx_PyObject_GetItem(__pyx_v_X_val, __pyx_t_36); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __pyx_t_36 = __Pyx_PyBool_FromLong(__pyx_v_is_split_by_gt); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_33 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_33)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_33);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[7] = {__pyx_t_33, __pyx_t_34, __pyx_v_value, __pyx_t_36, __pyx_v_treatment_val_idx, __pyx_v_y_val, ((PyObject *)__pyx_v_val_left_count_arr)};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2114, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[7] = {__pyx_t_33, __pyx_t_34, __pyx_v_value, __pyx_t_36, __pyx_v_treatment_val_idx, __pyx_v_y_val, ((PyObject *)__pyx_v_val_left_count_arr)};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2114, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2114, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          if (__pyx_t_33) {
            __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_33); __pyx_t_33 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_34);
          PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_6, __pyx_t_34);
          __Pyx_INCREF(__pyx_v_value);
          __Pyx_GIVEREF(__pyx_v_value);
          PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_6, __pyx_v_value);
          __Pyx_GIVEREF(__pyx_t_36);
          PyTuple_SET_ITEM(__pyx_t_41, 2+__pyx_t_6, __pyx_t_36);
          __Pyx_INCREF(__pyx_v_treatment_val_idx);
          __Pyx_GIVEREF(__pyx_v_treatment_val_idx);
          PyTuple_SET_ITEM(__pyx_t_41, 3+__pyx_t_6, __pyx_v_treatment_val_idx);
          __Pyx_INCREF(__pyx_v_y_val);
          __Pyx_GIVEREF(__pyx_v_y_val);
          PyTuple_SET_ITEM(__pyx_t_41, 4+__pyx_t_6, __pyx_v_y_val);
          __Pyx_INCREF(((PyObject *)__pyx_v_val_left_count_arr));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_left_count_arr));
          PyTuple_SET_ITEM(__pyx_t_41, 5+__pyx_t_6, ((PyObject *)__pyx_v_val_left_count_arr));
          __pyx_t_34 = 0;
          __pyx_t_36 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_41, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2114, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_len_X_val_l, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2117
 * 
 *                     # right branch group counts can be calculated from left branch counts and total counts
 *                     for i in range(2 * n_class):             # <<<<<<<<<<<<<<
 *                         val_right_count_arr[i] = val_total_count_arr[i] - val_left_count_arr[i]
 * 
 */
        __pyx_t_37 = (2 * __pyx_v_n_class);
        __pyx_t_38 = __pyx_t_37;
        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_38; __pyx_t_6+=1) {
          __pyx_v_i = __pyx_t_6;

          /* "causalml/inference/tree/uplift.pyx":2118
 *                     # right branch group counts can be calculated from left branch counts and total counts
 *                     for i in range(2 * n_class):
 *                         val_right_count_arr[i] = val_total_count_arr[i] - val_left_count_arr[i]             # <<<<<<<<<<<<<<
 * 
 *                     self.tree_node_summary_from_counts(
 */
          __pyx_t_39 = __pyx_v_i;
          __pyx_t_30 = __pyx_v_i;
          __pyx_t_40 = __pyx_v_i;
          *__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_val_right_count_arr.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_val_total_count_arr.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t *, __pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_val_left_count_arr.diminfo[0].strides)));
        }

        /* "causalml/inference/tree/uplift.pyx":2120
 *                         val_right_count_arr[i] = val_total_count_arr[i] - val_left_count_arr[i]
 * 
 *                     self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *                         val_left_count_arr,
 *                         val_left_summary_p, val_left_summary_n,
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary_from_counts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "causalml/inference/tree/uplift.pyx":2123
 *                         val_left_count_arr,
 *                         val_left_summary_p, val_left_summary_n,
 *                         cur_summary_p, # parentNodeSummary_p             # <<<<<<<<<<<<<<
 *                         1 # has_parent_summary
 *                     )
 */
        __pyx_t_41 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_41)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_41);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[6] = {__pyx_t_41, ((PyObject *)__pyx_v_val_left_count_arr), ((PyObject *)__pyx_v_val_left_summary_p), ((PyObject *)__pyx_v_val_left_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2120, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[6] = {__pyx_t_41, ((PyObject *)__pyx_v_val_left_count_arr), ((PyObject *)__pyx_v_val_left_summary_p), ((PyObject *)__pyx_v_val_left_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2120, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_36 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2120, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          if (__pyx_t_41) {
            __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_41); __pyx_t_41 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_val_left_count_arr));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_left_count_arr));
          PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, ((PyObject *)__pyx_v_val_left_count_arr));
          __Pyx_INCREF(((PyObject *)__pyx_v_val_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, ((PyObject *)__pyx_v_val_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_val_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 2+__pyx_t_6, ((PyObject *)__pyx_v_val_left_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
          PyTuple_SET_ITEM(__pyx_t_36, 3+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_GIVEREF(__pyx_int_1);
          PyTuple_SET_ITEM(__pyx_t_36, 4+__pyx_t_6, __pyx_int_1);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_36, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2120, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2127
 *                     )
 * 
 *                     self.tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *                         val_right_count_arr,
 *                         val_right_summary_p, val_right_summary_n,
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tree_node_summary_from_counts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2127, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "causalml/inference/tree/uplift.pyx":2130
 *                         val_right_count_arr,
 *                         val_right_summary_p, val_right_summary_n,
 *                         cur_summary_p, # parentNodeSummary_p             # <<<<<<<<<<<<<<
 *                         1 # has_parent_summary
 *                     )
 */
        __pyx_t_36 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_36)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_36);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[6] = {__pyx_t_36, ((PyObject *)__pyx_v_val_right_count_arr), ((PyObject *)__pyx_v_val_right_summary_p), ((PyObject *)__pyx_v_val_right_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2127, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[6] = {__pyx_t_36, ((PyObject *)__pyx_v_val_right_count_arr), ((PyObject *)__pyx_v_val_right_summary_p), ((PyObject *)__pyx_v_val_right_summary_n), ((PyObject *)__pyx_v_cur_summary_p), __pyx_int_1};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2127, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2127, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          if (__pyx_t_36) {
            __Pyx_GIVEREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_36); __pyx_t_36 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_val_right_count_arr));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_right_count_arr));
          PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_6, ((PyObject *)__pyx_v_val_right_count_arr));
          __Pyx_INCREF(((PyObject *)__pyx_v_val_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_6, ((PyObject *)__pyx_v_val_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_val_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_val_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_41, 2+__pyx_t_6, ((PyObject *)__pyx_v_val_right_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
          PyTuple_SET_ITEM(__pyx_t_41, 3+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_GIVEREF(__pyx_int_1);
          PyTuple_SET_ITEM(__pyx_t_41, 4+__pyx_t_6, __pyx_int_1);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_41, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2127, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2134
 *                     )
 * 
 *                     early_stopping_flag = False             # <<<<<<<<<<<<<<
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >
 */
        __pyx_v_early_stopping_flag = 0;

        /* "causalml/inference/tree/uplift.pyx":2135
 * 
 *                     early_stopping_flag = False
 *                     for k in range(n_class):             # <<<<<<<<<<<<<<
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 */
        __pyx_t_6 = __pyx_v_n_class;
        __pyx_t_28 = __pyx_t_6;
        for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
          __pyx_v_k = __pyx_t_29;

          /* "causalml/inference/tree/uplift.pyx":2136
 *                     early_stopping_flag = False
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 */
          __pyx_t_30 = __pyx_v_k;
          __pyx_t_39 = __pyx_v_k;
          __pyx_t_5 = PyFloat_FromDouble(fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_val_left_summary_p.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_left_summary_p.diminfo[0].strides))))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);

          /* "causalml/inference/tree/uplift.pyx":2137
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or             # <<<<<<<<<<<<<<
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):
 */
          __pyx_t_39 = __pyx_v_k;
          __pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_left_summary_p.diminfo[0].strides));
          __pyx_t_39 = __pyx_v_k;
          __pyx_t_43 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_val_left_summary_p.diminfo[0].strides));
          if (((__pyx_t_42 < __pyx_t_43) != 0)) {
            __pyx_t_44 = __pyx_t_42;
          } else {
            __pyx_t_44 = __pyx_t_43;
          }
          __pyx_t_7 = PyFloat_FromDouble(__pyx_t_44); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_41 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_41, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;

          /* "causalml/inference/tree/uplift.pyx":2136
 *                     early_stopping_flag = False
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 */
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!__pyx_t_2) {
          } else {
            __pyx_t_21 = __pyx_t_2;
            goto __pyx_L38_bool_binop_done;
          }

          /* "causalml/inference/tree/uplift.pyx":2138
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):
 *                             early_stopping_flag = True
 */
          __pyx_t_39 = __pyx_v_k;
          __pyx_t_30 = __pyx_v_k;
          __pyx_t_7 = PyFloat_FromDouble(fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_val_right_summary_p.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right_summary_p.diminfo[0].strides))))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2138, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);

          /* "causalml/inference/tree/uplift.pyx":2139
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):             # <<<<<<<<<<<<<<
 *                             early_stopping_flag = True
 *                             break
 */
          __pyx_t_30 = __pyx_v_k;
          __pyx_t_44 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right_summary_p.diminfo[0].strides));
          __pyx_t_30 = __pyx_v_k;
          __pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_8causalml_9inference_4tree_6uplift_P_TYPE_t *, __pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_val_right_summary_p.diminfo[0].strides));
          if (((__pyx_t_44 < __pyx_t_42) != 0)) {
            __pyx_t_43 = __pyx_t_44;
          } else {
            __pyx_t_43 = __pyx_t_42;
          }
          __pyx_t_41 = PyFloat_FromDouble(__pyx_t_43); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_41, __pyx_v_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __pyx_t_41 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_41); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2138, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "causalml/inference/tree/uplift.pyx":2138
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):
 *                             early_stopping_flag = True
 */
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_41); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2138, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __pyx_t_21 = __pyx_t_2;
          __pyx_L38_bool_binop_done:;

          /* "causalml/inference/tree/uplift.pyx":2136
 *                     early_stopping_flag = False
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 */
          if (__pyx_t_21) {

            /* "causalml/inference/tree/uplift.pyx":2140
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):
 *                             early_stopping_flag = True             # <<<<<<<<<<<<<<
 *                             break
 * 
 */
            __pyx_v_early_stopping_flag = 1;

            /* "causalml/inference/tree/uplift.pyx":2141
 *                                 min(val_right_summary_p[k], right_summary_p[k])/early_stopping_eval_diff_scale):
 *                             early_stopping_flag = True
 *                             break             # <<<<<<<<<<<<<<
 * 
 *                     if early_stopping_flag:
 */
            goto __pyx_L36_break;

            /* "causalml/inference/tree/uplift.pyx":2136
 *                     early_stopping_flag = False
 *                     for k in range(n_class):
 *                         if (abs(val_left_summary_p[k] - left_summary_p[k]) >             # <<<<<<<<<<<<<<
 *                                 min(val_left_summary_p[k], left_summary_p[k])/early_stopping_eval_diff_scale or
 *                             abs(val_right_summary_p[k] - right_summary_p[k]) >
 */
          }
        }
        __pyx_L36_break:;

        /* "causalml/inference/tree/uplift.pyx":2143
 *                             break
 * 
 *                     if early_stopping_flag:             # <<<<<<<<<<<<<<
 *                         continue
 * 
 */
        __pyx_t_21 = (__pyx_v_early_stopping_flag != 0);
        if (__pyx_t_21) {

          /* "causalml/inference/tree/uplift.pyx":2144
 * 
 *                     if early_stopping_flag:
 *                         continue             # <<<<<<<<<<<<<<
 * 
 *                 # check the split validity on min_samples_treatment
 */
          goto __pyx_L25_continue;

          /* "causalml/inference/tree/uplift.pyx":2143
 *                             break
 * 
 *                     if early_stopping_flag:             # <<<<<<<<<<<<<<
 *                         continue
 * 
 */
        }

        /* "causalml/inference/tree/uplift.pyx":2113
 *                     )
 * 
 *                 if X_val is not None:             # <<<<<<<<<<<<<<
 *                     len_X_val_l = group_counts_by_divide(X_val[:, col], value, is_split_by_gt, treatment_val_idx, y_val, val_left_count_arr)
 * 
 */
      }

      /* "causalml/inference/tree/uplift.pyx":2147
 * 
 *                 # check the split validity on min_samples_treatment
 *                 node_mst = min(np.min(left_summary_n), np.min(right_summary_n))             # <<<<<<<<<<<<<<
 *                 if node_mst < min_samples_treatment:
 *                     continue
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_41 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, ((PyObject *)__pyx_v_right_summary_n)) : __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_v_right_summary_n));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_36);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_36))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_36);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_36, function);
        }
      }
      __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_36, __pyx_t_5, ((PyObject *)__pyx_v_left_summary_n)) : __Pyx_PyObject_CallOneArg(__pyx_t_36, ((PyObject *)__pyx_v_left_summary_n));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_41, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2147, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_21) {
        __Pyx_INCREF(__pyx_t_41);
        __pyx_t_36 = __pyx_t_41;
      } else {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_36 = __pyx_t_7;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __pyx_t_41 = __pyx_t_36;
      __Pyx_INCREF(__pyx_t_41);
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      __Pyx_XDECREF_SET(__pyx_v_node_mst, __pyx_t_41);
      __pyx_t_41 = 0;

      /* "causalml/inference/tree/uplift.pyx":2148
 *                 # check the split validity on min_samples_treatment
 *                 node_mst = min(np.min(left_summary_n), np.min(right_summary_n))
 *                 if node_mst < min_samples_treatment:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_41 = PyObject_RichCompare(__pyx_v_node_mst, __pyx_v_min_samples_treatment, Py_LT); __Pyx_XGOTREF(__pyx_t_41); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_41); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2149
 *                 node_mst = min(np.min(left_summary_n), np.min(right_summary_n))
 *                 if node_mst < min_samples_treatment:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 # evaluate the split
 */
        goto __pyx_L25_continue;

        /* "causalml/inference/tree/uplift.pyx":2148
 *                 # check the split validity on min_samples_treatment
 *                 node_mst = min(np.min(left_summary_n), np.min(right_summary_n))
 *                 if node_mst < min_samples_treatment:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "causalml/inference/tree/uplift.pyx":2152
 * 
 *                 # evaluate the split
 *                 if self.arr_eval_func == self.arr_evaluate_CTS:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_CTS); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_36);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_41, __pyx_t_36, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2152, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2153
 *                 # evaluate the split
 *                 if self.arr_eval_func == self.arr_evaluate_CTS:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)             # <<<<<<<<<<<<<<
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)
 */
        __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_41 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_36))) {
          __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_36);
          if (likely(__pyx_t_41)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36);
            __Pyx_INCREF(__pyx_t_41);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_36, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_41, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2153, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_41, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2153, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2153, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_41) {
            __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_41); __pyx_t_41 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2153, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_leftScore1, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "causalml/inference/tree/uplift.pyx":2154
 *                 if self.arr_eval_func == self.arr_evaluate_CTS:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)
 */
        __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_36))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_36);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_36, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2154, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2154, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_7);
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2154, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_t_41, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2154, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_rightScore2, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "causalml/inference/tree/uplift.pyx":2155
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:
 */
        __pyx_t_7 = PyNumber_Multiply(__pyx_v_p, __pyx_v_leftScore1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_36 = PyNumber_Subtract(__pyx_v_currentScore, __pyx_t_7); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_p, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_41 = PyNumber_Multiply(__pyx_t_7, __pyx_v_rightScore2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Subtract(__pyx_t_36, __pyx_t_41); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "causalml/inference/tree/uplift.pyx":2156
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)             # <<<<<<<<<<<<<<
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 */
        __pyx_t_7 = PyNumber_Multiply(__pyx_v_len_X, __pyx_v_currentScore); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_41 = PyNumber_Multiply(__pyx_v_len_X_l, __pyx_v_leftScore1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_36 = PyNumber_Subtract(__pyx_t_7, __pyx_t_41); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyNumber_Multiply(__pyx_v_len_X_r, __pyx_v_rightScore2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_7 = PyNumber_Subtract(__pyx_t_36, __pyx_t_41); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "causalml/inference/tree/uplift.pyx":2152
 * 
 *                 # evaluate the split
 *                 if self.arr_eval_func == self.arr_evaluate_CTS:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
        goto __pyx_L42;
      }

      /* "causalml/inference/tree/uplift.pyx":2157
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_DDP); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __pyx_t_36 = PyObject_RichCompare(__pyx_t_7, __pyx_t_41, Py_EQ); __Pyx_XGOTREF(__pyx_t_36); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2157, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_36); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2157, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2158
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)             # <<<<<<<<<<<<<<
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2)
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2158, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_7 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_36 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_36 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_7) {
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_5, NULL); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_leftScore1, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2159
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain = np.abs(leftScore1 - rightScore2)
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_36 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_36 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_7, NULL); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2159, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_rightScore2, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2160
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_abs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyNumber_Subtract(__pyx_v_leftScore1, __pyx_v_rightScore2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_36 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_41) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_41);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2161
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2)
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)             # <<<<<<<<<<<<<<
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_abs); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Multiply(__pyx_v_len_X_l, __pyx_v_leftScore1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyNumber_Multiply(__pyx_v_len_X_r, __pyx_v_rightScore2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_34 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
          }
        }
        __pyx_t_36 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_41, __pyx_t_5, __pyx_t_34) : __Pyx_PyObject_CallOneArg(__pyx_t_41, __pyx_t_34);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2157
 *                     gain = (currentScore - p * leftScore1 - (1 - p) * rightScore2)
 *                     gain_for_imp = (len_X * currentScore - len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_DDP:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
        goto __pyx_L42;
      }

      /* "causalml/inference/tree/uplift.pyx":2162
 *                     gain = np.abs(leftScore1 - rightScore2)
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:             # <<<<<<<<<<<<<<
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 */
      __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_36);
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_IT); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __pyx_t_34 = PyObject_RichCompare(__pyx_t_36, __pyx_t_41, Py_EQ); __Pyx_XGOTREF(__pyx_t_34); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2162, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_34); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2162, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2163
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_CIT:
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_36 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_36)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_36);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[5] = {__pyx_t_36, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_34 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2163, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[5] = {__pyx_t_36, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_34 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2163, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2163, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_36) {
            __Pyx_GIVEREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_36); __pyx_t_36 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_5, NULL); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2163, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2164
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X             # <<<<<<<<<<<<<<
 *                 elif self.arr_eval_func == self.arr_evaluate_CIT:
 *                     gain = self.arr_eval_func(cur_summary_p, cur_summary_n,
 */
        __pyx_t_34 = PyNumber_Multiply(__pyx_v_gain, __pyx_v_len_X); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2164, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2162
 *                     gain = np.abs(leftScore1 - rightScore2)
 *                     gain_for_imp = np.abs(len_X_l * leftScore1 - len_X_r * rightScore2)
 *                 elif self.arr_eval_func == self.arr_evaluate_IT:             # <<<<<<<<<<<<<<
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 */
        goto __pyx_L42;
      }

      /* "causalml/inference/tree/uplift.pyx":2165
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_CIT:             # <<<<<<<<<<<<<<
 *                     gain = self.arr_eval_func(cur_summary_p, cur_summary_n,
 *                                               left_summary_p, left_summary_n,
 */
      __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_CIT); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_34, __pyx_t_41, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2166
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_CIT:
 *                     gain = self.arr_eval_func(cur_summary_p, cur_summary_n,             # <<<<<<<<<<<<<<
 *                                               left_summary_p, left_summary_n,
 *                                               right_summary_p, right_summary_n)
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2166, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);

        /* "causalml/inference/tree/uplift.pyx":2168
 *                     gain = self.arr_eval_func(cur_summary_p, cur_summary_n,
 *                                               left_summary_p, left_summary_n,
 *                                               right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:
 */
        __pyx_t_34 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_34)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_34);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[7] = {__pyx_t_34, ((PyObject *)__pyx_v_cur_summary_p), ((PyObject *)__pyx_v_cur_summary_n), ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2166, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[7] = {__pyx_t_34, ((PyObject *)__pyx_v_cur_summary_p), ((PyObject *)__pyx_v_cur_summary_n), ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n), ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2166, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_36 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2166, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          if (__pyx_t_34) {
            __Pyx_GIVEREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_34); __pyx_t_34 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_p));
          PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, ((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_36, 2+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 3+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_36, 4+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 5+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_36, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2166, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2169
 *                                               left_summary_p, left_summary_n,
 *                                               right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X             # <<<<<<<<<<<<<<
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 */
        __pyx_t_5 = PyNumber_Multiply(__pyx_v_gain, __pyx_v_len_X); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2165
 *                     gain = self.arr_eval_func(left_summary_p, left_summary_n, right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_CIT:             # <<<<<<<<<<<<<<
 *                     gain = self.arr_eval_func(cur_summary_p, cur_summary_n,
 *                                               left_summary_p, left_summary_n,
 */
        goto __pyx_L42;
      }

      /* "causalml/inference/tree/uplift.pyx":2170
 *                                               right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_evaluate_IDDP); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __pyx_t_36 = PyObject_RichCompare(__pyx_t_5, __pyx_t_41, Py_EQ); __Pyx_XGOTREF(__pyx_t_36); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2170, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_36); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2170, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2171
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)             # <<<<<<<<<<<<<<
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_36 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_36 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        {
          __pyx_t_34 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_34, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_34, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_34, NULL); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_leftScore1, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2172
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * np.abs(currentScore))
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2172, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_34 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_34)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_34);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_34, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_36 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[3] = {__pyx_t_34, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_36 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_GOTREF(__pyx_t_36);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_34) {
            __Pyx_GIVEREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_34); __pyx_t_34 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_5, NULL); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_rightScore2, __pyx_t_36);
        __pyx_t_36 = 0;

        /* "causalml/inference/tree/uplift.pyx":2173
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * np.abs(currentScore))
 *                     if self.normalization:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_abs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyNumber_Subtract(__pyx_v_leftScore1, __pyx_v_rightScore2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_34 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_34)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_34);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_36 = (__pyx_t_34) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_34, __pyx_t_41) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_41);
        __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_abs); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_34))) {
          __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_34);
          if (likely(__pyx_t_41)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_34);
            __Pyx_INCREF(__pyx_t_41);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_34, function);
          }
        }
        __pyx_t_5 = (__pyx_t_41) ? __Pyx_PyObject_Call2Args(__pyx_t_34, __pyx_t_41, __pyx_v_currentScore) : __Pyx_PyObject_CallOneArg(__pyx_t_34, __pyx_v_currentScore);
        __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __pyx_t_34 = PyNumber_Subtract(__pyx_t_36, __pyx_t_5); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2174
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * np.abs(currentScore))             # <<<<<<<<<<<<<<
 *                     if self.normalization:
 *                         # Normalize used divergence
 */
        __pyx_t_34 = PyNumber_Multiply(__pyx_v_len_X_l, __pyx_v_leftScore1); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __pyx_t_5 = PyNumber_Multiply(__pyx_v_len_X_r, __pyx_v_rightScore2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_36 = PyNumber_Add(__pyx_t_34, __pyx_t_5); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_34, __pyx_n_s_np); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_34, __pyx_n_s_abs); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __pyx_t_34 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_34)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_34);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
          }
        }
        __pyx_t_5 = (__pyx_t_34) ? __Pyx_PyObject_Call2Args(__pyx_t_41, __pyx_t_34, __pyx_v_currentScore) : __Pyx_PyObject_CallOneArg(__pyx_t_41, __pyx_v_currentScore);
        __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyNumber_Multiply(__pyx_v_len_X, __pyx_t_5); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Subtract(__pyx_t_36, __pyx_t_41); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2175
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * np.abs(currentScore))
 *                     if self.normalization:             # <<<<<<<<<<<<<<
 *                         # Normalize used divergence
 *                         currentDivergence = 2 * (gain + 1) / 3
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normalization); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2175, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2175, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_21) {

          /* "causalml/inference/tree/uplift.pyx":2177
 *                     if self.normalization:
 *                         # Normalize used divergence
 *                         currentDivergence = 2 * (gain + 1) / 3             # <<<<<<<<<<<<<<
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9, currentDivergence=currentDivergence)
 *                     else:
 */
          __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_gain, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2177, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_41 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2177, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_41, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2177, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_XDECREF_SET(__pyx_v_currentDivergence, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "causalml/inference/tree/uplift.pyx":2178
 *                         # Normalize used divergence
 *                         currentDivergence = 2 * (gain + 1) / 3
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9, currentDivergence=currentDivergence)             # <<<<<<<<<<<<<<
 *                     else:
 *                         norm_factor = 1
 */
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_normI); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_41 = PyTuple_New(2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_n));
          PyTuple_SET_ITEM(__pyx_t_41, 0, ((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_41, 1, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_36 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          if (PyDict_SetItem(__pyx_t_36, __pyx_n_s_alpha, __pyx_float_0_9) < 0) __PYX_ERR(0, 2178, __pyx_L1_error)
          if (PyDict_SetItem(__pyx_t_36, __pyx_n_s_currentDivergence, __pyx_v_currentDivergence) < 0) __PYX_ERR(0, 2178, __pyx_L1_error)
          __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_41, __pyx_t_36); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_XDECREF_SET(__pyx_v_norm_factor, __pyx_t_34);
          __pyx_t_34 = 0;

          /* "causalml/inference/tree/uplift.pyx":2175
 *                     gain = np.abs(leftScore1 - rightScore2) - np.abs(currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * np.abs(currentScore))
 *                     if self.normalization:             # <<<<<<<<<<<<<<
 *                         # Normalize used divergence
 *                         currentDivergence = 2 * (gain + 1) / 3
 */
          goto __pyx_L43;
        }

        /* "causalml/inference/tree/uplift.pyx":2180
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9, currentDivergence=currentDivergence)
 *                     else:
 *                         norm_factor = 1             # <<<<<<<<<<<<<<
 *                     gain = gain / norm_factor
 *                 else:
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_XDECREF_SET(__pyx_v_norm_factor, __pyx_int_1);
        }
        __pyx_L43:;

        /* "causalml/inference/tree/uplift.pyx":2181
 *                     else:
 *                         norm_factor = 1
 *                     gain = gain / norm_factor             # <<<<<<<<<<<<<<
 *                 else:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 */
        __pyx_t_34 = __Pyx_PyNumber_Divide(__pyx_v_gain, __pyx_v_norm_factor); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2181, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF_SET(__pyx_v_gain, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2170
 *                                               right_summary_p, right_summary_n)
 *                     gain_for_imp = gain * len_X
 *                 elif self.arr_eval_func == self.arr_evaluate_IDDP:             # <<<<<<<<<<<<<<
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 */
        goto __pyx_L42;
      }

      /* "causalml/inference/tree/uplift.pyx":2183
 *                     gain = gain / norm_factor
 *                 else:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)             # <<<<<<<<<<<<<<
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)
 */
      /*else*/ {
        __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2183, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_41 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_36))) {
          __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_36);
          if (likely(__pyx_t_41)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36);
            __Pyx_INCREF(__pyx_t_41);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_36, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_41, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_34 = __Pyx_PyFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2183, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_41, ((PyObject *)__pyx_v_left_summary_p), ((PyObject *)__pyx_v_left_summary_n)};
          __pyx_t_34 = __Pyx_PyCFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2183, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_41) {
            __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_41); __pyx_t_41 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_t_5, NULL); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_leftScore1, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2184
 *                 else:
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)             # <<<<<<<<<<<<<<
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)
 */
        __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_eval_func); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2184, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_36))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_36);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_36, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_34 = __Pyx_PyFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2184, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_36)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_right_summary_p), ((PyObject *)__pyx_v_right_summary_n)};
          __pyx_t_34 = __Pyx_PyCFunction_FastCall(__pyx_t_36, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2184, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_34);
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2184, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_p));
          PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_p));
          __Pyx_INCREF(((PyObject *)__pyx_v_right_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_right_summary_n));
          PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_6, ((PyObject *)__pyx_v_right_summary_n));
          __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_t_41, NULL); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2184, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_rightScore2, __pyx_t_34);
        __pyx_t_34 = 0;

        /* "causalml/inference/tree/uplift.pyx":2185
 *                     leftScore1 = self.arr_eval_func(left_summary_p, left_summary_n)
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)             # <<<<<<<<<<<<<<
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)
 *                     if self.normalization:
 */
        __pyx_t_34 = PyNumber_Multiply(__pyx_v_p, __pyx_v_leftScore1); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __pyx_t_36 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_p, 1, 0, 0); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_41 = PyNumber_Multiply(__pyx_t_36, __pyx_v_rightScore2); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __pyx_t_36 = PyNumber_Add(__pyx_t_34, __pyx_t_41); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyNumber_Subtract(__pyx_t_36, __pyx_v_currentScore); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain, __pyx_t_41);
        __pyx_t_41 = 0;

        /* "causalml/inference/tree/uplift.pyx":2186
 *                     rightScore2 = self.arr_eval_func(right_summary_p, right_summary_n)
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)             # <<<<<<<<<<<<<<
 *                     if self.normalization:
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9)
 */
        __pyx_t_41 = PyNumber_Multiply(__pyx_v_len_X_l, __pyx_v_leftScore1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_36 = PyNumber_Multiply(__pyx_v_len_X_r, __pyx_v_rightScore2); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_34 = PyNumber_Add(__pyx_t_41, __pyx_t_36); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_34);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __pyx_t_36 = PyNumber_Multiply(__pyx_v_len_X, __pyx_v_currentScore); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        __pyx_t_41 = PyNumber_Subtract(__pyx_t_34, __pyx_t_36); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gain_for_imp, __pyx_t_41);
        __pyx_t_41 = 0;

        /* "causalml/inference/tree/uplift.pyx":2187
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)
 *                     if self.normalization:             # <<<<<<<<<<<<<<
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9)
 *                     else:
 */
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normalization); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2187, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_41); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2187, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        if (__pyx_t_21) {

          /* "causalml/inference/tree/uplift.pyx":2188
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)
 *                     if self.normalization:
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9)             # <<<<<<<<<<<<<<
 *                     else:
 *                         norm_factor = 1
 */
          __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_arr_normI); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2188, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __pyx_t_36 = PyTuple_New(2); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2188, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_36);
          __Pyx_INCREF(((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_cur_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 0, ((PyObject *)__pyx_v_cur_summary_n));
          __Pyx_INCREF(((PyObject *)__pyx_v_left_summary_n));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_left_summary_n));
          PyTuple_SET_ITEM(__pyx_t_36, 1, ((PyObject *)__pyx_v_left_summary_n));
          __pyx_t_34 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2188, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_34);
          if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_alpha, __pyx_float_0_9) < 0) __PYX_ERR(0, 2188, __pyx_L1_error)
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_36, __pyx_t_34); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2188, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
          __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
          __Pyx_XDECREF_SET(__pyx_v_norm_factor, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "causalml/inference/tree/uplift.pyx":2187
 *                     gain = (p * leftScore1 + (1 - p) * rightScore2 - currentScore)
 *                     gain_for_imp = (len_X_l * leftScore1 + len_X_r * rightScore2 - len_X * currentScore)
 *                     if self.normalization:             # <<<<<<<<<<<<<<
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9)
 *                     else:
 */
          goto __pyx_L44;
        }

        /* "causalml/inference/tree/uplift.pyx":2190
 *                         norm_factor = self.arr_normI(cur_summary_n, left_summary_n, alpha=0.9)
 *                     else:
 *                         norm_factor = 1             # <<<<<<<<<<<<<<
 *                     gain = gain / norm_factor
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_XDECREF_SET(__pyx_v_norm_factor, __pyx_int_1);
        }
        __pyx_L44:;

        /* "causalml/inference/tree/uplift.pyx":2191
 *                     else:
 *                         norm_factor = 1
 *                     gain = gain / norm_factor             # <<<<<<<<<<<<<<
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):
 *                     bestGain = gain
 */
        __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_gain, __pyx_v_norm_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2191, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_gain, __pyx_t_5);
        __pyx_t_5 = 0;
      }
      __pyx_L42:;

      /* "causalml/inference/tree/uplift.pyx":2192
 *                         norm_factor = 1
 *                     gain = gain / norm_factor
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):             # <<<<<<<<<<<<<<
 *                     bestGain = gain
 *                     bestGainImp = gain_for_imp
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_gain, __pyx_v_bestGain, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {
      } else {
        __pyx_t_21 = __pyx_t_2;
        goto __pyx_L46_bool_binop_done;
      }
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_len_X_l, __pyx_v_min_samples_leaf, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {
      } else {
        __pyx_t_21 = __pyx_t_2;
        goto __pyx_L46_bool_binop_done;
      }
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_len_X_r, __pyx_v_min_samples_leaf, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_21 = __pyx_t_2;
      __pyx_L46_bool_binop_done:;
      if (__pyx_t_21) {

        /* "causalml/inference/tree/uplift.pyx":2193
 *                     gain = gain / norm_factor
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):
 *                     bestGain = gain             # <<<<<<<<<<<<<<
 *                     bestGainImp = gain_for_imp
 *                     best_col = col
 */
        __Pyx_INCREF(__pyx_v_gain);
        __Pyx_DECREF_SET(__pyx_v_bestGain, __pyx_v_gain);

        /* "causalml/inference/tree/uplift.pyx":2194
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):
 *                     bestGain = gain
 *                     bestGainImp = gain_for_imp             # <<<<<<<<<<<<<<
 *                     best_col = col
 *                     best_value = value
 */
        __Pyx_INCREF(__pyx_v_gain_for_imp);
        __Pyx_DECREF_SET(__pyx_v_bestGainImp, __pyx_v_gain_for_imp);

        /* "causalml/inference/tree/uplift.pyx":2195
 *                     bestGain = gain
 *                     bestGainImp = gain_for_imp
 *                     best_col = col             # <<<<<<<<<<<<<<
 *                     best_value = value
 * 
 */
        __Pyx_INCREF(__pyx_v_col);
        __Pyx_DECREF_SET(__pyx_v_best_col, __pyx_v_col);

        /* "causalml/inference/tree/uplift.pyx":2196
 *                     bestGainImp = gain_for_imp
 *                     best_col = col
 *                     best_value = value             # <<<<<<<<<<<<<<
 * 
 *         # after finding the best split col and value
 */
        __Pyx_INCREF(__pyx_v_value);
        __Pyx_DECREF_SET(__pyx_v_best_value, __pyx_v_value);

        /* "causalml/inference/tree/uplift.pyx":2192
 *                         norm_factor = 1
 *                     gain = gain / norm_factor
 *                 if (gain > bestGain and len_X_l > min_samples_leaf and len_X_r > min_samples_leaf):             # <<<<<<<<<<<<<<
 *                     bestGain = gain
 *                     bestGainImp = gain_for_imp
 */
      }

      /* "causalml/inference/tree/uplift.pyx":2079
 *                 is_split_by_gt = False
 * 
 *             for value in lsUnique:             # <<<<<<<<<<<<<<
 *                 len_X_l = group_counts_by_divide(columnValues, value, is_split_by_gt, treatment_idx, y, left_count_arr)
 *                 len_X_r = len_X - len_X_l
 */
      __pyx_L25_continue:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2063
 *             max_features = columnCount
 * 
 *         for col in list(self.random_state_.choice(a=range(columnCount), size=max_features, replace=False)):             # <<<<<<<<<<<<<<
 *             columnValues = X[:, col]
 *             # unique values
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2199
 * 
 *         # after finding the best split col and value
 *         if best_col is not None:             # <<<<<<<<<<<<<<
 *             bestAttribute = (best_col, best_value)
 *             # re-calculate the divideSet
 */
  __pyx_t_21 = (__pyx_v_best_col != Py_None);
  __pyx_t_2 = (__pyx_t_21 != 0);
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":2200
 *         # after finding the best split col and value
 *         if best_col is not None:
 *             bestAttribute = (best_col, best_value)             # <<<<<<<<<<<<<<
 *             # re-calculate the divideSet
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, best_col, best_value)
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_best_col);
    __Pyx_GIVEREF(__pyx_v_best_col);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_best_col);
    __Pyx_INCREF(__pyx_v_best_value);
    __Pyx_GIVEREF(__pyx_v_best_value);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_best_value);
    __Pyx_DECREF_SET(__pyx_v_bestAttribute, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2202
 *             bestAttribute = (best_col, best_value)
 *             # re-calculate the divideSet
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, best_col, best_value)             # <<<<<<<<<<<<<<
 *             if X_val is not None:
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_divideSet); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_best_col, __pyx_v_best_value};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2202, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_X, __pyx_v_treatment_idx, __pyx_v_y, __pyx_v_best_col, __pyx_v_best_value};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2202, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_34 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_34, 0+__pyx_t_6, __pyx_v_X);
      __Pyx_INCREF(__pyx_v_treatment_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_idx);
      PyTuple_SET_ITEM(__pyx_t_34, 1+__pyx_t_6, __pyx_v_treatment_idx);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_34, 2+__pyx_t_6, __pyx_v_y);
      __Pyx_INCREF(__pyx_v_best_col);
      __Pyx_GIVEREF(__pyx_v_best_col);
      PyTuple_SET_ITEM(__pyx_t_34, 3+__pyx_t_6, __pyx_v_best_col);
      __Pyx_INCREF(__pyx_v_best_value);
      __Pyx_GIVEREF(__pyx_v_best_value);
      PyTuple_SET_ITEM(__pyx_t_34, 4+__pyx_t_6, __pyx_v_best_value);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_34, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2202, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_34 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_36 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_41 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_34 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_36 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_41 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_34);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_36);
      __Pyx_INCREF(__pyx_t_41);
      __Pyx_INCREF(__pyx_t_7);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_34,&__pyx_t_5,&__pyx_t_36,&__pyx_t_41,&__pyx_t_7};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2202, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_34,&__pyx_t_5,&__pyx_t_36,&__pyx_t_41,&__pyx_t_7};
      __pyx_t_33 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 2202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_45 = Py_TYPE(__pyx_t_33)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_45(__pyx_t_33); if (unlikely(!item)) goto __pyx_L50_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_45(__pyx_t_33), 6) < 0) __PYX_ERR(0, 2202, __pyx_L1_error)
      __pyx_t_45 = NULL;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      goto __pyx_L51_unpacking_done;
      __pyx_L50_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_45 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2202, __pyx_L1_error)
      __pyx_L51_unpacking_done:;
    }
    __pyx_v_X_l = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_X_r = __pyx_t_34;
    __pyx_t_34 = 0;
    __pyx_v_w_l = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_w_r = __pyx_t_36;
    __pyx_t_36 = 0;
    __pyx_v_y_l = __pyx_t_41;
    __pyx_t_41 = 0;
    __pyx_v_y_r = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "causalml/inference/tree/uplift.pyx":2203
 *             # re-calculate the divideSet
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, best_col, best_value)
 *             if X_val is not None:             # <<<<<<<<<<<<<<
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)
 *                 best_set_left = [X_l, w_l, y_l, X_val_l, w_val_l, y_val_l]
 */
    __pyx_t_2 = (__pyx_v_X_val != Py_None);
    __pyx_t_21 = (__pyx_t_2 != 0);
    if (__pyx_t_21) {

      /* "causalml/inference/tree/uplift.pyx":2204
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, best_col, best_value)
 *             if X_val is not None:
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)             # <<<<<<<<<<<<<<
 *                 best_set_left = [X_l, w_l, y_l, X_val_l, w_val_l, y_val_l]
 *                 best_set_right = [X_r, w_r, y_r, X_val_r, w_val_r, y_val_r]
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_divideSet); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_41 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_41)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_41);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[6] = {__pyx_t_41, __pyx_v_X_val, __pyx_v_treatment_val_idx, __pyx_v_y_val, __pyx_v_best_col, __pyx_v_best_value};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[6] = {__pyx_t_41, __pyx_v_X_val, __pyx_v_treatment_val_idx, __pyx_v_y_val, __pyx_v_best_col, __pyx_v_best_value};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_36 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        if (__pyx_t_41) {
          __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_41); __pyx_t_41 = NULL;
        }
        __Pyx_INCREF(__pyx_v_X_val);
        __Pyx_GIVEREF(__pyx_v_X_val);
        PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, __pyx_v_X_val);
        __Pyx_INCREF(__pyx_v_treatment_val_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_val_idx);
        PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, __pyx_v_treatment_val_idx);
        __Pyx_INCREF(__pyx_v_y_val);
        __Pyx_GIVEREF(__pyx_v_y_val);
        PyTuple_SET_ITEM(__pyx_t_36, 2+__pyx_t_6, __pyx_v_y_val);
        __Pyx_INCREF(__pyx_v_best_col);
        __Pyx_GIVEREF(__pyx_v_best_col);
        PyTuple_SET_ITEM(__pyx_t_36, 3+__pyx_t_6, __pyx_v_best_col);
        __Pyx_INCREF(__pyx_v_best_value);
        __Pyx_GIVEREF(__pyx_v_best_value);
        PyTuple_SET_ITEM(__pyx_t_36, 4+__pyx_t_6, __pyx_v_best_value);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_36, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 6)) {
          if (size > 6) __Pyx_RaiseTooManyValuesError(6);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2204, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_36 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_41 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_34 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 5); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_36 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_41 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_34 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 5); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_36);
        __Pyx_INCREF(__pyx_t_41);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_34);
        __Pyx_INCREF(__pyx_t_3);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[6] = {&__pyx_t_7,&__pyx_t_36,&__pyx_t_41,&__pyx_t_5,&__pyx_t_34,&__pyx_t_3};
          for (i=0; i < 6; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2204, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[6] = {&__pyx_t_7,&__pyx_t_36,&__pyx_t_41,&__pyx_t_5,&__pyx_t_34,&__pyx_t_3};
        __pyx_t_33 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 2204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_45 = Py_TYPE(__pyx_t_33)->tp_iternext;
        for (index=0; index < 6; index++) {
          PyObject* item = __pyx_t_45(__pyx_t_33); if (unlikely(!item)) goto __pyx_L53_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_45(__pyx_t_33), 6) < 0) __PYX_ERR(0, 2204, __pyx_L1_error)
        __pyx_t_45 = NULL;
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        goto __pyx_L54_unpacking_done;
        __pyx_L53_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __pyx_t_45 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 2204, __pyx_L1_error)
        __pyx_L54_unpacking_done:;
      }
      __pyx_v_X_val_l = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_X_val_r = __pyx_t_36;
      __pyx_t_36 = 0;
      __pyx_v_w_val_l = __pyx_t_41;
      __pyx_t_41 = 0;
      __pyx_v_w_val_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_y_val_l = __pyx_t_34;
      __pyx_t_34 = 0;
      __pyx_v_y_val_r = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":2205
 *             if X_val is not None:
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)
 *                 best_set_left = [X_l, w_l, y_l, X_val_l, w_val_l, y_val_l]             # <<<<<<<<<<<<<<
 *                 best_set_right = [X_r, w_r, y_r, X_val_r, w_val_r, y_val_r]
 *             else:
 */
      __pyx_t_4 = PyList_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_X_l);
      __Pyx_GIVEREF(__pyx_v_X_l);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_X_l);
      __Pyx_INCREF(__pyx_v_w_l);
      __Pyx_GIVEREF(__pyx_v_w_l);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_w_l);
      __Pyx_INCREF(__pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_v_y_l);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_v_y_l);
      __Pyx_INCREF(__pyx_v_X_val_l);
      __Pyx_GIVEREF(__pyx_v_X_val_l);
      PyList_SET_ITEM(__pyx_t_4, 3, __pyx_v_X_val_l);
      __Pyx_INCREF(__pyx_v_w_val_l);
      __Pyx_GIVEREF(__pyx_v_w_val_l);
      PyList_SET_ITEM(__pyx_t_4, 4, __pyx_v_w_val_l);
      __Pyx_INCREF(__pyx_v_y_val_l);
      __Pyx_GIVEREF(__pyx_v_y_val_l);
      PyList_SET_ITEM(__pyx_t_4, 5, __pyx_v_y_val_l);
      __pyx_v_best_set_left = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2206
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)
 *                 best_set_left = [X_l, w_l, y_l, X_val_l, w_val_l, y_val_l]
 *                 best_set_right = [X_r, w_r, y_r, X_val_r, w_val_r, y_val_r]             # <<<<<<<<<<<<<<
 *             else:
 *                 best_set_left = [X_l, w_l, y_l, None, None, None]
 */
      __pyx_t_4 = PyList_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_X_r);
      __Pyx_GIVEREF(__pyx_v_X_r);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_X_r);
      __Pyx_INCREF(__pyx_v_w_r);
      __Pyx_GIVEREF(__pyx_v_w_r);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_w_r);
      __Pyx_INCREF(__pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_v_y_r);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_v_y_r);
      __Pyx_INCREF(__pyx_v_X_val_r);
      __Pyx_GIVEREF(__pyx_v_X_val_r);
      PyList_SET_ITEM(__pyx_t_4, 3, __pyx_v_X_val_r);
      __Pyx_INCREF(__pyx_v_w_val_r);
      __Pyx_GIVEREF(__pyx_v_w_val_r);
      PyList_SET_ITEM(__pyx_t_4, 4, __pyx_v_w_val_r);
      __Pyx_INCREF(__pyx_v_y_val_r);
      __Pyx_GIVEREF(__pyx_v_y_val_r);
      PyList_SET_ITEM(__pyx_t_4, 5, __pyx_v_y_val_r);
      __pyx_v_best_set_right = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2203
 *             # re-calculate the divideSet
 *             X_l, X_r, w_l, w_r, y_l, y_r = self.divideSet(X, treatment_idx, y, best_col, best_value)
 *             if X_val is not None:             # <<<<<<<<<<<<<<
 *                 X_val_l, X_val_r, w_val_l, w_val_r, y_val_l, y_val_r = self.divideSet(X_val, treatment_val_idx, y_val, best_col, best_value)
 *                 best_set_left = [X_l, w_l, y_l, X_val_l, w_val_l, y_val_l]
 */
      goto __pyx_L52;
    }

    /* "causalml/inference/tree/uplift.pyx":2208
 *                 best_set_right = [X_r, w_r, y_r, X_val_r, w_val_r, y_val_r]
 *             else:
 *                 best_set_left = [X_l, w_l, y_l, None, None, None]             # <<<<<<<<<<<<<<
 *                 best_set_right = [X_r, w_r, y_r, None, None, None]
 * 
 */
    /*else*/ {
      __pyx_t_4 = PyList_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_X_l);
      __Pyx_GIVEREF(__pyx_v_X_l);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_X_l);
      __Pyx_INCREF(__pyx_v_w_l);
      __Pyx_GIVEREF(__pyx_v_w_l);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_w_l);
      __Pyx_INCREF(__pyx_v_y_l);
      __Pyx_GIVEREF(__pyx_v_y_l);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_v_y_l);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 3, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 4, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 5, Py_None);
      __pyx_v_best_set_left = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2209
 *             else:
 *                 best_set_left = [X_l, w_l, y_l, None, None, None]
 *                 best_set_right = [X_r, w_r, y_r, None, None, None]             # <<<<<<<<<<<<<<
 * 
 *         dcY = {'impurity': '%.3f' % currentScore, 'samples': '%d' % len(X)}
 */
      __pyx_t_4 = PyList_New(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_X_r);
      __Pyx_GIVEREF(__pyx_v_X_r);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_X_r);
      __Pyx_INCREF(__pyx_v_w_r);
      __Pyx_GIVEREF(__pyx_v_w_r);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_w_r);
      __Pyx_INCREF(__pyx_v_y_r);
      __Pyx_GIVEREF(__pyx_v_y_r);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_v_y_r);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 3, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 4, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyList_SET_ITEM(__pyx_t_4, 5, Py_None);
      __pyx_v_best_set_right = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L52:;

    /* "causalml/inference/tree/uplift.pyx":2199
 * 
 *         # after finding the best split col and value
 *         if best_col is not None:             # <<<<<<<<<<<<<<
 *             bestAttribute = (best_col, best_value)
 *             # re-calculate the divideSet
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2211
 *                 best_set_right = [X_r, w_r, y_r, None, None, None]
 * 
 *         dcY = {'impurity': '%.3f' % currentScore, 'samples': '%d' % len(X)}             # <<<<<<<<<<<<<<
 *         # Add treatment size
 *         dcY['group_size'] = ''
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_3f, __pyx_v_currentScore); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_impurity, __pyx_t_3) < 0) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2211, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_34 = PyUnicode_Format(__pyx_kp_u_d, __pyx_t_3); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_34);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_samples, __pyx_t_34) < 0) __PYX_ERR(0, 2211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
  __pyx_v_dcY = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2213
 *         dcY = {'impurity': '%.3f' % currentScore, 'samples': '%d' % len(X)}
 *         # Add treatment size
 *         dcY['group_size'] = ''             # <<<<<<<<<<<<<<
 *         for i, summary in enumerate(currentNodeSummary):
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])
 */
  if (unlikely(PyDict_SetItem(__pyx_v_dcY, __pyx_n_u_group_size, __pyx_kp_u__4) < 0)) __PYX_ERR(0, 2213, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2214
 *         # Add treatment size
 *         dcY['group_size'] = ''
 *         for i, summary in enumerate(currentNodeSummary):             # <<<<<<<<<<<<<<
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])
 *         dcY['upliftScore'] = [round(upliftScore[0], 4), round(upliftScore[1], 4)]
 */
  __pyx_t_6 = 0;
  __pyx_t_4 = __pyx_v_currentNodeSummary; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_34 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_34); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 2214, __pyx_L1_error)
    #else
    __pyx_t_34 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_summary, __pyx_t_34);
    __pyx_t_34 = 0;
    __pyx_v_i = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "causalml/inference/tree/uplift.pyx":2215
 *         dcY['group_size'] = ''
 *         for i, summary in enumerate(currentNodeSummary):
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])             # <<<<<<<<<<<<<<
 *         dcY['upliftScore'] = [round(upliftScore[0], 4), round(upliftScore[1], 4)]
 *         dcY['matchScore'] = round(upliftScore[0], 4)
 */
    __Pyx_INCREF(__pyx_n_u_group_size);
    __pyx_t_46 = __pyx_n_u_group_size;
    __pyx_t_34 = __Pyx_PyDict_GetItem(__pyx_v_dcY, __pyx_t_46); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_kp_u__5, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_kp_u__6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_summary, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_41 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_3); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_41); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    __pyx_t_41 = PyNumber_InPlaceAdd(__pyx_t_34, __pyx_t_3); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_dcY, __pyx_t_46, __pyx_t_41) < 0)) __PYX_ERR(0, 2215, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    __Pyx_DECREF(__pyx_t_46); __pyx_t_46 = 0;

    /* "causalml/inference/tree/uplift.pyx":2214
 *         # Add treatment size
 *         dcY['group_size'] = ''
 *         for i, summary in enumerate(currentNodeSummary):             # <<<<<<<<<<<<<<
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])
 *         dcY['upliftScore'] = [round(upliftScore[0], 4), round(upliftScore[1], 4)]
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2216
 *         for i, summary in enumerate(currentNodeSummary):
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])
 *         dcY['upliftScore'] = [round(upliftScore[0], 4), round(upliftScore[1], 4)]             # <<<<<<<<<<<<<<
 *         dcY['matchScore'] = round(upliftScore[0], 4)
 * 
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  __Pyx_GIVEREF(PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  PyTuple_SET_ITEM(__pyx_t_4, 0, PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_4);
  __pyx_t_41 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_4, NULL); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_41);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_upliftScore, 1));
  __Pyx_GIVEREF(PyList_GET_ITEM(__pyx_v_upliftScore, 1));
  PyTuple_SET_ITEM(__pyx_t_4, 0, PyList_GET_ITEM(__pyx_v_upliftScore, 1));
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_41);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_41);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_41 = 0;
  __pyx_t_3 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_dcY, __pyx_n_u_upliftScore, __pyx_t_4) < 0)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2217
 *             dcY['group_size'] += ' ' + self.classes_[i] + ': ' + str(summary[1])
 *         dcY['upliftScore'] = [round(upliftScore[0], 4), round(upliftScore[1], 4)]
 *         dcY['matchScore'] = round(upliftScore[0], 4)             # <<<<<<<<<<<<<<
 * 
 *         if bestGain > 0 and depth < max_depth:
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  __Pyx_GIVEREF(PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  PyTuple_SET_ITEM(__pyx_t_4, 0, PyList_GET_ITEM(__pyx_v_upliftScore, 0));
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_dcY, __pyx_n_u_matchScore, __pyx_t_3) < 0)) __PYX_ERR(0, 2217, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2219
 *         dcY['matchScore'] = round(upliftScore[0], 4)
 * 
 *         if bestGain > 0 and depth < max_depth:             # <<<<<<<<<<<<<<
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_bestGain, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {
  } else {
    __pyx_t_21 = __pyx_t_2;
    goto __pyx_L58_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_depth, __pyx_v_max_depth, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_21 = __pyx_t_2;
  __pyx_L58_bool_binop_done:;
  if (__pyx_t_21) {

    /* "causalml/inference/tree/uplift.pyx":2220
 * 
 *         if bestGain > 0 and depth < max_depth:
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp             # <<<<<<<<<<<<<<
 *             trueBranch = self.growDecisionTreeFrom(
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_feature_imp_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_bestAttribute == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2220, __pyx_L1_error)
    }
    __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_bestAttribute, 0));
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_bestAttribute, 0);
    __pyx_t_41 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __pyx_t_34 = PyNumber_InPlaceAdd(__pyx_t_41, __pyx_v_bestGainImp); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_t_4, __pyx_t_34) < 0)) __PYX_ERR(0, 2220, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2221
 *         if bestGain > 0 and depth < max_depth:
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_growDecisionTreeFrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "causalml/inference/tree/uplift.pyx":2222
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,             # <<<<<<<<<<<<<<
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 */
    if (unlikely(!__pyx_v_best_set_left)) { __Pyx_RaiseUnboundLocalError("best_set_left"); __PYX_ERR(0, 2222, __pyx_L1_error) }

    /* "causalml/inference/tree/uplift.pyx":2221
 *         if bestGain > 0 and depth < max_depth:
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_4 = PySequence_Tuple(__pyx_v_best_set_left); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "causalml/inference/tree/uplift.pyx":2222
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,             # <<<<<<<<<<<<<<
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 */
    __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);

    /* "causalml/inference/tree/uplift.pyx":2223
 *             trueBranch = self.growDecisionTreeFrom(
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,             # <<<<<<<<<<<<<<
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 */
    __pyx_t_41 = __Pyx_PyInt_AddObjC(__pyx_v_depth, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);

    /* "causalml/inference/tree/uplift.pyx":2221
 *         if bestGain > 0 and depth < max_depth:
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_34);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_34);
    __Pyx_INCREF(__pyx_v_max_depth);
    __Pyx_GIVEREF(__pyx_v_max_depth);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_max_depth);
    __Pyx_INCREF(__pyx_v_min_samples_leaf);
    __Pyx_GIVEREF(__pyx_v_min_samples_leaf);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_min_samples_leaf);
    __Pyx_GIVEREF(__pyx_t_41);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_41);
    __pyx_t_34 = 0;
    __pyx_t_41 = 0;
    __pyx_t_41 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":2223
 *             trueBranch = self.growDecisionTreeFrom(
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,             # <<<<<<<<<<<<<<
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 */
    __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_min_samples_treatment, __pyx_v_min_samples_treatment) < 0) __PYX_ERR(0, 2223, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2224
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p             # <<<<<<<<<<<<<<
 *             )
 *             falseBranch = self.growDecisionTreeFrom(
 */
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 2223, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_parentNodeSummary_p, ((PyObject *)__pyx_v_cur_summary_p)) < 0) __PYX_ERR(0, 2223, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2221
 *         if bestGain > 0 and depth < max_depth:
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_left, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_41, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_trueBranch = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2226
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 *             falseBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_growDecisionTreeFrom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "causalml/inference/tree/uplift.pyx":2227
 *             )
 *             falseBranch = self.growDecisionTreeFrom(
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,             # <<<<<<<<<<<<<<
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 */
    if (unlikely(!__pyx_v_best_set_right)) { __Pyx_RaiseUnboundLocalError("best_set_right"); __PYX_ERR(0, 2227, __pyx_L1_error) }

    /* "causalml/inference/tree/uplift.pyx":2226
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 *             falseBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_5 = PySequence_Tuple(__pyx_v_best_set_right); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "causalml/inference/tree/uplift.pyx":2227
 *             )
 *             falseBranch = self.growDecisionTreeFrom(
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,             # <<<<<<<<<<<<<<
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 */
    __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);

    /* "causalml/inference/tree/uplift.pyx":2228
 *             falseBranch = self.growDecisionTreeFrom(
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,             # <<<<<<<<<<<<<<
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 */
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_depth, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "causalml/inference/tree/uplift.pyx":2226
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 *             falseBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_34 = PyTuple_New(4); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    __Pyx_GIVEREF(__pyx_t_41);
    PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_41);
    __Pyx_INCREF(__pyx_v_max_depth);
    __Pyx_GIVEREF(__pyx_v_max_depth);
    PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_v_max_depth);
    __Pyx_INCREF(__pyx_v_min_samples_leaf);
    __Pyx_GIVEREF(__pyx_v_min_samples_leaf);
    PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_v_min_samples_leaf);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_t_3);
    __pyx_t_41 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;

    /* "causalml/inference/tree/uplift.pyx":2228
 *             falseBranch = self.growDecisionTreeFrom(
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,             # <<<<<<<<<<<<<<
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 */
    __pyx_t_34 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_min_samples_treatment, __pyx_v_min_samples_treatment) < 0) __PYX_ERR(0, 2228, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2229
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p             # <<<<<<<<<<<<<<
 *             )
 * 
 */
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 2228, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_parentNodeSummary_p, ((PyObject *)__pyx_v_cur_summary_p)) < 0) __PYX_ERR(0, 2228, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2226
 *                 n_reg=n_reg, parentNodeSummary_p=cur_summary_p
 *             )
 *             falseBranch = self.growDecisionTreeFrom(             # <<<<<<<<<<<<<<
 *                 *best_set_right, self.early_stopping_eval_diff_scale, max_depth, min_samples_leaf,
 *                 depth + 1, min_samples_treatment=min_samples_treatment,
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_34); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2226, __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_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    __pyx_v_falseBranch = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":2232
 *             )
 * 
 *             return DecisionTree(             # <<<<<<<<<<<<<<
 *                 classes_=self.classes_,
 *                 col=bestAttribute[0], value=bestAttribute[1],
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DecisionTree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "causalml/inference/tree/uplift.pyx":2233
 * 
 *             return DecisionTree(
 *                 classes_=self.classes_,             # <<<<<<<<<<<<<<
 *                 col=bestAttribute[0], value=bestAttribute[1],
 *                 trueBranch=trueBranch, falseBranch=falseBranch, summary=dcY,
 */
    __pyx_t_34 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_classes, __pyx_t_3) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2234
 *             return DecisionTree(
 *                 classes_=self.classes_,
 *                 col=bestAttribute[0], value=bestAttribute[1],             # <<<<<<<<<<<<<<
 *                 trueBranch=trueBranch, falseBranch=falseBranch, summary=dcY,
 *                 maxDiffTreatment=maxDiffTreatment, maxDiffSign=maxDiffSign,
 */
    if (unlikely(__pyx_v_bestAttribute == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2234, __pyx_L1_error)
    }
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_col, PyTuple_GET_ITEM(__pyx_v_bestAttribute, 0)) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    if (unlikely(__pyx_v_bestAttribute == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 2234, __pyx_L1_error)
    }
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_value, PyTuple_GET_ITEM(__pyx_v_bestAttribute, 1)) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2235
 *                 classes_=self.classes_,
 *                 col=bestAttribute[0], value=bestAttribute[1],
 *                 trueBranch=trueBranch, falseBranch=falseBranch, summary=dcY,             # <<<<<<<<<<<<<<
 *                 maxDiffTreatment=maxDiffTreatment, maxDiffSign=maxDiffSign,
 *                 nodeSummary=currentNodeSummary,
 */
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_trueBranch, __pyx_v_trueBranch) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_falseBranch, __pyx_v_falseBranch) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_summary, __pyx_v_dcY) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2236
 *                 col=bestAttribute[0], value=bestAttribute[1],
 *                 trueBranch=trueBranch, falseBranch=falseBranch, summary=dcY,
 *                 maxDiffTreatment=maxDiffTreatment, maxDiffSign=maxDiffSign,             # <<<<<<<<<<<<<<
 *                 nodeSummary=currentNodeSummary,
 *                 backupResults=self.uplift_classification_results(treatment_idx, y),
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_maxDiffTreatment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_maxDiffTreatment, __pyx_t_3) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_maxDiffSign, __pyx_v_maxDiffSign) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2237
 *                 trueBranch=trueBranch, falseBranch=falseBranch, summary=dcY,
 *                 maxDiffTreatment=maxDiffTreatment, maxDiffSign=maxDiffSign,
 *                 nodeSummary=currentNodeSummary,             # <<<<<<<<<<<<<<
 *                 backupResults=self.uplift_classification_results(treatment_idx, y),
 *                 bestTreatment=bestTreatment, upliftScore=upliftScore
 */
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_nodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2238
 *                 maxDiffTreatment=maxDiffTreatment, maxDiffSign=maxDiffSign,
 *                 nodeSummary=currentNodeSummary,
 *                 backupResults=self.uplift_classification_results(treatment_idx, y),             # <<<<<<<<<<<<<<
 *                 bestTreatment=bestTreatment, upliftScore=upliftScore
 *             )
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uplift_classification_results); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_41 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_41)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_41);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_41, __pyx_v_treatment_idx, __pyx_v_y};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2238, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_41, __pyx_v_treatment_idx, __pyx_v_y};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2238, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_36 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_36);
      if (__pyx_t_41) {
        __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_41); __pyx_t_41 = NULL;
      }
      __Pyx_INCREF(__pyx_v_treatment_idx);
      __Pyx_GIVEREF(__pyx_v_treatment_idx);
      PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, __pyx_v_treatment_idx);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_36, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_backupResults, __pyx_t_3) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":2239
 *                 nodeSummary=currentNodeSummary,
 *                 backupResults=self.uplift_classification_results(treatment_idx, y),
 *                 bestTreatment=bestTreatment, upliftScore=upliftScore             # <<<<<<<<<<<<<<
 *             )
 *         else:
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_bestTreatment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_bestTreatment, __pyx_t_3) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_upliftScore, __pyx_v_upliftScore) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)

    /* "causalml/inference/tree/uplift.pyx":2232
 *             )
 * 
 *             return DecisionTree(             # <<<<<<<<<<<<<<
 *                 classes_=self.classes_,
 *                 col=bestAttribute[0], value=bestAttribute[1],
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":2219
 *         dcY['matchScore'] = round(upliftScore[0], 4)
 * 
 *         if bestGain > 0 and depth < max_depth:             # <<<<<<<<<<<<<<
 *             self.feature_imp_dict[bestAttribute[0]] += bestGainImp
 *             trueBranch = self.growDecisionTreeFrom(
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2242
 *             )
 *         else:
 *             if self.evaluationFunction == self.evaluate_CTS:             # <<<<<<<<<<<<<<
 *                 return DecisionTree(
 *                     classes_=self.classes_,
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate_CTS); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_34);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_34, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2242, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
    __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_21 < 0)) __PYX_ERR(0, 2242, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_21) {

      /* "causalml/inference/tree/uplift.pyx":2243
 *         else:
 *             if self.evaluationFunction == self.evaluate_CTS:
 *                 return DecisionTree(             # <<<<<<<<<<<<<<
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DecisionTree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

      /* "causalml/inference/tree/uplift.pyx":2244
 *             if self.evaluationFunction == self.evaluate_CTS:
 *                 return DecisionTree(
 *                     classes_=self.classes_,             # <<<<<<<<<<<<<<
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, nodeSummary=currentNodeSummary,
 */
      __pyx_t_34 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_classes, __pyx_t_3) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":2245
 *                 return DecisionTree(
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),             # <<<<<<<<<<<<<<
 *                     summary=dcY, nodeSummary=currentNodeSummary,
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uplift_classification_results); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_36 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_36)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_36);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_36, __pyx_v_treatment_idx, __pyx_v_y};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_36, __pyx_v_treatment_idx, __pyx_v_y};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_36); __pyx_t_36 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_41 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        if (__pyx_t_36) {
          __Pyx_GIVEREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_36); __pyx_t_36 = NULL;
        }
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_6, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_6, __pyx_v_y);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_results, __pyx_t_3) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":2246
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, nodeSummary=currentNodeSummary,             # <<<<<<<<<<<<<<
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore
 *                 )
 */
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_summary, __pyx_v_dcY) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_nodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":2247
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, nodeSummary=currentNodeSummary,
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_bestTreatment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_bestTreatment, __pyx_t_3) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_upliftScore, __pyx_v_upliftScore) < 0) __PYX_ERR(0, 2244, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":2243
 *         else:
 *             if self.evaluationFunction == self.evaluate_CTS:
 *                 return DecisionTree(             # <<<<<<<<<<<<<<
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "causalml/inference/tree/uplift.pyx":2242
 *             )
 *         else:
 *             if self.evaluationFunction == self.evaluate_CTS:             # <<<<<<<<<<<<<<
 *                 return DecisionTree(
 *                     classes_=self.classes_,
 */
    }

    /* "causalml/inference/tree/uplift.pyx":2250
 *                 )
 *             else:
 *                 return DecisionTree(             # <<<<<<<<<<<<<<
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DecisionTree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "causalml/inference/tree/uplift.pyx":2251
 *             else:
 *                 return DecisionTree(
 *                     classes_=self.classes_,             # <<<<<<<<<<<<<<
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, maxDiffTreatment=maxDiffTreatment,
 */
      __pyx_t_34 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_classes, __pyx_t_5) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2252
 *                 return DecisionTree(
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),             # <<<<<<<<<<<<<<
 *                     summary=dcY, maxDiffTreatment=maxDiffTreatment,
 *                     maxDiffSign=maxDiffSign, nodeSummary=currentNodeSummary,
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uplift_classification_results); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_41 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_41)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_41);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_41, __pyx_v_treatment_idx, __pyx_v_y};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2252, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_41, __pyx_v_treatment_idx, __pyx_v_y};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2252, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_36 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 2252, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_36);
        if (__pyx_t_41) {
          __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_41); __pyx_t_41 = NULL;
        }
        __Pyx_INCREF(__pyx_v_treatment_idx);
        __Pyx_GIVEREF(__pyx_v_treatment_idx);
        PyTuple_SET_ITEM(__pyx_t_36, 0+__pyx_t_6, __pyx_v_treatment_idx);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_36, 1+__pyx_t_6, __pyx_v_y);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_36, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2252, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_results, __pyx_t_5) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2253
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, maxDiffTreatment=maxDiffTreatment,             # <<<<<<<<<<<<<<
 *                     maxDiffSign=maxDiffSign, nodeSummary=currentNodeSummary,
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore
 */
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_summary, __pyx_v_dcY) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxDiffTreatment); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_maxDiffTreatment, __pyx_t_5) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2254
 *                     results=self.uplift_classification_results(treatment_idx, y),
 *                     summary=dcY, maxDiffTreatment=maxDiffTreatment,
 *                     maxDiffSign=maxDiffSign, nodeSummary=currentNodeSummary,             # <<<<<<<<<<<<<<
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore
 *                 )
 */
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_maxDiffSign, __pyx_v_maxDiffSign) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_nodeSummary, __pyx_v_currentNodeSummary) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":2255
 *                     summary=dcY, maxDiffTreatment=maxDiffTreatment,
 *                     maxDiffSign=maxDiffSign, nodeSummary=currentNodeSummary,
 *                     bestTreatment=bestTreatment, upliftScore=upliftScore             # <<<<<<<<<<<<<<
 *                 )
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_bestTreatment); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2255, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_bestTreatment, __pyx_t_5) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_34, __pyx_n_s_upliftScore, __pyx_v_upliftScore) < 0) __PYX_ERR(0, 2251, __pyx_L1_error)

      /* "causalml/inference/tree/uplift.pyx":2250
 *                 )
 *             else:
 *                 return DecisionTree(             # <<<<<<<<<<<<<<
 *                     classes_=self.classes_,
 *                     results=self.uplift_classification_results(treatment_idx, y),
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_34); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
  }

  /* "causalml/inference/tree/uplift.pyx":1889
 *         return res
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *                              early_stopping_eval_diff_scale=1, max_depth=10,
 *                              min_samples_leaf=100, depth=1,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_33);
  __Pyx_XDECREF(__pyx_t_34);
  __Pyx_XDECREF(__pyx_t_36);
  __Pyx_XDECREF(__pyx_t_41);
  __Pyx_XDECREF(__pyx_t_46);
  { 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_cur_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.growDecisionTreeFrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cur_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_total_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_left_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_count_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_summary_n.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_right_summary_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_val_total_count_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_left_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_total_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_left_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_right_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_total_count_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_cur_summary_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_cur_summary_n);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_summary_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_summary_n);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_summary_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_summary_n);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_left_summary_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_left_summary_n);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_right_summary_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_val_right_summary_n);
  __Pyx_XDECREF(__pyx_v_parent_summary_p);
  __Pyx_XDECREF(__pyx_v_currentNodeSummary);
  __Pyx_XDECREF(__pyx_v_currentScore);
  __Pyx_XDECREF(__pyx_v_maxDiffSign);
  __Pyx_XDECREF(__pyx_v_p_value);
  __Pyx_XDECREF(__pyx_v_upliftScore);
  __Pyx_XDECREF(__pyx_v_bestGain);
  __Pyx_XDECREF(__pyx_v_bestGainImp);
  __Pyx_XDECREF(__pyx_v_bestAttribute);
  __Pyx_XDECREF(__pyx_v_best_col);
  __Pyx_XDECREF(__pyx_v_best_value);
  __Pyx_XDECREF(__pyx_v_len_X);
  __Pyx_XDECREF(__pyx_v_c_num_percentiles);
  __Pyx_XDECREF(__pyx_v_c_cat_percentiles);
  __Pyx_XDECREF(__pyx_v_columnCount);
  __Pyx_XDECREF(__pyx_v_max_features);
  __Pyx_XDECREF(__pyx_v_col);
  __Pyx_XDECREF(__pyx_v_columnValues);
  __Pyx_XDECREF(__pyx_v_lsUnique);
  __Pyx_XDECREF(__pyx_v_lspercentile);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_len_X_l);
  __Pyx_XDECREF(__pyx_v_len_X_r);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_len_X_val_l);
  __Pyx_XDECREF(__pyx_v_node_mst);
  __Pyx_XDECREF(__pyx_v_leftScore1);
  __Pyx_XDECREF(__pyx_v_rightScore2);
  __Pyx_XDECREF(__pyx_v_gain);
  __Pyx_XDECREF(__pyx_v_gain_for_imp);
  __Pyx_XDECREF(__pyx_v_currentDivergence);
  __Pyx_XDECREF(__pyx_v_norm_factor);
  __Pyx_XDECREF(__pyx_v_X_l);
  __Pyx_XDECREF(__pyx_v_X_r);
  __Pyx_XDECREF(__pyx_v_w_l);
  __Pyx_XDECREF(__pyx_v_w_r);
  __Pyx_XDECREF(__pyx_v_y_l);
  __Pyx_XDECREF(__pyx_v_y_r);
  __Pyx_XDECREF(__pyx_v_X_val_l);
  __Pyx_XDECREF(__pyx_v_X_val_r);
  __Pyx_XDECREF(__pyx_v_w_val_l);
  __Pyx_XDECREF(__pyx_v_w_val_r);
  __Pyx_XDECREF(__pyx_v_y_val_l);
  __Pyx_XDECREF(__pyx_v_y_val_r);
  __Pyx_XDECREF(__pyx_v_best_set_left);
  __Pyx_XDECREF(__pyx_v_best_set_right);
  __Pyx_XDECREF(__pyx_v_dcY);
  __Pyx_XDECREF(__pyx_v_summary);
  __Pyx_XDECREF(__pyx_v_trueBranch);
  __Pyx_XDECREF(__pyx_v_falseBranch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_71classify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_70classify[] = "\n        Classifies (prediction) the observations according to the tree.\n\n        Args\n        ----\n        observations : list of list\n            The internal data format for the training data (combining X, Y, treatment).\n\n        dataMissing: boolean, optional (default = False)\n            An indicator for if data are missing or not.\n\n        Returns\n        -------\n        tree.results, tree.upliftScore :\n            The results in the leaf node.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_71classify = {"classify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_71classify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_70classify};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_71classify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_tree = 0;
  PyObject *__pyx_v_dataMissing = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("classify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observations,&__pyx_n_s_tree,&__pyx_n_s_dataMissing,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 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_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("classify", 0, 2, 3, 1); __PYX_ERR(0, 2259, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataMissing);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "classify") < 0)) __PYX_ERR(0, 2259, __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_observations = values[0];
    __pyx_v_tree = values[1];
    __pyx_v_dataMissing = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("classify", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_70classify(__pyx_self, __pyx_v_observations, __pyx_v_tree, __pyx_v_dataMissing);

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

/* "causalml/inference/tree/uplift.pyx":2277
 *         '''
 * 
 *         def classifyWithoutMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming without missing data.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_1classifyWithoutMissingData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData[] = "\n            Classifies (prediction) the observations according to the tree, assuming without missing data.\n\n            Args\n            ----\n            observations : list of list\n                The internal data format for the training data (combining X, Y, treatment).\n\n            Returns\n            -------\n            tree.results, tree.upliftScore :\n                The results in the leaf node.\n            ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_1classifyWithoutMissingData = {"classifyWithoutMissingData", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_1classifyWithoutMissingData, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_1classifyWithoutMissingData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("classifyWithoutMissingData (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observations,&__pyx_n_s_tree,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_observations)) != 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_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("classifyWithoutMissingData", 1, 2, 2, 1); __PYX_ERR(0, 2277, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "classifyWithoutMissingData") < 0)) __PYX_ERR(0, 2277, __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_observations = values[0];
    __pyx_v_tree = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("classifyWithoutMissingData", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify.classifyWithoutMissingData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData(__pyx_self, __pyx_v_observations, __pyx_v_tree);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData(PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_cur_scope;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_outer_scope;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_branch = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("classifyWithoutMissingData", 0);
  __pyx_outer_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "causalml/inference/tree/uplift.pyx":2291
 *                 The results in the leaf node.
 *             '''
 *             if tree.results is not None:  # leaf             # <<<<<<<<<<<<<<
 *                 return tree.results, tree.upliftScore
 *             else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":2292
 *             '''
 *             if tree.results is not None:  # leaf
 *                 return tree.results, tree.upliftScore             # <<<<<<<<<<<<<<
 *             else:
 *                 v = observations[tree.col]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_upliftScore); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":2291
 *                 The results in the leaf node.
 *             '''
 *             if tree.results is not None:  # leaf             # <<<<<<<<<<<<<<
 *                 return tree.results, tree.upliftScore
 *             else:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2294
 *                 return tree.results, tree.upliftScore
 *             else:
 *                 v = observations[tree.col]             # <<<<<<<<<<<<<<
 *                 branch = None
 *                 if isinstance(v, int) or isinstance(v, float):
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_col); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_observations, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_v = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2295
 *             else:
 *                 v = observations[tree.col]
 *                 branch = None             # <<<<<<<<<<<<<<
 *                 if isinstance(v, int) or isinstance(v, float):
 *                     if v >= tree.value:
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_branch = Py_None;

    /* "causalml/inference/tree/uplift.pyx":2296
 *                 v = observations[tree.col]
 *                 branch = None
 *                 if isinstance(v, int) or isinstance(v, float):             # <<<<<<<<<<<<<<
 *                     if v >= tree.value:
 *                         branch = tree.trueBranch
 */
    __pyx_t_2 = PyInt_Check(__pyx_v_v); 
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (!__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_6 = PyFloat_Check(__pyx_v_v); 
    __pyx_t_2 = (__pyx_t_6 != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_3) {

      /* "causalml/inference/tree/uplift.pyx":2297
 *                 branch = None
 *                 if isinstance(v, int) or isinstance(v, float):
 *                     if v >= tree.value:             # <<<<<<<<<<<<<<
 *                         branch = tree.trueBranch
 *                     else:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_v, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2297, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2297, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_3) {

        /* "causalml/inference/tree/uplift.pyx":2298
 *                 if isinstance(v, int) or isinstance(v, float):
 *                     if v >= tree.value:
 *                         branch = tree.trueBranch             # <<<<<<<<<<<<<<
 *                     else:
 *                         branch = tree.falseBranch
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2297
 *                 branch = None
 *                 if isinstance(v, int) or isinstance(v, float):
 *                     if v >= tree.value:             # <<<<<<<<<<<<<<
 *                         branch = tree.trueBranch
 *                     else:
 */
        goto __pyx_L7;
      }

      /* "causalml/inference/tree/uplift.pyx":2300
 *                         branch = tree.trueBranch
 *                     else:
 *                         branch = tree.falseBranch             # <<<<<<<<<<<<<<
 *                 else:
 *                     if v == tree.value:
 */
      /*else*/ {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_5);
        __pyx_t_5 = 0;
      }
      __pyx_L7:;

      /* "causalml/inference/tree/uplift.pyx":2296
 *                 v = observations[tree.col]
 *                 branch = None
 *                 if isinstance(v, int) or isinstance(v, float):             # <<<<<<<<<<<<<<
 *                     if v >= tree.value:
 *                         branch = tree.trueBranch
 */
      goto __pyx_L4;
    }

    /* "causalml/inference/tree/uplift.pyx":2302
 *                         branch = tree.falseBranch
 *                 else:
 *                     if v == tree.value:             # <<<<<<<<<<<<<<
 *                         branch = tree.trueBranch
 *                     else:
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2302, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2302, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "causalml/inference/tree/uplift.pyx":2303
 *                 else:
 *                     if v == tree.value:
 *                         branch = tree.trueBranch             # <<<<<<<<<<<<<<
 *                     else:
 *                         branch = tree.falseBranch
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2303, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "causalml/inference/tree/uplift.pyx":2302
 *                         branch = tree.falseBranch
 *                 else:
 *                     if v == tree.value:             # <<<<<<<<<<<<<<
 *                         branch = tree.trueBranch
 *                     else:
 */
        goto __pyx_L8;
      }

      /* "causalml/inference/tree/uplift.pyx":2305
 *                         branch = tree.trueBranch
 *                     else:
 *                         branch = tree.falseBranch             # <<<<<<<<<<<<<<
 *             return classifyWithoutMissingData(observations, branch)
 * 
 */
      /*else*/ {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2305, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_4);
        __pyx_t_4 = 0;
      }
      __pyx_L8:;
    }
    __pyx_L4:;
  }

  /* "causalml/inference/tree/uplift.pyx":2306
 *                     else:
 *                         branch = tree.falseBranch
 *             return classifyWithoutMissingData(observations, branch)             # <<<<<<<<<<<<<<
 * 
 *         def classifyWithMissingData(observations, tree):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_classifyWithoutMissingData)) { __Pyx_RaiseClosureNameError("classifyWithoutMissingData"); __PYX_ERR(0, 2306, __pyx_L1_error) }
  __pyx_t_4 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData(__pyx_cur_scope->__pyx_v_classifyWithoutMissingData, __pyx_v_observations, __pyx_v_branch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":2277
 *         '''
 * 
 *         def classifyWithoutMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming without missing data.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify.classifyWithoutMissingData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_branch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2308
 *             return classifyWithoutMissingData(observations, branch)
 * 
 *         def classifyWithMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming with missing data.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_3classifyWithMissingData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData[] = "\n            Classifies (prediction) the observations according to the tree, assuming with missing data.\n\n            Args\n            ----\n            observations : list of list\n                The internal data format for the training data (combining X, Y, treatment).\n\n            Returns\n            -------\n            tree.results, tree.upliftScore :\n                The results in the leaf node.\n            ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_3classifyWithMissingData = {"classifyWithMissingData", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_3classifyWithMissingData, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_3classifyWithMissingData(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("classifyWithMissingData (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observations,&__pyx_n_s_tree,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_observations)) != 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_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("classifyWithMissingData", 1, 2, 2, 1); __PYX_ERR(0, 2308, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "classifyWithMissingData") < 0)) __PYX_ERR(0, 2308, __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_observations = values[0];
    __pyx_v_tree = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("classifyWithMissingData", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify.classifyWithMissingData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(__pyx_self, __pyx_v_observations, __pyx_v_tree);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_cur_scope;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_outer_scope;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_tr = NULL;
  PyObject *__pyx_v_fr = NULL;
  PyObject *__pyx_v_tcount = NULL;
  PyObject *__pyx_v_fcount = NULL;
  PyObject *__pyx_v_tw = NULL;
  PyObject *__pyx_v_fw = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_branch = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("classifyWithMissingData", 0);
  __pyx_outer_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "causalml/inference/tree/uplift.pyx":2322
 *                 The results in the leaf node.
 *             '''
 *             if tree.results is not None:  # leaf             # <<<<<<<<<<<<<<
 *                 return tree.results
 *             else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":2323
 *             '''
 *             if tree.results is not None:  # leaf
 *                 return tree.results             # <<<<<<<<<<<<<<
 *             else:
 *                 v = observations[tree.col]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_results); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":2322
 *                 The results in the leaf node.
 *             '''
 *             if tree.results is not None:  # leaf             # <<<<<<<<<<<<<<
 *                 return tree.results
 *             else:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2325
 *                 return tree.results
 *             else:
 *                 v = observations[tree.col]             # <<<<<<<<<<<<<<
 *                 if v is None:
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_col); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_observations, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_v = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2326
 *             else:
 *                 v = observations[tree.col]
 *                 if v is None:             # <<<<<<<<<<<<<<
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)
 */
    __pyx_t_3 = (__pyx_v_v == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "causalml/inference/tree/uplift.pyx":2327
 *                 v = observations[tree.col]
 *                 if v is None:
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)             # <<<<<<<<<<<<<<
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)
 *                     tcount = sum(tr.values())
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(!__pyx_cur_scope->__pyx_v_classifyWithMissingData)) { __Pyx_RaiseClosureNameError("classifyWithMissingData"); __PYX_ERR(0, 2327, __pyx_L1_error) }
      __pyx_t_1 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(__pyx_cur_scope->__pyx_v_classifyWithMissingData, __pyx_v_observations, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_tr = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "causalml/inference/tree/uplift.pyx":2328
 *                 if v is None:
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)             # <<<<<<<<<<<<<<
 *                     tcount = sum(tr.values())
 *                     fcount = sum(fr.values())
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(!__pyx_cur_scope->__pyx_v_classifyWithMissingData)) { __Pyx_RaiseClosureNameError("classifyWithMissingData"); __PYX_ERR(0, 2328, __pyx_L1_error) }
      __pyx_t_4 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(__pyx_cur_scope->__pyx_v_classifyWithMissingData, __pyx_v_observations, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_fr = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2329
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)
 *                     tcount = sum(tr.values())             # <<<<<<<<<<<<<<
 *                     fcount = sum(fr.values())
 *                     tw = float(tcount) / (tcount + fcount)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tr, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_tcount = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "causalml/inference/tree/uplift.pyx":2330
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)
 *                     tcount = sum(tr.values())
 *                     fcount = sum(fr.values())             # <<<<<<<<<<<<<<
 *                     tw = float(tcount) / (tcount + fcount)
 *                     fw = float(fcount) / (tcount + fcount)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fr, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_fcount = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2331
 *                     tcount = sum(tr.values())
 *                     fcount = sum(fr.values())
 *                     tw = float(tcount) / (tcount + fcount)             # <<<<<<<<<<<<<<
 *                     fw = float(fcount) / (tcount + fcount)
 * 
 */
      __pyx_t_4 = __Pyx_PyNumber_Float(__pyx_v_tcount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Add(__pyx_v_tcount, __pyx_v_fcount); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_tw = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "causalml/inference/tree/uplift.pyx":2332
 *                     fcount = sum(fr.values())
 *                     tw = float(tcount) / (tcount + fcount)
 *                     fw = float(fcount) / (tcount + fcount)             # <<<<<<<<<<<<<<
 * 
 *                     # Problem description: http://blog.ludovf.net/python-collections-defaultdict/
 */
      __pyx_t_5 = __Pyx_PyNumber_Float(__pyx_v_fcount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyNumber_Add(__pyx_v_tcount, __pyx_v_fcount); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_fw = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2335
 * 
 *                     # Problem description: http://blog.ludovf.net/python-collections-defaultdict/
 *                     result = defaultdict(int)             # <<<<<<<<<<<<<<
 *                     for k, v in tr.items():
 *                         result[k] += v * tw
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, ((PyObject *)(&PyInt_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)(&PyInt_Type)));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_result = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2336
 *                     # Problem description: http://blog.ludovf.net/python-collections-defaultdict/
 *                     result = defaultdict(int)
 *                     for k, v in tr.items():             # <<<<<<<<<<<<<<
 *                         result[k] += v * tw
 *                     for k, v in fr.items():
 */
      __pyx_t_6 = 0;
      if (unlikely(__pyx_v_tr == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 2336, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_tr, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_1;
      __pyx_t_1 = 0;
      while (1) {
        __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_7, &__pyx_t_6, &__pyx_t_1, &__pyx_t_5, NULL, __pyx_t_8);
        if (unlikely(__pyx_t_9 == 0)) break;
        if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 2336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "causalml/inference/tree/uplift.pyx":2337
 *                     result = defaultdict(int)
 *                     for k, v in tr.items():
 *                         result[k] += v * tw             # <<<<<<<<<<<<<<
 *                     for k, v in fr.items():
 *                         result[k] += v * fw
 */
        __Pyx_INCREF(__pyx_v_k);
        __pyx_t_5 = __pyx_v_k;
        __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_result, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = PyNumber_Multiply(__pyx_v_v, __pyx_v_tw); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_result, __pyx_t_5, __pyx_t_11) < 0)) __PYX_ERR(0, 2337, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2338
 *                     for k, v in tr.items():
 *                         result[k] += v * tw
 *                     for k, v in fr.items():             # <<<<<<<<<<<<<<
 *                         result[k] += v * fw
 *                     return dict(result)
 */
      __pyx_t_7 = 0;
      if (unlikely(__pyx_v_fr == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 2338, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_fr, 0, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
      while (1) {
        __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_7, &__pyx_t_5, &__pyx_t_11, NULL, __pyx_t_8);
        if (unlikely(__pyx_t_9 == 0)) break;
        if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 2338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "causalml/inference/tree/uplift.pyx":2339
 *                         result[k] += v * tw
 *                     for k, v in fr.items():
 *                         result[k] += v * fw             # <<<<<<<<<<<<<<
 *                     return dict(result)
 *                 else:
 */
        __Pyx_INCREF(__pyx_v_k);
        __pyx_t_11 = __pyx_v_k;
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_result, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2339, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = PyNumber_Multiply(__pyx_v_v, __pyx_v_fw); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2339, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2339, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_result, __pyx_t_11, __pyx_t_1) < 0)) __PYX_ERR(0, 2339, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "causalml/inference/tree/uplift.pyx":2340
 *                     for k, v in fr.items():
 *                         result[k] += v * fw
 *                     return dict(result)             # <<<<<<<<<<<<<<
 *                 else:
 *                     branch = None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2340, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "causalml/inference/tree/uplift.pyx":2326
 *             else:
 *                 v = observations[tree.col]
 *                 if v is None:             # <<<<<<<<<<<<<<
 *                     tr = classifyWithMissingData(observations, tree.trueBranch)
 *                     fr = classifyWithMissingData(observations, tree.falseBranch)
 */
    }

    /* "causalml/inference/tree/uplift.pyx":2342
 *                     return dict(result)
 *                 else:
 *                     branch = None             # <<<<<<<<<<<<<<
 *                     if isinstance(v, int) or isinstance(v, float):
 *                         if v >= tree.value:
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __pyx_v_branch = Py_None;

      /* "causalml/inference/tree/uplift.pyx":2343
 *                 else:
 *                     branch = None
 *                     if isinstance(v, int) or isinstance(v, float):             # <<<<<<<<<<<<<<
 *                         if v >= tree.value:
 *                             branch = tree.trueBranch
 */
      __pyx_t_3 = PyInt_Check(__pyx_v_v); 
      __pyx_t_12 = (__pyx_t_3 != 0);
      if (!__pyx_t_12) {
      } else {
        __pyx_t_2 = __pyx_t_12;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_12 = PyFloat_Check(__pyx_v_v); 
      __pyx_t_3 = (__pyx_t_12 != 0);
      __pyx_t_2 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_2) {

        /* "causalml/inference/tree/uplift.pyx":2344
 *                     branch = None
 *                     if isinstance(v, int) or isinstance(v, float):
 *                         if v >= tree.value:             # <<<<<<<<<<<<<<
 *                             branch = tree.trueBranch
 *                         else:
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2344, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_11 = PyObject_RichCompare(__pyx_v_v, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2344, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2344, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (__pyx_t_2) {

          /* "causalml/inference/tree/uplift.pyx":2345
 *                     if isinstance(v, int) or isinstance(v, float):
 *                         if v >= tree.value:
 *                             branch = tree.trueBranch             # <<<<<<<<<<<<<<
 *                         else:
 *                             branch = tree.falseBranch
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2345, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "causalml/inference/tree/uplift.pyx":2344
 *                     branch = None
 *                     if isinstance(v, int) or isinstance(v, float):
 *                         if v >= tree.value:             # <<<<<<<<<<<<<<
 *                             branch = tree.trueBranch
 *                         else:
 */
          goto __pyx_L12;
        }

        /* "causalml/inference/tree/uplift.pyx":2347
 *                             branch = tree.trueBranch
 *                         else:
 *                             branch = tree.falseBranch             # <<<<<<<<<<<<<<
 *                     else:
 *                         if v == tree.value:
 */
        /*else*/ {
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2347, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_11);
          __pyx_t_11 = 0;
        }
        __pyx_L12:;

        /* "causalml/inference/tree/uplift.pyx":2343
 *                 else:
 *                     branch = None
 *                     if isinstance(v, int) or isinstance(v, float):             # <<<<<<<<<<<<<<
 *                         if v >= tree.value:
 *                             branch = tree.trueBranch
 */
        goto __pyx_L9;
      }

      /* "causalml/inference/tree/uplift.pyx":2349
 *                             branch = tree.falseBranch
 *                     else:
 *                         if v == tree.value:             # <<<<<<<<<<<<<<
 *                             branch = tree.trueBranch
 *                         else:
 */
      /*else*/ {
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2349, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2349, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2349, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_2) {

          /* "causalml/inference/tree/uplift.pyx":2350
 *                     else:
 *                         if v == tree.value:
 *                             branch = tree.trueBranch             # <<<<<<<<<<<<<<
 *                         else:
 *                             branch = tree.falseBranch
 */
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_trueBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2350, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "causalml/inference/tree/uplift.pyx":2349
 *                             branch = tree.falseBranch
 *                     else:
 *                         if v == tree.value:             # <<<<<<<<<<<<<<
 *                             branch = tree.trueBranch
 *                         else:
 */
          goto __pyx_L13;
        }

        /* "causalml/inference/tree/uplift.pyx":2352
 *                             branch = tree.trueBranch
 *                         else:
 *                             branch = tree.falseBranch             # <<<<<<<<<<<<<<
 *                 return classifyWithMissingData(observations, branch)
 * 
 */
        /*else*/ {
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_falseBranch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2352, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_branch, __pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L13:;
      }
      __pyx_L9:;
    }

    /* "causalml/inference/tree/uplift.pyx":2353
 *                         else:
 *                             branch = tree.falseBranch
 *                 return classifyWithMissingData(observations, branch)             # <<<<<<<<<<<<<<
 * 
 *         # function body
 */
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(!__pyx_cur_scope->__pyx_v_classifyWithMissingData)) { __Pyx_RaiseClosureNameError("classifyWithMissingData"); __PYX_ERR(0, 2353, __pyx_L1_error) }
    __pyx_t_4 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(__pyx_cur_scope->__pyx_v_classifyWithMissingData, __pyx_v_observations, __pyx_v_branch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "causalml/inference/tree/uplift.pyx":2308
 *             return classifyWithoutMissingData(observations, branch)
 * 
 *         def classifyWithMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming with missing data.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify.classifyWithMissingData", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_tr);
  __Pyx_XDECREF(__pyx_v_fr);
  __Pyx_XDECREF(__pyx_v_tcount);
  __Pyx_XDECREF(__pyx_v_fcount);
  __Pyx_XDECREF(__pyx_v_tw);
  __Pyx_XDECREF(__pyx_v_fw);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_branch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_70classify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_tree, PyObject *__pyx_v_dataMissing) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("classify", 0);
  __pyx_cur_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2259, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "causalml/inference/tree/uplift.pyx":2277
 *         '''
 * 
 *         def classifyWithoutMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming without missing data.
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_1classifyWithoutMissingData, 0, __pyx_n_s_UpliftTreeClassifier_classify_lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_classifyWithoutMissingData = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2308
 *             return classifyWithoutMissingData(observations, branch)
 * 
 *         def classifyWithMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming with missing data.
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_3classifyWithMissingData, 0, __pyx_n_s_UpliftTreeClassifier_classify_lo_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_classifyWithMissingData = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2356
 * 
 *         # function body
 *         if dataMissing:             # <<<<<<<<<<<<<<
 *             return classifyWithMissingData(observations, tree)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_dataMissing); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2356, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "causalml/inference/tree/uplift.pyx":2357
 *         # function body
 *         if dataMissing:
 *             return classifyWithMissingData(observations, tree)             # <<<<<<<<<<<<<<
 *         else:
 *             return classifyWithoutMissingData(observations, tree)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_2classifyWithMissingData(__pyx_cur_scope->__pyx_v_classifyWithMissingData, __pyx_v_observations, __pyx_v_tree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":2356
 * 
 *         # function body
 *         if dataMissing:             # <<<<<<<<<<<<<<
 *             return classifyWithMissingData(observations, tree)
 *         else:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2359
 *             return classifyWithMissingData(observations, tree)
 *         else:
 *             return classifyWithoutMissingData(observations, tree)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_pf_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_8classify_classifyWithoutMissingData(__pyx_cur_scope->__pyx_v_classifyWithoutMissingData, __pyx_v_observations, __pyx_v_tree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftTreeClassifier.classify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2426
 *         A user-level results dataframe containing the estimated individual treatment effect.
 *     """
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  control_name,
 *                  n_estimators=10,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier___init__[] = "\n        Initialize the UpliftRandomForestClassifier class.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier___init__};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_control_name = 0;
  PyObject *__pyx_v_n_estimators = 0;
  PyObject *__pyx_v_max_features = 0;
  PyObject *__pyx_v_random_state = 0;
  PyObject *__pyx_v_max_depth = 0;
  PyObject *__pyx_v_min_samples_leaf = 0;
  PyObject *__pyx_v_min_samples_treatment = 0;
  PyObject *__pyx_v_n_reg = 0;
  PyObject *__pyx_v_early_stopping_eval_diff_scale = 0;
  PyObject *__pyx_v_evaluationFunction = 0;
  PyObject *__pyx_v_normalization = 0;
  PyObject *__pyx_v_honesty = 0;
  CYTHON_UNUSED PyObject *__pyx_v_estimation_sample_size = 0;
  PyObject *__pyx_v_n_jobs = 0;
  PyObject *__pyx_v_joblib_prefer = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_control_name,&__pyx_n_s_n_estimators,&__pyx_n_s_max_features,&__pyx_n_s_random_state,&__pyx_n_s_max_depth,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_min_samples_treatment,&__pyx_n_s_n_reg,&__pyx_n_s_early_stopping_eval_diff_scale,&__pyx_n_s_evaluationFunction,&__pyx_n_s_normalization,&__pyx_n_s_honesty,&__pyx_n_s_estimation_sample_size,&__pyx_n_s_n_jobs,&__pyx_n_s_joblib_prefer,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[3] = ((PyObject *)((PyObject *)__pyx_int_10));

    /* "causalml/inference/tree/uplift.pyx":2430
 *                  n_estimators=10,
 *                  max_features=10,
 *                  random_state=None,             # <<<<<<<<<<<<<<
 *                  max_depth=5,
 *                  min_samples_leaf=100,
 */
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)__pyx_int_5));
    values[6] = ((PyObject *)((PyObject *)__pyx_int_100));
    values[7] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[8] = ((PyObject *)((PyObject *)__pyx_int_10));
    values[9] = ((PyObject *)((PyObject *)__pyx_int_1));
    values[10] = ((PyObject *)((PyObject*)__pyx_n_u_KL));

    /* "causalml/inference/tree/uplift.pyx":2437
 *                  early_stopping_eval_diff_scale=1,
 *                  evaluationFunction='KL',
 *                  normalization=True,             # <<<<<<<<<<<<<<
 *                  honesty=False,
 *                  estimation_sample_size=0.5,
 */
    values[11] = ((PyObject *)((PyObject *)Py_True));

    /* "causalml/inference/tree/uplift.pyx":2438
 *                  evaluationFunction='KL',
 *                  normalization=True,
 *                  honesty=False,             # <<<<<<<<<<<<<<
 *                  estimation_sample_size=0.5,
 *                  n_jobs=-1,
 */
    values[12] = ((PyObject *)((PyObject *)Py_False));
    values[13] = ((PyObject *)((PyObject*)__pyx_float_0_5));
    values[14] = ((PyObject *)((PyObject *)__pyx_int_neg_1));
    values[15] = ((PyObject*)((PyObject*)__pyx_n_u_threads));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 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_control_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 16, 1); __PYX_ERR(0, 2426, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_estimators);
          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_max_features);
          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_random_state);
          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_max_depth);
          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_min_samples_leaf);
          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_min_samples_treatment);
          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_n_reg);
          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_early_stopping_eval_diff_scale);
          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_evaluationFunction);
          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_normalization);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_honesty);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_estimation_sample_size);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_jobs);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_joblib_prefer);
          if (value) { values[15] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2426, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_control_name = values[1];
    __pyx_v_n_estimators = values[2];
    __pyx_v_max_features = values[3];
    __pyx_v_random_state = values[4];
    __pyx_v_max_depth = values[5];
    __pyx_v_min_samples_leaf = values[6];
    __pyx_v_min_samples_treatment = values[7];
    __pyx_v_n_reg = values[8];
    __pyx_v_early_stopping_eval_diff_scale = values[9];
    __pyx_v_evaluationFunction = values[10];
    __pyx_v_normalization = values[11];
    __pyx_v_honesty = values[12];
    __pyx_v_estimation_sample_size = values[13];
    __pyx_v_n_jobs = values[14];
    __pyx_v_joblib_prefer = ((PyObject*)values[15]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2426, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_joblib_prefer), (&PyUnicode_Type), 1, "joblib_prefer", 1))) __PYX_ERR(0, 2441, __pyx_L1_error)
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier___init__(__pyx_self, __pyx_v_self, __pyx_v_control_name, __pyx_v_n_estimators, __pyx_v_max_features, __pyx_v_random_state, __pyx_v_max_depth, __pyx_v_min_samples_leaf, __pyx_v_min_samples_treatment, __pyx_v_n_reg, __pyx_v_early_stopping_eval_diff_scale, __pyx_v_evaluationFunction, __pyx_v_normalization, __pyx_v_honesty, __pyx_v_estimation_sample_size, __pyx_v_n_jobs, __pyx_v_joblib_prefer);

  /* "causalml/inference/tree/uplift.pyx":2426
 *         A user-level results dataframe containing the estimated individual treatment effect.
 *     """
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  control_name,
 *                  n_estimators=10,
 */

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_control_name, PyObject *__pyx_v_n_estimators, PyObject *__pyx_v_max_features, PyObject *__pyx_v_random_state, PyObject *__pyx_v_max_depth, PyObject *__pyx_v_min_samples_leaf, PyObject *__pyx_v_min_samples_treatment, PyObject *__pyx_v_n_reg, PyObject *__pyx_v_early_stopping_eval_diff_scale, PyObject *__pyx_v_evaluationFunction, PyObject *__pyx_v_normalization, PyObject *__pyx_v_honesty, CYTHON_UNUSED PyObject *__pyx_v_estimation_sample_size, PyObject *__pyx_v_n_jobs, PyObject *__pyx_v_joblib_prefer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_UCS4 __pyx_t_6;
  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("__init__", 0);

  /* "causalml/inference/tree/uplift.pyx":2446
 *         Initialize the UpliftRandomForestClassifier class.
 *         """
 *         self.n_estimators = n_estimators             # <<<<<<<<<<<<<<
 *         self.max_features = max_features
 *         self.random_state = random_state
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_estimators, __pyx_v_n_estimators) < 0) __PYX_ERR(0, 2446, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2447
 *         """
 *         self.n_estimators = n_estimators
 *         self.max_features = max_features             # <<<<<<<<<<<<<<
 *         self.random_state = random_state
 *         self.max_depth = max_depth
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_features, __pyx_v_max_features) < 0) __PYX_ERR(0, 2447, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2448
 *         self.n_estimators = n_estimators
 *         self.max_features = max_features
 *         self.random_state = random_state             # <<<<<<<<<<<<<<
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_random_state, __pyx_v_random_state) < 0) __PYX_ERR(0, 2448, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2449
 *         self.max_features = max_features
 *         self.random_state = random_state
 *         self.max_depth = max_depth             # <<<<<<<<<<<<<<
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_depth, __pyx_v_max_depth) < 0) __PYX_ERR(0, 2449, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2450
 *         self.random_state = random_state
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf             # <<<<<<<<<<<<<<
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_leaf, __pyx_v_min_samples_leaf) < 0) __PYX_ERR(0, 2450, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2451
 *         self.max_depth = max_depth
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment             # <<<<<<<<<<<<<<
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_samples_treatment, __pyx_v_min_samples_treatment) < 0) __PYX_ERR(0, 2451, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2452
 *         self.min_samples_leaf = min_samples_leaf
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg             # <<<<<<<<<<<<<<
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 *         self.evaluationFunction = evaluationFunction
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_reg, __pyx_v_n_reg) < 0) __PYX_ERR(0, 2452, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2453
 *         self.min_samples_treatment = min_samples_treatment
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale             # <<<<<<<<<<<<<<
 *         self.evaluationFunction = evaluationFunction
 *         self.control_name = control_name
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_v_early_stopping_eval_diff_scale) < 0) __PYX_ERR(0, 2453, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2454
 *         self.n_reg = n_reg
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 *         self.evaluationFunction = evaluationFunction             # <<<<<<<<<<<<<<
 *         self.control_name = control_name
 *         self.normalization = normalization
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_evaluationFunction, __pyx_v_evaluationFunction) < 0) __PYX_ERR(0, 2454, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2455
 *         self.early_stopping_eval_diff_scale = early_stopping_eval_diff_scale
 *         self.evaluationFunction = evaluationFunction
 *         self.control_name = control_name             # <<<<<<<<<<<<<<
 *         self.normalization = normalization
 *         self.honesty = honesty
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_name, __pyx_v_control_name) < 0) __PYX_ERR(0, 2455, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2456
 *         self.evaluationFunction = evaluationFunction
 *         self.control_name = control_name
 *         self.normalization = normalization             # <<<<<<<<<<<<<<
 *         self.honesty = honesty
 *         self.n_jobs = n_jobs
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_normalization, __pyx_v_normalization) < 0) __PYX_ERR(0, 2456, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2457
 *         self.control_name = control_name
 *         self.normalization = normalization
 *         self.honesty = honesty             # <<<<<<<<<<<<<<
 *         self.n_jobs = n_jobs
 *         self.joblib_prefer = joblib_prefer
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_honesty, __pyx_v_honesty) < 0) __PYX_ERR(0, 2457, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2458
 *         self.normalization = normalization
 *         self.honesty = honesty
 *         self.n_jobs = n_jobs             # <<<<<<<<<<<<<<
 *         self.joblib_prefer = joblib_prefer
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_jobs, __pyx_v_n_jobs) < 0) __PYX_ERR(0, 2458, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2459
 *         self.honesty = honesty
 *         self.n_jobs = n_jobs
 *         self.joblib_prefer = joblib_prefer             # <<<<<<<<<<<<<<
 * 
 *         assert control_name is not None and isinstance(control_name, str), \
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_joblib_prefer, __pyx_v_joblib_prefer) < 0) __PYX_ERR(0, 2459, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2461
 *         self.joblib_prefer = joblib_prefer
 * 
 *         assert control_name is not None and isinstance(control_name, str), \             # <<<<<<<<<<<<<<
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = (__pyx_v_control_name != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L3_bool_binop_done;
    }
    __pyx_t_3 = PyUnicode_Check(__pyx_v_control_name); 
    __pyx_t_2 = (__pyx_t_3 != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L3_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {

      /* "causalml/inference/tree/uplift.pyx":2462
 * 
 *         assert control_name is not None and isinstance(control_name, str), \
 *             f"control_group should be string but {control_name} is passed"             # <<<<<<<<<<<<<<
 *         self.control_name = control_name
 *         self.classes_ = [control_name]
 */
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_6 = 127;
      __Pyx_INCREF(__pyx_kp_u_control_group_should_be_string_b);
      __pyx_t_5 += 35;
      __Pyx_GIVEREF(__pyx_kp_u_control_group_should_be_string_b);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_control_group_should_be_string_b);
      __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_control_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
      __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_kp_u_is_passed);
      __pyx_t_5 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_is_passed);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_is_passed);
      __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 2461, __pyx_L1_error)
    }
  }
  #endif

  /* "causalml/inference/tree/uplift.pyx":2463
 *         assert control_name is not None and isinstance(control_name, str), \
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name             # <<<<<<<<<<<<<<
 *         self.classes_ = [control_name]
 *         self.n_class = 1
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control_name, __pyx_v_control_name) < 0) __PYX_ERR(0, 2463, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2464
 *             f"control_group should be string but {control_name} is passed"
 *         self.control_name = control_name
 *         self.classes_ = [control_name]             # <<<<<<<<<<<<<<
 *         self.n_class = 1
 * 
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_control_name);
  __Pyx_GIVEREF(__pyx_v_control_name);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_control_name);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_classes, __pyx_t_7) < 0) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":2465
 *         self.control_name = control_name
 *         self.classes_ = [control_name]
 *         self.n_class = 1             # <<<<<<<<<<<<<<
 * 
 *         if self.n_jobs == -1:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_class, __pyx_int_1) < 0) __PYX_ERR(0, 2465, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2467
 *         self.n_class = 1
 * 
 *         if self.n_jobs == -1:             # <<<<<<<<<<<<<<
 *             self.n_jobs = mp.cpu_count()
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_jobs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2467, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "causalml/inference/tree/uplift.pyx":2468
 * 
 *         if self.n_jobs == -1:
 *             self.n_jobs = mp.cpu_count()             # <<<<<<<<<<<<<<
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_mp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_jobs, __pyx_t_4) < 0) __PYX_ERR(0, 2468, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2467
 *         self.n_class = 1
 * 
 *         if self.n_jobs == -1:             # <<<<<<<<<<<<<<
 *             self.n_jobs = mp.cpu_count()
 * 
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2426
 *         A user-level results dataframe containing the estimated individual treatment effect.
 *     """
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  control_name,
 *                  n_estimators=10,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_2fit[] = "\n        Fit the UpliftRandomForestClassifier.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n\n        treatment : array-like, shape = [num_samples]\n            An array containing the treatment group for each unit.\n\n        y : array-like, shape = [num_samples]\n            An array containing the outcome of interest for each unit.\n\n        X_val : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to valid the uplift model.\n\n        treatment_val : array-like, shape = [num_samples]\n            An array containing the validation treatment group for each unit.\n\n        y_val : array-like, shape = [num_samples]\n            An array containing the validation outcome of interest for each unit.\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit = {"fit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_2fit};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_X_val = 0;
  PyObject *__pyx_v_treatment_val = 0;
  PyObject *__pyx_v_y_val = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_treatment,&__pyx_n_s_y,&__pyx_n_s_X_val,&__pyx_n_s_treatment_val,&__pyx_n_s_y_val,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((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  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_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 1); __PYX_ERR(0, 2470, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 2); __PYX_ERR(0, 2470, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, 3); __PYX_ERR(0, 2470, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_val);
          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_treatment_val);
          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_y_val);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit") < 0)) __PYX_ERR(0, 2470, __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);
        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_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_treatment = values[2];
    __pyx_v_y = values[3];
    __pyx_v_X_val = values[4];
    __pyx_v_treatment_val = values[5];
    __pyx_v_y_val = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fit", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2470, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.fit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_2fit(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_treatment, __pyx_v_y, __pyx_v_X_val, __pyx_v_treatment_val, __pyx_v_y_val);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "causalml/inference/tree/uplift.pyx":2521
 *         self.uplift_forest = (
 *             Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *             (delayed(self.bootstrap)(X, treatment, y, X_val, treatment_val, y_val, tree) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *         )
 * 
 */

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr(__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2521, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_UpliftRandomForestClassifier_fit, __pyx_n_s_causalml_inference_tree_uplift); if (unlikely(!gen)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.fit.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2521, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2521, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2521, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2521, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2521, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2521, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_tree);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_tree, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_delayed); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_bootstrap); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X)) { __Pyx_RaiseClosureNameError("X"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment)) { __Pyx_RaiseClosureNameError("treatment"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) { __Pyx_RaiseClosureNameError("y"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val)) { __Pyx_RaiseClosureNameError("X_val"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val)) { __Pyx_RaiseClosureNameError("treatment_val"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val)) { __Pyx_RaiseClosureNameError("y_val"); __PYX_ERR(0, 2521, __pyx_L1_error) }
    __pyx_t_6 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[8] = {__pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val, __pyx_cur_scope->__pyx_v_tree};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 7+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[8] = {__pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val, __pyx_cur_scope->__pyx_v_tree};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 7+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(7+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X_val);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_treatment_val);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val);
      PyTuple_SET_ITEM(__pyx_t_7, 5+__pyx_t_9, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y_val);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tree);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tree);
      PyTuple_SET_ITEM(__pyx_t_7, 6+__pyx_t_9, __pyx_cur_scope->__pyx_v_tree);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2521, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_2fit(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *__pyx_cur_scope;
  PyObject *__pyx_v_random_state = NULL;
  PyObject *__pyx_v_treatment_groups = NULL;
  PyObject *__pyx_v_tr = NULL;
  PyObject *__pyx_v_all_importances = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr2__pyx_v__ = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_x = NULL;
  PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_2generator = 0;
  PyObject *__pyx_8genexpr5__pyx_v_tree = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fit", 0);
  __pyx_cur_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2470, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_X = __pyx_v_X;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_X);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_X);
  __pyx_cur_scope->__pyx_v_treatment = __pyx_v_treatment;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_treatment);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_treatment);
  __pyx_cur_scope->__pyx_v_y = __pyx_v_y;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);
  __pyx_cur_scope->__pyx_v_X_val = __pyx_v_X_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_X_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_X_val);
  __pyx_cur_scope->__pyx_v_treatment_val = __pyx_v_treatment_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_treatment_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_treatment_val);
  __pyx_cur_scope->__pyx_v_y_val = __pyx_v_y_val;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y_val);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y_val);

  /* "causalml/inference/tree/uplift.pyx":2494
 *             An array containing the validation outcome of interest for each unit.
 *         """
 *         random_state = check_random_state(self.random_state)             # <<<<<<<<<<<<<<
 * 
 *         # Create forest
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_random_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_random_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_random_state = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2497
 * 
 *         # Create forest
 *         self.uplift_forest = [             # <<<<<<<<<<<<<<
 *             UpliftTreeClassifier(
 *                 max_features=self.max_features, max_depth=self.max_depth,
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2497, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "causalml/inference/tree/uplift.pyx":2509
 *                 honesty=self.honesty,
 *                 random_state=random_state.randint(MAX_INT))
 *             for _ in range(self.n_estimators)             # <<<<<<<<<<<<<<
 *         ]
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_estimators); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2509, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2509, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2509, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2509, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2509, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2509, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2509, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2509, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2509, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v__, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "causalml/inference/tree/uplift.pyx":2498
 *         # Create forest
 *         self.uplift_forest = [
 *             UpliftTreeClassifier(             # <<<<<<<<<<<<<<
 *                 max_features=self.max_features, max_depth=self.max_depth,
 *                 min_samples_leaf=self.min_samples_leaf,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_UpliftTreeClassifier); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2498, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "causalml/inference/tree/uplift.pyx":2499
 *         self.uplift_forest = [
 *             UpliftTreeClassifier(
 *                 max_features=self.max_features, max_depth=self.max_depth,             # <<<<<<<<<<<<<<
 *                 min_samples_leaf=self.min_samples_leaf,
 *                 min_samples_treatment=self.min_samples_treatment,
 */
      __pyx_t_4 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_max_features); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_max_features, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_max_depth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_max_depth, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2500
 *             UpliftTreeClassifier(
 *                 max_features=self.max_features, max_depth=self.max_depth,
 *                 min_samples_leaf=self.min_samples_leaf,             # <<<<<<<<<<<<<<
 *                 min_samples_treatment=self.min_samples_treatment,
 *                 n_reg=self.n_reg,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_min_samples_leaf); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2500, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_samples_leaf, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2501
 *                 max_features=self.max_features, max_depth=self.max_depth,
 *                 min_samples_leaf=self.min_samples_leaf,
 *                 min_samples_treatment=self.min_samples_treatment,             # <<<<<<<<<<<<<<
 *                 n_reg=self.n_reg,
 *                 early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_min_samples_treatment); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2501, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_samples_treatment, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2502
 *                 min_samples_leaf=self.min_samples_leaf,
 *                 min_samples_treatment=self.min_samples_treatment,
 *                 n_reg=self.n_reg,             # <<<<<<<<<<<<<<
 *                 early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *                 evaluationFunction=self.evaluationFunction,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_reg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2502, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_reg, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2503
 *                 min_samples_treatment=self.min_samples_treatment,
 *                 n_reg=self.n_reg,
 *                 early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,             # <<<<<<<<<<<<<<
 *                 evaluationFunction=self.evaluationFunction,
 *                 control_name=self.control_name,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_early_stopping_eval_diff_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2503, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2504
 *                 n_reg=self.n_reg,
 *                 early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *                 evaluationFunction=self.evaluationFunction,             # <<<<<<<<<<<<<<
 *                 control_name=self.control_name,
 *                 normalization=self.normalization,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_evaluationFunction); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2504, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_evaluationFunction, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2505
 *                 early_stopping_eval_diff_scale=self.early_stopping_eval_diff_scale,
 *                 evaluationFunction=self.evaluationFunction,
 *                 control_name=self.control_name,             # <<<<<<<<<<<<<<
 *                 normalization=self.normalization,
 *                 honesty=self.honesty,
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2505, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_control_name, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2506
 *                 evaluationFunction=self.evaluationFunction,
 *                 control_name=self.control_name,
 *                 normalization=self.normalization,             # <<<<<<<<<<<<<<
 *                 honesty=self.honesty,
 *                 random_state=random_state.randint(MAX_INT))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_normalization); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2506, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_normalization, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2507
 *                 control_name=self.control_name,
 *                 normalization=self.normalization,
 *                 honesty=self.honesty,             # <<<<<<<<<<<<<<
 *                 random_state=random_state.randint(MAX_INT))
 *             for _ in range(self.n_estimators)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_honesty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2507, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_honesty, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2508
 *                 normalization=self.normalization,
 *                 honesty=self.honesty,
 *                 random_state=random_state.randint(MAX_INT))             # <<<<<<<<<<<<<<
 *             for _ in range(self.n_estimators)
 *         ]
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2508, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_MAX_INT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2508, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2508, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_random_state, __pyx_t_7) < 0) __PYX_ERR(0, 2499, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2498
 *         # Create forest
 *         self.uplift_forest = [
 *             UpliftTreeClassifier(             # <<<<<<<<<<<<<<
 *                 max_features=self.max_features, max_depth=self.max_depth,
 *                 min_samples_leaf=self.min_samples_leaf,
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2498, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 2497, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "causalml/inference/tree/uplift.pyx":2509
 *                 honesty=self.honesty,
 *                 random_state=random_state.randint(MAX_INT))
 *             for _ in range(self.n_estimators)             # <<<<<<<<<<<<<<
 *         ]
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v__); __pyx_8genexpr2__pyx_v__ = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr2__pyx_v__); __pyx_8genexpr2__pyx_v__ = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */

  /* "causalml/inference/tree/uplift.pyx":2497
 * 
 *         # Create forest
 *         self.uplift_forest = [             # <<<<<<<<<<<<<<
 *             UpliftTreeClassifier(
 *                 max_features=self.max_features, max_depth=self.max_depth,
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest, __pyx_t_1) < 0) __PYX_ERR(0, 2497, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2513
 * 
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])             # <<<<<<<<<<<<<<
 *         self.classes_ = [self.control_name]
 *         for tr in treatment_groups:
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2513, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySet_New(__pyx_cur_scope->__pyx_v_treatment); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2513, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2513, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __pyx_t_4; __Pyx_INCREF(__pyx_t_7); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_7)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2513, __pyx_L11_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2513, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_x, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2513, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_8genexpr3__pyx_v_x, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2513, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2513, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_11) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr3__pyx_v_x))) __PYX_ERR(0, 2513, __pyx_L11_error)
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x); __pyx_8genexpr3__pyx_v_x = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x); __pyx_8genexpr3__pyx_v_x = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_t_1 = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_12 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 2513, __pyx_L1_error)
  __pyx_v_treatment_groups = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2514
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])
 *         self.classes_ = [self.control_name]             # <<<<<<<<<<<<<<
 *         for tr in treatment_groups:
 *             self.classes_.append(tr)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes, __pyx_t_2) < 0) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2515
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])
 *         self.classes_ = [self.control_name]
 *         for tr in treatment_groups:             # <<<<<<<<<<<<<<
 *             self.classes_.append(tr)
 *         self.n_class = len(self.classes_)
 */
  if (unlikely(__pyx_v_treatment_groups == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 2515, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_treatment_groups; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2515, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_tr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":2516
 *         self.classes_ = [self.control_name]
 *         for tr in treatment_groups:
 *             self.classes_.append(tr)             # <<<<<<<<<<<<<<
 *         self.n_class = len(self.classes_)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_tr); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 2516, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":2515
 *         treatment_groups = sorted([x for x in list(set(treatment)) if x != self.control_name])
 *         self.classes_ = [self.control_name]
 *         for tr in treatment_groups:             # <<<<<<<<<<<<<<
 *             self.classes_.append(tr)
 *         self.n_class = len(self.classes_)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2517
 *         for tr in treatment_groups:
 *             self.classes_.append(tr)
 *         self.n_class = len(self.classes_)             # <<<<<<<<<<<<<<
 * 
 *         self.uplift_forest = (
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2517, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_class, __pyx_t_2) < 0) __PYX_ERR(0, 2517, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2520
 * 
 *         self.uplift_forest = (
 *             Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)             # <<<<<<<<<<<<<<
 *             (delayed(self.bootstrap)(X, treatment, y, X_val, treatment_val, y_val, tree) for tree in self.uplift_forest)
 *         )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Parallel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_jobs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_n_jobs, __pyx_t_3) < 0) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_joblib_prefer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_prefer, __pyx_t_3) < 0) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":2521
 *         self.uplift_forest = (
 *             Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *             (delayed(self.bootstrap)(X, treatment, y, X_val, treatment_val, y_val, tree) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_7 = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2519
 *         self.n_class = len(self.classes_)
 * 
 *         self.uplift_forest = (             # <<<<<<<<<<<<<<
 *             Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *             (delayed(self.bootstrap)(X, treatment, y, X_val, treatment_val, y_val, tree) for tree in self.uplift_forest)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest, __pyx_t_2) < 0) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2524
 *         )
 * 
 *         all_importances = [tree.feature_importances_ for tree in self.uplift_forest]             # <<<<<<<<<<<<<<
 *         self.feature_importances_ = np.mean(all_importances, axis=0)
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1
 */
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2524, __pyx_L20_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __pyx_L20_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_7 = __pyx_t_3; __Pyx_INCREF(__pyx_t_7); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2524, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2524, __pyx_L20_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2524, __pyx_L20_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2524, __pyx_L20_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __pyx_L20_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_7);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2524, __pyx_L20_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_tree, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_tree, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2524, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 2524, __pyx_L20_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_tree); __pyx_8genexpr5__pyx_v_tree = 0;
    goto __pyx_L23_exit_scope;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_tree); __pyx_8genexpr5__pyx_v_tree = 0;
    goto __pyx_L1_error;
    __pyx_L23_exit_scope:;
  } /* exit inner scope */
  __pyx_v_all_importances = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2525
 * 
 *         all_importances = [tree.feature_importances_ for tree in self.uplift_forest]
 *         self.feature_importances_ = np.mean(all_importances, axis=0)             # <<<<<<<<<<<<<<
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mean); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_all_importances);
  __Pyx_GIVEREF(__pyx_v_all_importances);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_all_importances);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 2525, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_feature_importances, __pyx_t_1) < 0) __PYX_ERR(0, 2525, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2526
 *         all_importances = [tree.feature_importances_ for tree in self.uplift_forest]
 *         self.feature_importances_ = np.mean(all_importances, axis=0)
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_feature_importances); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_feature_importances, __pyx_t_7) < 0) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.fit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_random_state);
  __Pyx_XDECREF(__pyx_v_treatment_groups);
  __Pyx_XDECREF(__pyx_v_tr);
  __Pyx_XDECREF(__pyx_v_all_importances);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v__);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_x);
  __Pyx_XDECREF(__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit_2generator);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_tree);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2529
 * 
 *     @staticmethod
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):             # <<<<<<<<<<<<<<
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_5bootstrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_5bootstrap = {"bootstrap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_5bootstrap, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_5bootstrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_treatment = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_X_val = 0;
  PyObject *__pyx_v_treatment_val = 0;
  PyObject *__pyx_v_y_val = 0;
  PyObject *__pyx_v_tree = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bootstrap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_treatment,&__pyx_n_s_y,&__pyx_n_s_X_val,&__pyx_n_s_treatment_val,&__pyx_n_s_y_val,&__pyx_n_s_tree,0};
    PyObject* values[7] = {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  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 1); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 2); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 3); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treatment_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 4); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_val)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 5); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, 6); __PYX_ERR(0, 2529, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bootstrap") < 0)) __PYX_ERR(0, 2529, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_X = values[0];
    __pyx_v_treatment = values[1];
    __pyx_v_y = values[2];
    __pyx_v_X_val = values[3];
    __pyx_v_treatment_val = values[4];
    __pyx_v_y_val = values[5];
    __pyx_v_tree = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bootstrap", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.bootstrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_4bootstrap(__pyx_self, __pyx_v_X, __pyx_v_treatment, __pyx_v_y, __pyx_v_X_val, __pyx_v_treatment_val, __pyx_v_y_val, __pyx_v_tree);

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

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_4bootstrap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_treatment, PyObject *__pyx_v_y, PyObject *__pyx_v_X_val, PyObject *__pyx_v_treatment_val, PyObject *__pyx_v_y_val, PyObject *__pyx_v_tree) {
  PyObject *__pyx_v_random_state = NULL;
  PyObject *__pyx_v_bt_index = NULL;
  PyObject *__pyx_v_x_train_bt = NULL;
  PyObject *__pyx_v_y_train_bt = NULL;
  PyObject *__pyx_v_treatment_train_bt = NULL;
  PyObject *__pyx_v_bt_val_index = NULL;
  PyObject *__pyx_v_x_val_bt = NULL;
  PyObject *__pyx_v_y_val_bt = NULL;
  PyObject *__pyx_v_treatment_val_bt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bootstrap", 0);

  /* "causalml/inference/tree/uplift.pyx":2530
 *     @staticmethod
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):
 *         random_state = check_random_state(tree.random_state)             # <<<<<<<<<<<<<<
 *         bt_index = random_state.choice(len(X), len(X))
 *         x_train_bt = X[bt_index]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_random_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_random_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_random_state = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2531
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))             # <<<<<<<<<<<<<<
 *         x_train_bt = X[bt_index]
 *         y_train_bt = y[bt_index]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_choice); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2531, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_v_X); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2531, __pyx_L1_error)
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2531, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_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_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2531, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bt_index = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2532
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))
 *         x_train_bt = X[bt_index]             # <<<<<<<<<<<<<<
 *         y_train_bt = y[bt_index]
 *         treatment_train_bt = treatment[bt_index]
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_X, __pyx_v_bt_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x_train_bt = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2533
 *         bt_index = random_state.choice(len(X), len(X))
 *         x_train_bt = X[bt_index]
 *         y_train_bt = y[bt_index]             # <<<<<<<<<<<<<<
 *         treatment_train_bt = treatment[bt_index]
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_y, __pyx_v_bt_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_y_train_bt = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2534
 *         x_train_bt = X[bt_index]
 *         y_train_bt = y[bt_index]
 *         treatment_train_bt = treatment[bt_index]             # <<<<<<<<<<<<<<
 * 
 *         if X_val is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_treatment, __pyx_v_bt_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_treatment_train_bt = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2536
 *         treatment_train_bt = treatment[bt_index]
 * 
 *         if X_val is None:             # <<<<<<<<<<<<<<
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt)
 *         else:
 */
  __pyx_t_9 = (__pyx_v_X_val == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "causalml/inference/tree/uplift.pyx":2537
 * 
 *         if X_val is None:
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt)             # <<<<<<<<<<<<<<
 *         else:
 *             bt_val_index = random_state.choice(len(X_val), len(X_val))
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_fit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_X, __pyx_v_x_train_bt) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_treatment, __pyx_v_treatment_train_bt) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_y, __pyx_v_y_train_bt) < 0) __PYX_ERR(0, 2537, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "causalml/inference/tree/uplift.pyx":2536
 *         treatment_train_bt = treatment[bt_index]
 * 
 *         if X_val is None:             # <<<<<<<<<<<<<<
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":2539
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt)
 *         else:
 *             bt_val_index = random_state.choice(len(X_val), len(X_val))             # <<<<<<<<<<<<<<
 *             x_val_bt = X_val[bt_val_index]
 *             y_val_bt = y_val[bt_val_index]
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_choice); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Length(__pyx_v_X_val); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2539, __pyx_L1_error)
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_v_X_val); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2539, __pyx_L1_error)
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_7 = 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_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_4};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_4};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_bt_val_index = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "causalml/inference/tree/uplift.pyx":2540
 *         else:
 *             bt_val_index = random_state.choice(len(X_val), len(X_val))
 *             x_val_bt = X_val[bt_val_index]             # <<<<<<<<<<<<<<
 *             y_val_bt = y_val[bt_val_index]
 *             treatment_val_bt = treatment_val[bt_val_index]
 */
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_X_val, __pyx_v_bt_val_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_x_val_bt = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "causalml/inference/tree/uplift.pyx":2541
 *             bt_val_index = random_state.choice(len(X_val), len(X_val))
 *             x_val_bt = X_val[bt_val_index]
 *             y_val_bt = y_val[bt_val_index]             # <<<<<<<<<<<<<<
 *             treatment_val_bt = treatment_val[bt_val_index]
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_y_val, __pyx_v_bt_val_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_y_val_bt = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "causalml/inference/tree/uplift.pyx":2542
 *             x_val_bt = X_val[bt_val_index]
 *             y_val_bt = y_val[bt_val_index]
 *             treatment_val_bt = treatment_val[bt_val_index]             # <<<<<<<<<<<<<<
 * 
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt, X_val=x_val_bt, treatment_val=treatment_val_bt, y_val=y_val_bt)
 */
    __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_treatment_val, __pyx_v_bt_val_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_treatment_val_bt = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "causalml/inference/tree/uplift.pyx":2544
 *             treatment_val_bt = treatment_val[bt_val_index]
 * 
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt, X_val=x_val_bt, treatment_val=treatment_val_bt, y_val=y_val_bt)             # <<<<<<<<<<<<<<
 *         return tree
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tree, __pyx_n_s_fit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_X, __pyx_v_x_train_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_treatment, __pyx_v_treatment_train_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_y, __pyx_v_y_train_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_X_val, __pyx_v_x_val_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_treatment_val, __pyx_v_treatment_val_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_y_val, __pyx_v_y_val_bt) < 0) __PYX_ERR(0, 2544, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":2545
 * 
 *             tree.fit(X=x_train_bt, treatment=treatment_train_bt, y=y_train_bt, X_val=x_val_bt, treatment_val=treatment_val_bt, y_val=y_val_bt)
 *         return tree             # <<<<<<<<<<<<<<
 * 
 *     @ignore_warnings(category=FutureWarning)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_tree);
  __pyx_r = __pyx_v_tree;
  goto __pyx_L0;

  /* "causalml/inference/tree/uplift.pyx":2529
 * 
 *     @staticmethod
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):             # <<<<<<<<<<<<<<
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.bootstrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_random_state);
  __Pyx_XDECREF(__pyx_v_bt_index);
  __Pyx_XDECREF(__pyx_v_x_train_bt);
  __Pyx_XDECREF(__pyx_v_y_train_bt);
  __Pyx_XDECREF(__pyx_v_treatment_train_bt);
  __Pyx_XDECREF(__pyx_v_bt_val_index);
  __Pyx_XDECREF(__pyx_v_x_val_bt);
  __Pyx_XDECREF(__pyx_v_y_val_bt);
  __Pyx_XDECREF(__pyx_v_treatment_val_bt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */

/* Python wrapper */
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_6predict[] = "\n        Returns the recommended treatment group and predicted optimal\n        probability conditional on using the recommended treatment group.\n\n        Args\n        ----\n        X : ndarray, shape = [num_samples, num_features]\n            An ndarray of the covariates used to train the uplift model.\n\n        full_output : bool, optional (default=False)\n            Whether the UpliftTree algorithm returns upliftScores, pred_nodes\n            alongside the recommended treatment group and p_hat in the treatment group.\n\n        Returns\n        -------\n        y_pred_list : ndarray, shape = (num_samples, num_treatments])\n            An ndarray containing the predicted treatment effect of each treatment group for each sample\n\n        df_res : DataFrame, shape = [num_samples, (num_treatments * 2 + 3)]\n            If `full_output` is `True`, a DataFrame containing the predicted outcome of each treatment and\n            control group, the treatment effect of each treatment group, the treatment group with the\n            highest treatment effect, and the maximum treatment effect for each sample.\n\n        ";
static PyMethodDef __pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict = {"predict", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_6predict};
static PyObject *__pyx_pw_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_full_output = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("predict (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_X,&__pyx_n_s_full_output,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("predict", 0, 2, 3, 1); __PYX_ERR(0, 2548, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_full_output);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict") < 0)) __PYX_ERR(0, 2548, __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_self = values[0];
    __pyx_v_X = values[1];
    __pyx_v_full_output = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("predict", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2548, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.predict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_6predict(__pyx_self, __pyx_v_self, __pyx_v_X, __pyx_v_full_output);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "causalml/inference/tree/uplift.pyx":2578
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *             ) / len(self.uplift_forest)
 *         else:
 */

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr(__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2578, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_UpliftRandomForestClassifier_pre, __pyx_n_s_causalml_inference_tree_uplift); if (unlikely(!gen)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.predict.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2578, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 2578, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2578, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2578, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2578, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2578, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_tree);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_tree, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_delayed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_tree, __pyx_n_s_predict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_X)) { __Pyx_RaiseClosureNameError("X"); __PYX_ERR(0, 2578, __pyx_L1_error) }
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_X, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_X) < 0) __PYX_ERR(0, 2578, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2578, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */

static PyObject *__pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_6predict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_full_output) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *__pyx_cur_scope;
  PyObject *__pyx_v_y_pred_ensemble = NULL;
  PyObject *__pyx_v_df_res = NULL;
  PyObject *__pyx_v_delta_cols = NULL;
  PyObject *__pyx_v_i_tr = NULL;
  PyObject *__pyx_v_treatment_group = NULL;
  PyObject *__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_2generator1 = 0;
  PyObject *__pyx_8genexpr7__pyx_v_tree = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_treatment_group = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("predict", 0);
  __pyx_cur_scope = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(__pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2548, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_X = __pyx_v_X;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_X);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_X);

  /* "causalml/inference/tree/uplift.pyx":2575
 *         # Make predictions with all trees and take the average
 * 
 *         if self.n_jobs != 1:             # <<<<<<<<<<<<<<
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_jobs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2575, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":2577
 *         if self.n_jobs != 1:
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)             # <<<<<<<<<<<<<<
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)
 *             ) / len(self.uplift_forest)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Parallel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_jobs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_n_jobs, __pyx_t_5) < 0) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_joblib_prefer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_prefer, __pyx_t_5) < 0) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2578
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)             # <<<<<<<<<<<<<<
 *             ) / len(self.uplift_forest)
 *         else:
 */
    __pyx_t_4 = __pyx_pf_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "causalml/inference/tree/uplift.pyx":2576
 * 
 *         if self.n_jobs != 1:
 *             y_pred_ensemble = sum(             # <<<<<<<<<<<<<<
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)
 */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "causalml/inference/tree/uplift.pyx":2579
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 *                 (delayed(tree.predict)(X=X) for tree in self.uplift_forest)
 *             ) / len(self.uplift_forest)             # <<<<<<<<<<<<<<
 *         else:
 *             y_pred_ensemble = sum([tree.predict(X=X) for tree in self.uplift_forest]) / len(self.uplift_forest)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2579, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_y_pred_ensemble = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2575
 *         # Make predictions with all trees and take the average
 * 
 *         if self.n_jobs != 1:             # <<<<<<<<<<<<<<
 *             y_pred_ensemble = sum(
 *                 Parallel(n_jobs=self.n_jobs, prefer=self.joblib_prefer)
 */
    goto __pyx_L3;
  }

  /* "causalml/inference/tree/uplift.pyx":2581
 *             ) / len(self.uplift_forest)
 *         else:
 *             y_pred_ensemble = sum([tree.predict(X=X) for tree in self.uplift_forest]) / len(self.uplift_forest)             # <<<<<<<<<<<<<<
 * 
 *         # Summarize results into dataframe
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2581, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2581, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2581, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2581, __pyx_L6_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2581, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2581, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2581, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2581, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_7(__pyx_t_5);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2581, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_tree, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr7__pyx_v_tree, __pyx_n_s_predict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2581, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2581, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_X, __pyx_cur_scope->__pyx_v_X) < 0) __PYX_ERR(0, 2581, __pyx_L6_error)
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2581, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 2581, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_tree); __pyx_8genexpr7__pyx_v_tree = 0;
      goto __pyx_L9_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_tree); __pyx_8genexpr7__pyx_v_tree = 0;
      goto __pyx_L1_error;
      __pyx_L9_exit_scope:;
    } /* exit inner scope */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_uplift_forest); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y_pred_ensemble = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_L3:;

  /* "causalml/inference/tree/uplift.pyx":2584
 * 
 *         # Summarize results into dataframe
 *         df_res = pd.DataFrame(y_pred_ensemble, columns=self.classes_)             # <<<<<<<<<<<<<<
 *         df_res['recommended_treatment'] = df_res.apply(np.argmax, axis=1)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_v_y_pred_ensemble);
  __Pyx_GIVEREF(__pyx_v_y_pred_ensemble);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_y_pred_ensemble);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_columns, __pyx_t_1) < 0) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_df_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2585
 *         # Summarize results into dataframe
 *         df_res = pd.DataFrame(y_pred_ensemble, columns=self.classes_)
 *         df_res['recommended_treatment'] = df_res.apply(np.argmax, axis=1)             # <<<<<<<<<<<<<<
 * 
 *         # Calculate delta
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df_res, __pyx_n_s_apply); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_argmax); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 2585, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_df_res, __pyx_n_u_recommended_treatment, __pyx_t_4) < 0)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2588
 * 
 *         # Calculate delta
 *         delta_cols = [f'delta_{treatment_group}' for treatment_group in self.classes_[1:]]             # <<<<<<<<<<<<<<
 *         for i_tr in range(1, self.n_class):
 *             treatment_group = self.classes_[i_tr]
 */
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2588, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2588, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_8, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2588, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_8 = __pyx_t_5; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2588, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2588, __pyx_L12_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2588, __pyx_L12_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2588, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2588, __pyx_L12_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2588, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_8);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2588, __pyx_L12_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_treatment_group, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_8genexpr8__pyx_v_treatment_group, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2588, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_n_u_delta, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2588, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 2588, __pyx_L12_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_treatment_group); __pyx_8genexpr8__pyx_v_treatment_group = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_treatment_group); __pyx_8genexpr8__pyx_v_treatment_group = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_v_delta_cols = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "causalml/inference/tree/uplift.pyx":2589
 *         # Calculate delta
 *         delta_cols = [f'delta_{treatment_group}' for treatment_group in self.classes_[1:]]
 *         for i_tr in range(1, self.n_class):             # <<<<<<<<<<<<<<
 *             treatment_group = self.classes_[i_tr]
 *             df_res[f'delta_{treatment_group}'] = df_res[treatment_group] - df_res[self.control_name]
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_n_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2589, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_8))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2589, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2589, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2589, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2589, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_7(__pyx_t_8);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2589, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_i_tr, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2590
 *         delta_cols = [f'delta_{treatment_group}' for treatment_group in self.classes_[1:]]
 *         for i_tr in range(1, self.n_class):
 *             treatment_group = self.classes_[i_tr]             # <<<<<<<<<<<<<<
 *             df_res[f'delta_{treatment_group}'] = df_res[treatment_group] - df_res[self.control_name]
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_classes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_i_tr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_treatment_group, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "causalml/inference/tree/uplift.pyx":2591
 *         for i_tr in range(1, self.n_class):
 *             treatment_group = self.classes_[i_tr]
 *             df_res[f'delta_{treatment_group}'] = df_res[treatment_group] - df_res[self.control_name]             # <<<<<<<<<<<<<<
 * 
 *         df_res['max_delta'] = df_res[delta_cols].max(axis=1)
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_df_res, __pyx_v_treatment_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_control_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_df_res, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_treatment_group, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_n_u_delta, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_df_res, __pyx_t_1, __pyx_t_4) < 0)) __PYX_ERR(0, 2591, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "causalml/inference/tree/uplift.pyx":2589
 *         # Calculate delta
 *         delta_cols = [f'delta_{treatment_group}' for treatment_group in self.classes_[1:]]
 *         for i_tr in range(1, self.n_class):             # <<<<<<<<<<<<<<
 *             treatment_group = self.classes_[i_tr]
 *             df_res[f'delta_{treatment_group}'] = df_res[treatment_group] - df_res[self.control_name]
 */
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "causalml/inference/tree/uplift.pyx":2593
 *             df_res[f'delta_{treatment_group}'] = df_res[treatment_group] - df_res[self.control_name]
 * 
 *         df_res['max_delta'] = df_res[delta_cols].max(axis=1)             # <<<<<<<<<<<<<<
 * 
 *         if full_output:
 */
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_df_res, __pyx_v_delta_cols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 2593, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(PyObject_SetItem(__pyx_v_df_res, __pyx_n_u_max_delta, __pyx_t_1) < 0)) __PYX_ERR(0, 2593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2595
 *         df_res['max_delta'] = df_res[delta_cols].max(axis=1)
 * 
 *         if full_output:             # <<<<<<<<<<<<<<
 *             return df_res
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_full_output); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2595, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "causalml/inference/tree/uplift.pyx":2596
 * 
 *         if full_output:
 *             return df_res             # <<<<<<<<<<<<<<
 *         else:
 *             return df_res[delta_cols].values
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_df_res);
    __pyx_r = __pyx_v_df_res;
    goto __pyx_L0;

    /* "causalml/inference/tree/uplift.pyx":2595
 *         df_res['max_delta'] = df_res[delta_cols].max(axis=1)
 * 
 *         if full_output:             # <<<<<<<<<<<<<<
 *             return df_res
 *         else:
 */
  }

  /* "causalml/inference/tree/uplift.pyx":2598
 *             return df_res
 *         else:
 *             return df_res[delta_cols].values             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_df_res, __pyx_v_delta_cols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("causalml.inference.tree.uplift.UpliftRandomForestClassifier.predict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y_pred_ensemble);
  __Pyx_XDECREF(__pyx_v_df_res);
  __Pyx_XDECREF(__pyx_v_delta_cols);
  __Pyx_XDECREF(__pyx_v_i_tr);
  __Pyx_XDECREF(__pyx_v_treatment_group);
  __Pyx_XDECREF(__pyx_gb_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict_2generator1);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_tree);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_treatment_group);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":734
 * 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":735
 * 
 * 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(1, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":734
 * 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":737
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":738
 * 
 * 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(1, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":737
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":740
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":741
 * 
 * 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(1, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":740
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":743
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":744
 * 
 * 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(1, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":743
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":746
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":747
 * 
 * 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(1, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":746
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":749
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":750
 * 
 * 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) {

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":751
 * 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;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":750
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":753
 *         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;
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":749
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":928
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":929
 * 
 * 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/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)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":928
 *     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();
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":932
 *     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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":933
 * 
 * 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":934
 * 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) {

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":935
 *     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;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":934
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":936
 *     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;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":932
 *     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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":940
 * # 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":941
 * # 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:*/ {

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":942
 * 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(1, 942, __pyx_L3_error)

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":941
 * # 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:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":943
 *     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(1, 943, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":944
 *         __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__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __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(1, 944, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":941
 * # 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:;
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":940
 * # 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":946
 *         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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":947
 * 
 * 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:*/ {

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":948
 * 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(1, 948, __pyx_L3_error)

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":947
 * 
 * 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:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":949
 *     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(1, 949, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":950
 *         _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__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __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(1, 950, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":947
 * 
 * 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:;
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":946
 *         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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":952
 *         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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":953
 * 
 * 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:*/ {

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":954
 * 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(1, 954, __pyx_L3_error)

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":953
 * 
 * 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:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":955
 *     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(1, 955, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":956
 *         _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__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __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(1, 956, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":953
 * 
 * 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:;
  }

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":952
 *         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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":966
 * 
 * 
 * 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":978
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":966
 * 
 * 
 * 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":981
 * 
 * 
 * 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);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":993
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":981
 * 
 * 
 * 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":996
 * 
 * 
 * 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;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1003
 *     also needed.  That can be found using `get_datetime64_unit`.
 *     """
 *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":996
 * 
 * 
 * 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1006
 * 
 * 
 * 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;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1010
 *     returns the int64 value underlying scalar numpy timedelta64 object
 *     """
 *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1006
 * 
 * 
 * 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;
}

/* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1013
 * 
 * 
 * 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;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1017
 *     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;

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":1013
 * 
 * 
 * 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;
}

/* "View.MemoryView":123
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  int __pyx_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_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_c);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error)
    } else {

      /* "View.MemoryView":124
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
 */
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error)
  }
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);

  /* "View.MemoryView":123
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

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

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject **__pyx_v_p;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":130
 *         cdef PyObject **p
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
 */
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 130, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

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

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

    /* "View.MemoryView":134
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 134, __pyx_L1_error)

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

  /* "View.MemoryView":136
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":137
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 137, __pyx_L1_error)

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

  /* "View.MemoryView":139
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":140
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":139
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  }

  /* "View.MemoryView":141
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error)
  __pyx_t_3 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":142
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(2, 142, __pyx_L1_error)
  }
  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_7;

  /* "View.MemoryView":145
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
 */
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":146
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
 */
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":148
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "View.MemoryView":149
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 149, __pyx_L1_error)

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

  /* "View.MemoryView":152
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  __pyx_t_8 = 0;
  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_9;
    __pyx_v_idx = __pyx_t_8;
    __pyx_t_8 = (__pyx_t_8 + 1);

    /* "View.MemoryView":153
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":154
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(2, 154, __pyx_L1_error)

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

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

    /* "View.MemoryView":152
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":158
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error)
  if (__pyx_t_4) {

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

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

    /* "View.MemoryView":158
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":161
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error)
  if (likely(__pyx_t_4)) {

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

    /* "View.MemoryView":163
 *         elif mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 */
    __Pyx_INCREF(__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_c;

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

  /* "View.MemoryView":165
 *             self.mode = u'c'
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(2, 165, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "View.MemoryView":167
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
 *                                              itemsize, self.ndim, order)
 * 
 */
  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);

  /* "View.MemoryView":170
 *                                              itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:
 */
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

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

  /* "View.MemoryView":172
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":175
 * 
 * 
 *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")
 */
    __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

    /* "View.MemoryView":176
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":177
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(2, 177, __pyx_L1_error)

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

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

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

      /* "View.MemoryView":181
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)
 */
      if (unlikely(__pyx_v_itemsize == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(2, 181, __pyx_L1_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(2, 181, __pyx_L1_error)
      }
      __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
      __pyx_t_9 = __pyx_t_1;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

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

        /* "View.MemoryView":183
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
        Py_INCREF(Py_None);
      }

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

    /* "View.MemoryView":172
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":123
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":186
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":187
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":188
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":189
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
    __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":188
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":190
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":191
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 */
    __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":190
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":192
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":193
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 193, __pyx_L1_error)

    /* "View.MemoryView":192
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  }

  /* "View.MemoryView":194
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 *         info.ndim = self.ndim
 */
  __pyx_t_4 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":195
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 */
  __pyx_t_5 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_5;

  /* "View.MemoryView":196
 *         info.buf = self.data
 *         info.len = self.len
 *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *         info.shape = self._shape
 *         info.strides = self._strides
 */
  __pyx_t_6 = __pyx_v_self->ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":197
 *         info.len = self.len
 *         info.ndim = self.ndim
 *         info.shape = self._shape             # <<<<<<<<<<<<<<
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 */
  __pyx_t_7 = __pyx_v_self->_shape;
  __pyx_v_info->shape = __pyx_t_7;

  /* "View.MemoryView":198
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 *         info.strides = self._strides             # <<<<<<<<<<<<<<
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 */
  __pyx_t_7 = __pyx_v_self->_strides;
  __pyx_v_info->strides = __pyx_t_7;

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

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

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

  /* "View.MemoryView":203
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":204
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_4 = __pyx_v_self->format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":203
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":206
 *             info.format = self.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.obj = self
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":208
 *             info.format = NULL
 * 
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":186
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":212
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

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

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

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

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

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

  /* "View.MemoryView":215
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  __pyx_t_1 = (__pyx_v_self->free_data != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":216
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":217
 *         elif self.free_data:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":216
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    }

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

    /* "View.MemoryView":215
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  }
  __pyx_L3:;

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

  /* "View.MemoryView":212
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

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

/* "View.MemoryView":223
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":224
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":223
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

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

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

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":228
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 */
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":229
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

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

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

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

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

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

/* "View.MemoryView":234
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

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

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":235
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":234
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

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

/* "View.MemoryView":237
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":238
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":237
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

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

/* "View.MemoryView":240
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

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

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":241
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":240
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 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(2, 2, __pyx_L1_error)

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

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 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(2, 4, __pyx_L1_error)

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

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

/* "View.MemoryView":245
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":249
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":250
 * 
 *     if buf == NULL:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":249
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":252
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
  /*else*/ {
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;

    /* "View.MemoryView":253
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error)

    /* "View.MemoryView":252
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
    __pyx_t_5 = 0;

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

  /* "View.MemoryView":256
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":245
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

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

/* "View.MemoryView":282
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

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

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":283
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":282
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

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

/* "View.MemoryView":284
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

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

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":285
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":284
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

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

    /* "(tree fragment)":13
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":299
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  Py_intptr_t __pyx_v_aligned_p;
  size_t __pyx_v_offset;
  void *__pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":301
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
 *     cdef size_t offset
 * 
 */
  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);

  /* "View.MemoryView":305
 * 
 *     with cython.cdivision(True):
 *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
 * 
 *     if offset > 0:
 */
  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);

  /* "View.MemoryView":307
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":308
 * 
 *     if offset > 0:
 *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
 * 
 *     return <void *> aligned_p
 */
    __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));

    /* "View.MemoryView":307
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  }

  /* "View.MemoryView":310
 *         aligned_p += alignment - offset
 * 
 *     return <void *> aligned_p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((void *)__pyx_v_aligned_p);
  goto __pyx_L0;

  /* "View.MemoryView":299
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

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

/* "View.MemoryView":346
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  int __pyx_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_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":347
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 */
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":348
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 */
  __pyx_v_self->flags = __pyx_v_flags;

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

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

    /* "View.MemoryView":351
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":352
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
 */
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":353
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 */
      Py_INCREF(Py_None);

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

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

  /* "View.MemoryView":355
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 */
  __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":357
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 */
    __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":358
 *             global __pyx_memoryview_thread_locks_used
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
 */
      __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

      /* "View.MemoryView":359
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 */
      __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

      /* "View.MemoryView":357
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():
 *             global __pyx_memoryview_thread_locks_used
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 */
    }

    /* "View.MemoryView":360
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
 */
    __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":361
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *                 if self.lock is NULL:
 *                     raise MemoryError
 */
      __pyx_v_self->lock = PyThread_allocate_lock();

      /* "View.MemoryView":362
 *             if self.lock is NULL:
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
      __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
      if (unlikely(__pyx_t_1)) {

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

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

      /* "View.MemoryView":360
 *                 self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *                 __pyx_memoryview_thread_locks_used += 1
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 self.lock = PyThread_allocate_lock()
 *                 if self.lock is NULL:
 */
    }

    /* "View.MemoryView":355
 *                 Py_INCREF(Py_None)
 * 
 *         if not __PYX_CYTHON_ATOMICS_ENABLED():             # <<<<<<<<<<<<<<
 *             global __pyx_memoryview_thread_locks_used
 *             if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 */
  }

  /* "View.MemoryView":365
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":366
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
 */
    __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L12_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":365
 *                     raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
    goto __pyx_L11;
  }

  /* "View.MemoryView":368
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 */
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L11:;

  /* "View.MemoryView":370
 *             self.dtype_is_object = dtype_is_object
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL
 */
  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));

  /* "View.MemoryView":372
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
 */
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":346
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

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

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

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyThread_type_lock __pyx_t_6;
  PyThread_type_lock __pyx_t_7;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

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

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

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

  /* "View.MemoryView":377
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
 * 
 *             (<__pyx_buffer *> &self.view).obj = NULL
 */
  __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
  if (__pyx_t_2) {

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

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

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

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

    /* "View.MemoryView":385
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 */
    __pyx_t_3 = __pyx_memoryview_thread_locks_used;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":386
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":387
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 */
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":388
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":390
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":389
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
 */
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;

          /* "View.MemoryView":388
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        }

        /* "View.MemoryView":391
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
 */
        goto __pyx_L6_break;

        /* "View.MemoryView":386
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      }
    }
    /*else*/ {

      /* "View.MemoryView":393
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 */
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":384
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  }

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

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

/* "View.MemoryView":395
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":397
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
 */
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":399
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 399, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":400
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error)
    __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":399
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":402
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":395
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

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

    /* "View.MemoryView":407
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

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

  /* "View.MemoryView":409
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
 */
  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(2, 409, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_indices = __pyx_t_5;
  __pyx_t_5 = 0;

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

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

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

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

    /* "View.MemoryView":416
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

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

    /* "View.MemoryView":420
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 420, __pyx_L1_error)

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

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

  /* "View.MemoryView":424
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
  if (__pyx_t_1) {

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

    /* "View.MemoryView":426
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "View.MemoryView":427
 *             obj = self.is_slice(value)
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

    /* "View.MemoryView":429
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error)
      __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L5:;

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

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

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

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":433
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":434
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":435
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":436
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":437
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
 */
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "View.MemoryView":436
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_obj);
        __Pyx_GIVEREF(__pyx_v_obj);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "View.MemoryView":435
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "View.MemoryView":438
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);

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

      /* "View.MemoryView":435
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":434
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
 */
  }

  /* "View.MemoryView":441
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":433
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":443
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  __Pyx_memviewslice *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":447
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error)
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error)

  /* "View.MemoryView":448
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 */
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error)
  __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error)

  /* "View.MemoryView":449
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":447
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error)

  /* "View.MemoryView":443
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":451
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  int __pyx_v_array[0x80];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":453
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
 */
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":458
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error)
  __pyx_v_dst_slice = __pyx_t_1;

  /* "View.MemoryView":460
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
  __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":461
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
 */
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":462
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
    if (unlikely(__pyx_t_2)) {

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

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

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

    /* "View.MemoryView":460
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":466
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

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

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

      /* "View.MemoryView":470
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
 */
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":469
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
      goto __pyx_L8;
    }

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

    /* "View.MemoryView":476
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":477
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
 */
      __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "View.MemoryView":476
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    }

    /* "View.MemoryView":478
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
 */
    __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  }

  /* "View.MemoryView":481
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
 */
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":451
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":483
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":484
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":485
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":483
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":487
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":490
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":493
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":494
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":495
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_bytesitem);
        __Pyx_GIVEREF(__pyx_v_bytesitem);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

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

    /* "View.MemoryView":499
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
    /*else:*/ {
      __pyx_t_10 = strlen(__pyx_v_self->view.format); 
      __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
      if (__pyx_t_11) {

        /* "View.MemoryView":500
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":499
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
      }

      /* "View.MemoryView":501
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "View.MemoryView":496
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError("Unable to convert item to object")
 *         else:
 */
    __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
    __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_1);

      /* "View.MemoryView":497
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(2, 497, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "View.MemoryView":494
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":487
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":503
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  char *__pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":506
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

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

    /* "View.MemoryView":512
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

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

  /* "View.MemoryView":514
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

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

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

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

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

  /* "View.MemoryView":503
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":520
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  char *__pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "View.MemoryView":521
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":522
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 522, __pyx_L1_error)

    /* "View.MemoryView":521
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 */
  }

  /* "View.MemoryView":524
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":525
 * 
 *         if flags & PyBUF_ND:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_4;

    /* "View.MemoryView":524
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 * 
 *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
    goto __pyx_L6;
  }

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

  /* "View.MemoryView":529
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":530
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_4;

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

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

  /* "View.MemoryView":534
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":535
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
 */
    __pyx_t_4 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_4;

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

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

  /* "View.MemoryView":539
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":540
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_5 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_5;

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

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

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

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

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

  /* "View.MemoryView":547
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = self.view.readonly
 *         info.obj = self
 */
  __pyx_t_8 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_8;

  /* "View.MemoryView":548
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
 */
  __pyx_t_1 = __pyx_v_self->view.readonly;
  __pyx_v_info->readonly = __pyx_t_1;

  /* "View.MemoryView":549
 *         info.len = self.view.len
 *         info.readonly = self.view.readonly
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":520
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":555
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":556
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
 */
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":557
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error)

  /* "View.MemoryView":558
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":555
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

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

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

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":562
 *     @property
 *     def base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

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

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

/* "View.MemoryView":565
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":566
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_length = (__pyx_t_2[0]);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":565
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

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

/* "View.MemoryView":569
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":570
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":572
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 572, __pyx_L1_error)

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

  /* "View.MemoryView":574
 *             raise ValueError("Buffer view does not expose strides")
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_stride = (__pyx_t_3[0]);
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":569
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

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

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

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

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

    /* "View.MemoryView":579
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__25, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

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

  /* "View.MemoryView":581
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_4 = __pyx_t_6;
    __pyx_v_suboffset = (__pyx_t_4[0]);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

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

/* "View.MemoryView":584
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

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

  /* "View.MemoryView":584
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

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

/* "View.MemoryView":588
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

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

  /* "View.MemoryView":588
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

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

/* "View.MemoryView":592
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

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

  /* "View.MemoryView":593
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":592
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

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

/* "View.MemoryView":596
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

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

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

    /* "View.MemoryView":600
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
 */
    __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
      __pyx_t_6 = 0;

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

    /* "View.MemoryView":603
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
 */
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":597
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  }

  /* "View.MemoryView":605
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":596
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

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

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

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__", 0);

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

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

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

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

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

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

/* "View.MemoryView":613
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":614
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":615
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "View.MemoryView":614
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":613
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

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

/* "View.MemoryView":617
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":618
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":617
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

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

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

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":624
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":625
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

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

/* "View.MemoryView":627
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":630
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 */
  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":631
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":627
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

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

/* "View.MemoryView":633
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":635
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":637
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":638
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":643
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":633
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

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

/* "View.MemoryView":645
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":647
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":649
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":650
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":655
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":645
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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(2, 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(2, 2, __pyx_L1_error)

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

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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(2, 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(2, 4, __pyx_L1_error)

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

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

/* "View.MemoryView":659
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":660
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_o);
  __Pyx_GIVEREF(__pyx_v_o);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":661
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":662
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":659
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

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

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

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memoryview_check", 0);

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

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

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

/* "View.MemoryView":668
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":673
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":674
 *     """
 *     if not isinstance(index, tuple):
 *         tup = (index,)             # <<<<<<<<<<<<<<
 *     else:
 *         tup = index
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
    __pyx_v_tup = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "View.MemoryView":673
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":676
 *         tup = (index,)
 *     else:
 *         tup = index             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_tup = __pyx_v_index;
  }
  __pyx_L3:;

  /* "View.MemoryView":678
 *         tup = index
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":679
 * 
 *     result = []
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 */
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":680
 *     result = []
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 */
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":681
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
    __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 681, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "View.MemoryView":682
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":683
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
      if (__pyx_t_1) {

        /* "View.MemoryView":684
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
        __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
        __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
            __Pyx_INCREF(__pyx_slice__7);
            __Pyx_GIVEREF(__pyx_slice__7);
            PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__7);
          }
        }
        __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "View.MemoryView":685
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(slice(None))
 */
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":683
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":687
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":688
 *             else:
 *                 result.append(slice(None))
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 */
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":682
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":690
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
      __pyx_t_1 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {

        /* "View.MemoryView":691
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 */
        __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_11, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __PYX_ERR(2, 691, __pyx_L1_error)

        /* "View.MemoryView":690
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
      }

      /* "View.MemoryView":693
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
 *             result.append(item)
 * 
 */
      __pyx_t_10 = (__pyx_v_have_slices != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = PySlice_Check(__pyx_v_item); 
      __pyx_t_2 = (__pyx_t_10 != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L11_bool_binop_done:;
      __pyx_v_have_slices = __pyx_t_1;

      /* "View.MemoryView":694
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 *             result.append(item)             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - len(result)
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "View.MemoryView":681
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":696
 *             result.append(item)
 * 
 *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
 *     if nslices:
 *         result.extend([slice(None)] * nslices)
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);

  /* "View.MemoryView":697
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  __pyx_t_1 = (__pyx_v_nslices != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":698
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
        __Pyx_INCREF(__pyx_slice__7);
        __Pyx_GIVEREF(__pyx_slice__7);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__7);
      }
    }
    __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "View.MemoryView":697
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  }

  /* "View.MemoryView":700
 *         result.extend([slice(None)] * nslices)
 * 
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L14_bool_binop_done:;
  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":668
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

  /* "View.MemoryView":703
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")
 */
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":704
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "View.MemoryView":705
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(2, 705, __pyx_L1_error)

      /* "View.MemoryView":704
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    }
  }

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

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_suboffset_dim;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_step;
  int __pyx_v_have_start;
  int __pyx_v_have_stop;
  int __pyx_v_have_step;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":713
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
 */
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":720
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
 */
  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));

  /* "View.MemoryView":724
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(2, 724, __pyx_L1_error)
    }
  }
  #endif

  /* "View.MemoryView":726
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

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

    /* "View.MemoryView":728
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
 */
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

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

  /* "View.MemoryView":730
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":731
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

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

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

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

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

  /* "View.MemoryView":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 748, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_v_dim = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
    __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":753
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 */
      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error)

      /* "View.MemoryView":750
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error)

      /* "View.MemoryView":749
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":756
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
    __pyx_t_2 = (__pyx_v_index == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":757
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 */
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":758
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
 */
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":759
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
 */
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":760
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":756
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":762
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_10;

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

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

      /* "View.MemoryView":766
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":767
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":768
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":770
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error)

      /* "View.MemoryView":776
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":748
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":778
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":779
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":780
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) }

    /* "View.MemoryView":781
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) }

    /* "View.MemoryView":779
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

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

  /* "View.MemoryView":784
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":785
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

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

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":809
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

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

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

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

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

    /* "View.MemoryView":833
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":834
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error)

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

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

  /* "View.MemoryView":837
 *     else:
 * 
 *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
 * 
 *         if have_step and step == 0:
 */
  /*else*/ {
    __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step < 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    __pyx_v_negative_step = __pyx_t_2;

    /* "View.MemoryView":839
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    __pyx_t_1 = (__pyx_v_have_step != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step == 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_2) {

      /* "View.MemoryView":840
 * 
 *         if have_step and step == 0:
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /* "View.MemoryView":854
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

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

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

      /* "View.MemoryView":857
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
 */
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L15:;
    }
    __pyx_L11:;

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

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

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

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

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

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

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

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

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

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

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

    /* "View.MemoryView":867
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

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

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

      /* "View.MemoryView":870
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 *         if not have_step:
 */
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L19:;
    }
    __pyx_L16:;

    /* "View.MemoryView":872
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":873
 * 
 *         if not have_step:
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_step = 1;

      /* "View.MemoryView":872
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    }

    /* "View.MemoryView":877
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
 */
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":879
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":880
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
 */
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

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

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

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

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

    /* "View.MemoryView":886
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
 */
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":887
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
 */
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":888
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":891
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":892
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 */
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":891
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
    goto __pyx_L23;
  }

  /* "View.MemoryView":894
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L23:;

  /* "View.MemoryView":896
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":897
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":898
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
      if (__pyx_t_2) {

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

        /* "View.MemoryView":898
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
        goto __pyx_L26;
      }

      /* "View.MemoryView":901
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
 */
      /*else*/ {

        /* "View.MemoryView":902
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
 */
        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "View.MemoryView":897
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
      goto __pyx_L25;
    }

    /* "View.MemoryView":904
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L25:;

    /* "View.MemoryView":896
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  }

  /* "View.MemoryView":906
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":809
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":912
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":914
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
 */
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":915
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
 */
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":918
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":919
 * 
 *     if view.ndim == 0:
 *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
 */
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(2, 919, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(2, 919, __pyx_L1_error)
    }
    __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);

    /* "View.MemoryView":920
 *     if view.ndim == 0:
 *         shape = view.len / itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
 */
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":918
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":922
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 */
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":923
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
 */
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":924
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":925
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
 */
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":924
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":927
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":928
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 */
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":929
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "View.MemoryView":930
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 930, __pyx_L1_error)

      /* "View.MemoryView":929
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    }

    /* "View.MemoryView":927
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  }

  /* "View.MemoryView":932
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "View.MemoryView":933
 * 
 *     if index >= shape:
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 933, __pyx_L1_error)

    /* "View.MemoryView":932
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  }

  /* "View.MemoryView":935
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
 */
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":936
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":937
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
 */
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":936
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  }

  /* "View.MemoryView":939
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":912
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":945
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":946
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 */
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":948
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":949
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":953
 * 
 *     cdef int i, j
 *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 */
  __pyx_t_3 = (__pyx_v_ndim / 2);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":954
 *     cdef int i, j
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
 */
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":955
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 */
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;

    /* "View.MemoryView":956
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 */
    __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":958
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_7) {

      /* "View.MemoryView":959
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error)

      /* "View.MemoryView":958
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    }
  }

  /* "View.MemoryView":961
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "View.MemoryView":945
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":978
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

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

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":979
 * 
 *     def __dealloc__(self):
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":978
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

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

/* "View.MemoryView":981
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":982
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":983
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":982
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  }

  /* "View.MemoryView":985
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":981
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":987
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":988
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":989
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
 */
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error)

    /* "View.MemoryView":988
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":991
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":987
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":994
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":995
 *     @property
 *     def base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":994
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

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

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 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(2, 2, __pyx_L1_error)

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

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

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

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 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(2, 4, __pyx_L1_error)

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

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

/* "View.MemoryView":1001
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":1009
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1010
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "View.MemoryView":1009
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "View.MemoryView":1015
 * 
 * 
 *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1017
 *     result = _memoryviewslice(None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 */
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1018
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 */
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1020
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1021
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
 */
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1023
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 */
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1024
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 */
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1025
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
 */
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1026
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
 */
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1027
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 */
  Py_INCREF(Py_None);

  /* "View.MemoryView":1029
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1030
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
 *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 *     else:
 *         result.flags = PyBUF_RECORDS_RO
 */
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

    /* "View.MemoryView":1029
 *     Py_INCREF(Py_None)
 * 
 *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
 *         result.flags = PyBUF_RECORDS
 *     else:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":1032
 *         result.flags = PyBUF_RECORDS
 *     else:
 *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 */
  /*else*/ {
    __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  }
  __pyx_L4:;

  /* "View.MemoryView":1034
 *         result.flags = PyBUF_RECORDS_RO
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
 */
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1035
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1038
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 */
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1039
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 */
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1040
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1041
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1042
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
 */
      goto __pyx_L6_break;

      /* "View.MemoryView":1040
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    }
  }
  __pyx_L6_break:;

  /* "View.MemoryView":1044
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
 */
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1045
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
 */
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1046
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1048
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
 */
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1049
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1051
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":1001
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

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

/* "View.MemoryView":1054
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 */

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1057
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1058
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":1059
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
 */
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1057
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  }

  /* "View.MemoryView":1061
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1062
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
 */
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1054
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice) except NULL:
 *     cdef _memoryviewslice obj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1065
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  __Pyx_RefNannySetupContext("slice_copy", 0);

  /* "View.MemoryView":1069
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
 */
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1070
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
 */
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1071
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 */
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1073
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
 */
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1074
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
 */
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1076
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 */
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_dim = __pyx_t_4;

    /* "View.MemoryView":1077
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 */
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1078
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 */
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1079
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
 */
    if ((__pyx_v_suboffsets != 0)) {
      __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_5 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  }

  /* "View.MemoryView":1065
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

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

/* "View.MemoryView":1082
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1085
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 */
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1086
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1082
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

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

/* "View.MemoryView":1089
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *(*__pyx_t_3)(char *);
  int (*__pyx_t_4)(char *, PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1096
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1097
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_3;

    /* "View.MemoryView":1098
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
 */
    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_4;

    /* "View.MemoryView":1096
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1100
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
 */
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1101
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 */
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1103
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1105
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1089
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1111
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":1112
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1113
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:
 *         return -arg             # <<<<<<<<<<<<<<
 *     else:
 *         return arg
 */
    __pyx_r = (-__pyx_v_arg);
    goto __pyx_L0;

    /* "View.MemoryView":1112
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  }

  /* "View.MemoryView":1115
 *         return -arg
 *     else:
 *         return arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
 */
  /*else*/ {
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1111
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

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

/* "View.MemoryView":1118
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1123
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
 */
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1124
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1126
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1127
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1128
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1129
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
      goto __pyx_L4_break;

      /* "View.MemoryView":1127
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1131
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 */
  __pyx_t_1 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1132
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1133
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1134
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 */
      goto __pyx_L7_break;

      /* "View.MemoryView":1132
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1136
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1137
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
 */
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1136
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  }

  /* "View.MemoryView":1139
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1118
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

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

/* "View.MemoryView":1142
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;

  /* "View.MemoryView":1149
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 */
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1150
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 */
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1151
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 */
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1152
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1154
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1155
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1156
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 */
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_3 = (__pyx_t_2 != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1155
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    if (__pyx_t_1) {

      /* "View.MemoryView":1157
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *        else:
 *            for i in range(dst_extent):
 */
      (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));

      /* "View.MemoryView":1155
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":1159
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_dst_extent;
      __pyx_t_5 = __pyx_t_4;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "View.MemoryView":1160
 *        else:
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                src_data += src_stride
 *                dst_data += dst_stride
 */
        (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));

        /* "View.MemoryView":1161
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride             # <<<<<<<<<<<<<<
 *                dst_data += dst_stride
 *     else:
 */
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1162
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 *                dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
 */
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1154
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1164
 *                dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_dst_extent;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "View.MemoryView":1165
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
 */
      _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);

      /* "View.MemoryView":1169
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
 */
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1170
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
 */
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1142
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

  /* function exit code */
}

/* "View.MemoryView":1172
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {

  /* "View.MemoryView":1175
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 */
  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1172
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1179
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 */

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;

  /* "View.MemoryView":1181
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for shape in src.shape[:ndim]:
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1183
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 * 
 *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         size *= shape
 * 
 */
  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_shape = (__pyx_t_2[0]);

    /* "View.MemoryView":1184
 * 
 *     for shape in src.shape[:ndim]:
 *         size *= shape             # <<<<<<<<<<<<<<
 * 
 *     return size
 */
    __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  }

  /* "View.MemoryView":1186
 *         size *= shape
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1179
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
 */

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

/* "View.MemoryView":1189
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;

  /* "View.MemoryView":1198
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1199
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
 */
    __pyx_t_2 = __pyx_v_ndim;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_idx = __pyx_t_4;

      /* "View.MemoryView":1200
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 *     else:
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1201
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1198
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1203
 *             stride *= shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride *= shape[idx]
 */
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1204
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride *= shape[idx]
 * 
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1205
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride *= shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1207
 *             stride *= shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 */
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1189
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

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

/* "View.MemoryView":1210
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":1221
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1222
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
 */
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1224
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err(MemoryError, NULL)
 */
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1225
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1226
 *     result = malloc(size)
 *     if not result:
 *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error)

    /* "View.MemoryView":1225
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  }

  /* "View.MemoryView":1229
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 */
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1230
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 */
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1231
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1232
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1233
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
 */
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1235
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
 *                               ndim, order)
 * 
 */
  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));

  /* "View.MemoryView":1239
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
 */
  __pyx_t_3 = __pyx_v_ndim;
  __pyx_t_5 = __pyx_t_3;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "View.MemoryView":1240
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1241
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
 */
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1240
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    }
  }

  /* "View.MemoryView":1243
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1244
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 */
    (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));

    /* "View.MemoryView":1243
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":1246
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1248
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1210
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1253
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1256
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "View.MemoryView":1255
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
 *                                                         (i, extent1, extent2))
 * 
 */
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __PYX_ERR(2, 1255, __pyx_L1_error)

  /* "View.MemoryView":1253
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1259
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1260
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
 *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
 */
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_error);
  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 1260, __pyx_L1_error)

  /* "View.MemoryView":1259
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1263
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1264
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "View.MemoryView":1265
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
 *     else:
 *         raise error
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 1265, __pyx_L1_error)

    /* "View.MemoryView":1264
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  }

  /* "View.MemoryView":1267
 *         raise error(msg.decode('ascii'))
 *     else:
 *         raise error             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_contents')
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(2, 1267, __pyx_L1_error)
  }

  /* "View.MemoryView":1263
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1270
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  void *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "View.MemoryView":1278
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 */
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1279
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 */
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1281
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
 */
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1282
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
 */
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1283
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
 */
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1286
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1287
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1286
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1288
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1289
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1288
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":1291
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1293
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 */
  __pyx_t_5 = __pyx_v_ndim;
  __pyx_t_3 = __pyx_t_5;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "View.MemoryView":1294
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1295
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":1296
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
 */
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1297
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 */
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1295
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":1299
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
 */
      /*else*/ {
        __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1294
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    }

    /* "View.MemoryView":1301
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1302
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 */
      __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error)

      /* "View.MemoryView":1301
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    }
  }

  /* "View.MemoryView":1304
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1306
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1307
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 */
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1306
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    }

    /* "View.MemoryView":1309
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
 */
    __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_7;

    /* "View.MemoryView":1310
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
 */
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1304
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  }

  /* "View.MemoryView":1312
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1315
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1316
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1315
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
      goto __pyx_L12;
    }

    /* "View.MemoryView":1317
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1318
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1317
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    }
    __pyx_L12:;

    /* "View.MemoryView":1320
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_2 = (__pyx_v_direct_copy != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1322
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1323
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 */
      (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));

      /* "View.MemoryView":1324
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1325
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1326
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1320
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    }

    /* "View.MemoryView":1312
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1328
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {

    /* "View.MemoryView":1331
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error)

    /* "View.MemoryView":1332
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error)

    /* "View.MemoryView":1328
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1334
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1335
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 */
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1336
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1338
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1339
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1270
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1342
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1346
 *                             int ndim_other) nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1348
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1349
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 */
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1350
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 */
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1351
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
 */
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1353
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 */
  __pyx_t_1 = __pyx_v_offset;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1354
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
 */
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1355
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1356
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1342
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1364
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
  int __pyx_t_1;

  /* "View.MemoryView":1368
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1369
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
 *                                            dst.strides, ndim, inc)
 * 
 */
    __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);

    /* "View.MemoryView":1368
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  }

  /* "View.MemoryView":1364
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

  /* function exit code */
}

/* "View.MemoryView":1373
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);

  /* "View.MemoryView":1376
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 */
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1373
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "View.MemoryView":1379
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);

  /* "View.MemoryView":1383
 *     cdef Py_ssize_t i
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
 */
  __pyx_t_1 = (__pyx_v_shape[0]);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1384
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
    __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":1385
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
      __pyx_t_4 = (__pyx_v_inc != 0);
      if (__pyx_t_4) {

        /* "View.MemoryView":1386
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
 */
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1385
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
        goto __pyx_L6;
      }

      /* "View.MemoryView":1388
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 */
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1384
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":1390
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                       ndim - 1, inc)
 * 
 */
    /*else*/ {

      /* "View.MemoryView":1391
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += strides[0]
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1393
 *                                       ndim - 1, inc)
 * 
 *         data += strides[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  }

  /* "View.MemoryView":1379
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

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

/* "View.MemoryView":1399
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {

  /* "View.MemoryView":1402
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1403
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);

  /* "View.MemoryView":1405
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1399
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1409
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;

  /* "View.MemoryView":1413
 *                               size_t itemsize, void *item) nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
 */
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1414
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1416
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1417
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
 */
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1418
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
 */
      (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));

      /* "View.MemoryView":1419
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1416
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1421
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":1422
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                 ndim - 1, itemsize, item)
 *             data += stride
 */
      __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);

      /* "View.MemoryView":1424
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1409
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /* function exit code */
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

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

static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__31, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 */
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
    __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(2, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
    __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 13, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify[8];
static int __pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify = 0;

static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify)))) {
    o = (PyObject*)__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify[--__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify];
    memset(o, 0, sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(PyObject *o) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_classifyWithMissingData);
  Py_CLEAR(p->__pyx_v_classifyWithoutMissingData);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify)))) {
    __pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify[__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify++] = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)o;
  if (p->__pyx_v_classifyWithMissingData) {
    e = (*v)(p->__pyx_v_classifyWithMissingData, a); if (e) return e;
  }
  if (p->__pyx_v_classifyWithoutMissingData) {
    e = (*v)(p->__pyx_v_classifyWithoutMissingData, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify *)o;
  tmp = ((PyObject*)p->__pyx_v_classifyWithMissingData);
  p->__pyx_v_classifyWithMissingData = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_classifyWithoutMissingData);
  p->__pyx_v_classifyWithoutMissingData = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.__pyx_scope_struct__classify", /*tp_name*/
  sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify, /*tp_traverse*/
  __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify, /*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_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit[8];
static int __pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit = 0;

static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit)))) {
    o = (PyObject*)__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit[--__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit];
    memset(o, 0, sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(PyObject *o) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_X);
  Py_CLEAR(p->__pyx_v_X_val);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_treatment);
  Py_CLEAR(p->__pyx_v_treatment_val);
  Py_CLEAR(p->__pyx_v_y);
  Py_CLEAR(p->__pyx_v_y_val);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit)))) {
    __pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit[__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit++] = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)o;
  if (p->__pyx_v_X) {
    e = (*v)(p->__pyx_v_X, a); if (e) return e;
  }
  if (p->__pyx_v_X_val) {
    e = (*v)(p->__pyx_v_X_val, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_v_treatment) {
    e = (*v)(p->__pyx_v_treatment, a); if (e) return e;
  }
  if (p->__pyx_v_treatment_val) {
    e = (*v)(p->__pyx_v_treatment_val, a); if (e) return e;
  }
  if (p->__pyx_v_y) {
    e = (*v)(p->__pyx_v_y, a); if (e) return e;
  }
  if (p->__pyx_v_y_val) {
    e = (*v)(p->__pyx_v_y_val, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit *)o;
  tmp = ((PyObject*)p->__pyx_v_X);
  p->__pyx_v_X = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_X_val);
  p->__pyx_v_X_val = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_treatment);
  p->__pyx_v_treatment = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_treatment_val);
  p->__pyx_v_treatment_val = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_y);
  p->__pyx_v_y = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_y_val);
  p->__pyx_v_y_val = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.__pyx_scope_struct_1_fit", /*tp_name*/
  sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit, /*tp_traverse*/
  __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit, /*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_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr[8];
static int __pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr = 0;

static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr[--__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_tree);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr)))) {
    __pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr[__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_tree) {
    e = (*v)(p->__pyx_v_tree, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if 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_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict[8];
static int __pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict = 0;

static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict)))) {
    o = (PyObject*)__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict[--__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict];
    memset(o, 0, sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(PyObject *o) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_X);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict)))) {
    __pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict[__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict++] = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)o;
  if (p->__pyx_v_X) {
    e = (*v)(p->__pyx_v_X, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict *)o;
  tmp = ((PyObject*)p->__pyx_v_X);
  p->__pyx_v_X = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.__pyx_scope_struct_3_predict", /*tp_name*/
  sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict, /*tp_traverse*/
  __pyx_tp_clear_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict, /*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_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr[--__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_tree);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr[__pyx_freecount_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_tree) {
    e = (*v)(p->__pyx_v_tree, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr, /*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_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if 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_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_array___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*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*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!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_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*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
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!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_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryview___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->_array_interface);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->_array_interface) {
    e = (*v)(p->_array_interface, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_array_interface);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift.memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*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
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!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__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_memoryviewslice___dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "causalml.inference.tree.uplift._memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*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
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Internal class for passing memoryview slices to Python", /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets__memoryviewslice, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!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_uplift(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_uplift},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "uplift",
    __pyx_k_Forest_of_trees_based_ensemble, /* 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_kp_u_0_22_0, __pyx_k_0_22_0, sizeof(__pyx_k_0_22_0), 0, 1, 0, 0},
  {&__pyx_kp_u_3f, __pyx_k_3f, sizeof(__pyx_k_3f), 0, 1, 0, 0},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
  {&__pyx_n_u_CIT, __pyx_k_CIT, sizeof(__pyx_k_CIT), 0, 1, 0, 1},
  {&__pyx_n_u_CTS, __pyx_k_CTS, sizeof(__pyx_k_CTS), 0, 1, 0, 1},
  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
  {&__pyx_n_u_Chi, __pyx_k_Chi, sizeof(__pyx_k_Chi), 0, 1, 0, 1},
  {&__pyx_n_u_DDP, __pyx_k_DDP, sizeof(__pyx_k_DDP), 0, 1, 0, 1},
  {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1},
  {&__pyx_kp_u_Data_length_must_be_equal_for_X, __pyx_k_Data_length_must_be_equal_for_X, sizeof(__pyx_k_Data_length_must_be_equal_for_X), 0, 1, 0, 0},
  {&__pyx_kp_u_Data_length_must_be_equal_for_X_2, __pyx_k_Data_length_must_be_equal_for_X_2, sizeof(__pyx_k_Data_length_must_be_equal_for_X_2), 0, 1, 0, 0},
  {&__pyx_n_s_DecisionTree, __pyx_k_DecisionTree, sizeof(__pyx_k_DecisionTree), 0, 0, 1, 1},
  {&__pyx_n_s_DecisionTree___init, __pyx_k_DecisionTree___init, sizeof(__pyx_k_DecisionTree___init), 0, 0, 1, 1},
  {&__pyx_n_u_ED, __pyx_k_ED, sizeof(__pyx_k_ED), 0, 1, 0, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
  {&__pyx_n_s_FutureWarning, __pyx_k_FutureWarning, sizeof(__pyx_k_FutureWarning), 0, 0, 1, 1},
  {&__pyx_n_u_IDDP, __pyx_k_IDDP, sizeof(__pyx_k_IDDP), 0, 1, 0, 1},
  {&__pyx_n_u_IT, __pyx_k_IT, sizeof(__pyx_k_IT), 0, 1, 0, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
  {&__pyx_n_u_KL, __pyx_k_KL, sizeof(__pyx_k_KL), 0, 1, 0, 1},
  {&__pyx_n_s_MAX_INT, __pyx_k_MAX_INT, sizeof(__pyx_k_MAX_INT), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  {&__pyx_n_s_N_TYPE, __pyx_k_N_TYPE, sizeof(__pyx_k_N_TYPE), 0, 0, 1, 1},
  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
  {&__pyx_n_s_P_TYPE, __pyx_k_P_TYPE, sizeof(__pyx_k_P_TYPE), 0, 0, 1, 1},
  {&__pyx_n_s_Parallel, __pyx_k_Parallel, sizeof(__pyx_k_Parallel), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_kp_u_Stratified_sampling_failed_Falli, __pyx_k_Stratified_sampling_failed_Falli, sizeof(__pyx_k_Stratified_sampling_failed_Falli), 0, 1, 0, 0},
  {&__pyx_n_s_TR_TYPE, __pyx_k_TR_TYPE, sizeof(__pyx_k_TR_TYPE), 0, 0, 1, 1},
  {&__pyx_n_s_T_est, __pyx_k_T_est, sizeof(__pyx_k_T_est), 0, 0, 1, 1},
  {&__pyx_kp_u_The_DDP_IDDP_IT_and_CIT_approach, __pyx_k_The_DDP_IDDP_IT_and_CIT_approach, sizeof(__pyx_k_The_DDP_IDDP_IT_and_CIT_approach), 0, 1, 0, 0},
  {&__pyx_kp_s_Tree_Node_Class_Tree_node_class, __pyx_k_Tree_Node_Class_Tree_node_class, sizeof(__pyx_k_Tree_Node_Class_Tree_node_class), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
  {&__pyx_n_s_UpliftRandomForestClassifier, __pyx_k_UpliftRandomForestClassifier, sizeof(__pyx_k_UpliftRandomForestClassifier), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier___i, __pyx_k_UpliftRandomForestClassifier___i, sizeof(__pyx_k_UpliftRandomForestClassifier___i), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier_boo, __pyx_k_UpliftRandomForestClassifier_boo, sizeof(__pyx_k_UpliftRandomForestClassifier_boo), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier_fit, __pyx_k_UpliftRandomForestClassifier_fit, sizeof(__pyx_k_UpliftRandomForestClassifier_fit), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier_fit_2, __pyx_k_UpliftRandomForestClassifier_fit_2, sizeof(__pyx_k_UpliftRandomForestClassifier_fit_2), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier_pre, __pyx_k_UpliftRandomForestClassifier_pre, sizeof(__pyx_k_UpliftRandomForestClassifier_pre), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftRandomForestClassifier_pre_2, __pyx_k_UpliftRandomForestClassifier_pre_2, sizeof(__pyx_k_UpliftRandomForestClassifier_pre_2), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier, __pyx_k_UpliftTreeClassifier, sizeof(__pyx_k_UpliftTreeClassifier), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier___init, __pyx_k_UpliftTreeClassifier___init, sizeof(__pyx_k_UpliftTreeClassifier___init), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat, __pyx_k_UpliftTreeClassifier_arr_evaluat, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_2, __pyx_k_UpliftTreeClassifier_arr_evaluat_2, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_2), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_3, __pyx_k_UpliftTreeClassifier_arr_evaluat_3, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_3), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_4, __pyx_k_UpliftTreeClassifier_arr_evaluat_4, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_4), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_5, __pyx_k_UpliftTreeClassifier_arr_evaluat_5, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_5), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_6, __pyx_k_UpliftTreeClassifier_arr_evaluat_6, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_6), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_7, __pyx_k_UpliftTreeClassifier_arr_evaluat_7, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_7), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_evaluat_8, __pyx_k_UpliftTreeClassifier_arr_evaluat_8, sizeof(__pyx_k_UpliftTreeClassifier_arr_evaluat_8), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_arr_normI, __pyx_k_UpliftTreeClassifier_arr_normI, sizeof(__pyx_k_UpliftTreeClassifier_arr_normI), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_classify, __pyx_k_UpliftTreeClassifier_classify, sizeof(__pyx_k_UpliftTreeClassifier_classify), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_classify_lo, __pyx_k_UpliftTreeClassifier_classify_lo, sizeof(__pyx_k_UpliftTreeClassifier_classify_lo), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_classify_lo_2, __pyx_k_UpliftTreeClassifier_classify_lo_2, sizeof(__pyx_k_UpliftTreeClassifier_classify_lo_2), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_divideSet, __pyx_k_UpliftTreeClassifier_divideSet, sizeof(__pyx_k_UpliftTreeClassifier_divideSet), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_divideSet_l, __pyx_k_UpliftTreeClassifier_divideSet_l, sizeof(__pyx_k_UpliftTreeClassifier_divideSet_l), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_CI, __pyx_k_UpliftTreeClassifier_evaluate_CI, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_CI), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_CT, __pyx_k_UpliftTreeClassifier_evaluate_CT, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_CT), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_Ch, __pyx_k_UpliftTreeClassifier_evaluate_Ch, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_Ch), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_DD, __pyx_k_UpliftTreeClassifier_evaluate_DD, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_DD), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_ED, __pyx_k_UpliftTreeClassifier_evaluate_ED, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_ED), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_ID, __pyx_k_UpliftTreeClassifier_evaluate_ID, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_ID), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_IT, __pyx_k_UpliftTreeClassifier_evaluate_IT, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_IT), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_evaluate_KL, __pyx_k_UpliftTreeClassifier_evaluate_KL, sizeof(__pyx_k_UpliftTreeClassifier_evaluate_KL), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_fill, __pyx_k_UpliftTreeClassifier_fill, sizeof(__pyx_k_UpliftTreeClassifier_fill), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_fillTree, __pyx_k_UpliftTreeClassifier_fillTree, sizeof(__pyx_k_UpliftTreeClassifier_fillTree), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_fit, __pyx_k_UpliftTreeClassifier_fit, sizeof(__pyx_k_UpliftTreeClassifier_fit), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_group_uniqu, __pyx_k_UpliftTreeClassifier_group_uniqu, sizeof(__pyx_k_UpliftTreeClassifier_group_uniqu), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_growDecisio, __pyx_k_UpliftTreeClassifier_growDecisio, sizeof(__pyx_k_UpliftTreeClassifier_growDecisio), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_honestAppro, __pyx_k_UpliftTreeClassifier_honestAppro, sizeof(__pyx_k_UpliftTreeClassifier_honestAppro), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_modifyEstim, __pyx_k_UpliftTreeClassifier_modifyEstim, sizeof(__pyx_k_UpliftTreeClassifier_modifyEstim), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_normI, __pyx_k_UpliftTreeClassifier_normI, sizeof(__pyx_k_UpliftTreeClassifier_normI), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_predict, __pyx_k_UpliftTreeClassifier_predict, sizeof(__pyx_k_UpliftTreeClassifier_predict), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_prune, __pyx_k_UpliftTreeClassifier_prune, sizeof(__pyx_k_UpliftTreeClassifier_prune), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_pruneTree, __pyx_k_UpliftTreeClassifier_pruneTree, sizeof(__pyx_k_UpliftTreeClassifier_pruneTree), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_tree_node_s, __pyx_k_UpliftTreeClassifier_tree_node_s, sizeof(__pyx_k_UpliftTreeClassifier_tree_node_s), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_tree_node_s_2, __pyx_k_UpliftTreeClassifier_tree_node_s_2, sizeof(__pyx_k_UpliftTreeClassifier_tree_node_s_2), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_tree_node_s_3, __pyx_k_UpliftTreeClassifier_tree_node_s_3, sizeof(__pyx_k_UpliftTreeClassifier_tree_node_s_3), 0, 0, 1, 1},
  {&__pyx_n_s_UpliftTreeClassifier_uplift_clas, __pyx_k_UpliftTreeClassifier_uplift_clas, sizeof(__pyx_k_UpliftTreeClassifier_uplift_clas), 0, 0, 1, 1},
  {&__pyx_kp_s_Uplift_Random_Forest_for_Classi, __pyx_k_Uplift_Random_Forest_for_Classi, sizeof(__pyx_k_Uplift_Random_Forest_for_Classi), 0, 0, 1, 0},
  {&__pyx_kp_s_Uplift_Tree_Classifier_for_Clas, __pyx_k_Uplift_Tree_Classifier_for_Clas, sizeof(__pyx_k_Uplift_Tree_Classifier_for_Clas), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_X_est, __pyx_k_X_est, sizeof(__pyx_k_X_est), 0, 0, 1, 1},
  {&__pyx_n_s_X_l, __pyx_k_X_l, sizeof(__pyx_k_X_l), 0, 0, 1, 1},
  {&__pyx_n_s_X_r, __pyx_k_X_r, sizeof(__pyx_k_X_r), 0, 0, 1, 1},
  {&__pyx_n_s_X_val, __pyx_k_X_val, sizeof(__pyx_k_X_val), 0, 0, 1, 1},
  {&__pyx_n_s_X_val_l, __pyx_k_X_val_l, sizeof(__pyx_k_X_val_l), 0, 0, 1, 1},
  {&__pyx_n_s_X_val_r, __pyx_k_X_val_r, sizeof(__pyx_k_X_val_r), 0, 0, 1, 1},
  {&__pyx_n_s_Y_TYPE, __pyx_k_Y_TYPE, sizeof(__pyx_k_Y_TYPE), 0, 0, 1, 1},
  {&__pyx_n_s_Y_est, __pyx_k_Y_est, sizeof(__pyx_k_Y_est), 0, 0, 1, 1},
  {&__pyx_n_s__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 1, 1},
  {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
  {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0},
  {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0},
  {&__pyx_n_s__62, __pyx_k__62, sizeof(__pyx_k__62), 0, 0, 1, 1},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
  {&__pyx_n_s_all_importances, __pyx_k_all_importances, sizeof(__pyx_k_all_importances), 0, 0, 1, 1},
  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1},
  {&__pyx_n_s_argmax, __pyx_k_argmax, sizeof(__pyx_k_argmax), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_arr_eval_func, __pyx_k_arr_eval_func, sizeof(__pyx_k_arr_eval_func), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_CIT, __pyx_k_arr_evaluate_CIT, sizeof(__pyx_k_arr_evaluate_CIT), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_CTS, __pyx_k_arr_evaluate_CTS, sizeof(__pyx_k_arr_evaluate_CTS), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_Chi, __pyx_k_arr_evaluate_Chi, sizeof(__pyx_k_arr_evaluate_Chi), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_DDP, __pyx_k_arr_evaluate_DDP, sizeof(__pyx_k_arr_evaluate_DDP), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_ED, __pyx_k_arr_evaluate_ED, sizeof(__pyx_k_arr_evaluate_ED), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_IDDP, __pyx_k_arr_evaluate_IDDP, sizeof(__pyx_k_arr_evaluate_IDDP), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_IT, __pyx_k_arr_evaluate_IT, sizeof(__pyx_k_arr_evaluate_IT), 0, 0, 1, 1},
  {&__pyx_n_s_arr_evaluate_KL, __pyx_k_arr_evaluate_KL, sizeof(__pyx_k_arr_evaluate_KL), 0, 0, 1, 1},
  {&__pyx_n_s_arr_normI, __pyx_k_arr_normI, sizeof(__pyx_k_arr_normI), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_n_s_backupResults, __pyx_k_backupResults, sizeof(__pyx_k_backupResults), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_bestAttribute, __pyx_k_bestAttribute, sizeof(__pyx_k_bestAttribute), 0, 0, 1, 1},
  {&__pyx_n_s_bestGain, __pyx_k_bestGain, sizeof(__pyx_k_bestGain), 0, 0, 1, 1},
  {&__pyx_n_s_bestGainImp, __pyx_k_bestGainImp, sizeof(__pyx_k_bestGainImp), 0, 0, 1, 1},
  {&__pyx_n_s_bestTreatment, __pyx_k_bestTreatment, sizeof(__pyx_k_bestTreatment), 0, 0, 1, 1},
  {&__pyx_n_u_bestUplift, __pyx_k_bestUplift, sizeof(__pyx_k_bestUplift), 0, 1, 0, 1},
  {&__pyx_n_s_best_col, __pyx_k_best_col, sizeof(__pyx_k_best_col), 0, 0, 1, 1},
  {&__pyx_n_s_best_set_left, __pyx_k_best_set_left, sizeof(__pyx_k_best_set_left), 0, 0, 1, 1},
  {&__pyx_n_s_best_set_right, __pyx_k_best_set_right, sizeof(__pyx_k_best_set_right), 0, 0, 1, 1},
  {&__pyx_n_s_best_value, __pyx_k_best_value, sizeof(__pyx_k_best_value), 0, 0, 1, 1},
  {&__pyx_n_s_bootstrap, __pyx_k_bootstrap, sizeof(__pyx_k_bootstrap), 0, 0, 1, 1},
  {&__pyx_n_s_branch, __pyx_k_branch, sizeof(__pyx_k_branch), 0, 0, 1, 1},
  {&__pyx_n_s_bt_index, __pyx_k_bt_index, sizeof(__pyx_k_bt_index), 0, 0, 1, 1},
  {&__pyx_n_s_bt_val_index, __pyx_k_bt_val_index, sizeof(__pyx_k_bt_val_index), 0, 0, 1, 1},
  {&__pyx_n_s_buf_count_arr, __pyx_k_buf_count_arr, sizeof(__pyx_k_buf_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_s_c_cat_percentiles, __pyx_k_c_cat_percentiles, sizeof(__pyx_k_c_cat_percentiles), 0, 0, 1, 1},
  {&__pyx_n_s_c_num_percentiles, __pyx_k_c_num_percentiles, sizeof(__pyx_k_c_num_percentiles), 0, 0, 1, 1},
  {&__pyx_n_s_category, __pyx_k_category, sizeof(__pyx_k_category), 0, 0, 1, 1},
  {&__pyx_n_u_causalml, __pyx_k_causalml, sizeof(__pyx_k_causalml), 0, 1, 0, 1},
  {&__pyx_n_s_causalml_inference_tree_uplift, __pyx_k_causalml_inference_tree_uplift, sizeof(__pyx_k_causalml_inference_tree_uplift), 0, 0, 1, 1},
  {&__pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_k_causalml_inference_tree_uplift_p, sizeof(__pyx_k_causalml_inference_tree_uplift_p), 0, 0, 1, 0},
  {&__pyx_n_s_cdf, __pyx_k_cdf, sizeof(__pyx_k_cdf), 0, 0, 1, 1},
  {&__pyx_n_s_check_X_y, __pyx_k_check_X_y, sizeof(__pyx_k_check_X_y), 0, 0, 1, 1},
  {&__pyx_n_s_check_array, __pyx_k_check_array, sizeof(__pyx_k_check_array), 0, 0, 1, 1},
  {&__pyx_n_s_check_random_state, __pyx_k_check_random_state, sizeof(__pyx_k_check_random_state), 0, 0, 1, 1},
  {&__pyx_n_s_choice, __pyx_k_choice, sizeof(__pyx_k_choice), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_classes, __pyx_k_classes, sizeof(__pyx_k_classes), 0, 0, 1, 1},
  {&__pyx_n_s_classify, __pyx_k_classify, sizeof(__pyx_k_classify), 0, 0, 1, 1},
  {&__pyx_n_s_classifyWithMissingData, __pyx_k_classifyWithMissingData, sizeof(__pyx_k_classifyWithMissingData), 0, 0, 1, 1},
  {&__pyx_n_s_classifyWithoutMissingData, __pyx_k_classifyWithoutMissingData, sizeof(__pyx_k_classifyWithoutMissingData), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1},
  {&__pyx_n_s_col_vals, __pyx_k_col_vals, sizeof(__pyx_k_col_vals), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 0, 1, 1},
  {&__pyx_n_s_columnCount, __pyx_k_columnCount, sizeof(__pyx_k_columnCount), 0, 0, 1, 1},
  {&__pyx_n_s_columnValues, __pyx_k_columnValues, sizeof(__pyx_k_columnValues), 0, 0, 1, 1},
  {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1},
  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  {&__pyx_kp_u_control_group_should_be_string_b, __pyx_k_control_group_should_be_string_b, sizeof(__pyx_k_control_group_should_be_string_b), 0, 1, 0, 0},
  {&__pyx_n_s_control_name, __pyx_k_control_name, sizeof(__pyx_k_control_name), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_counts, __pyx_k_counts, sizeof(__pyx_k_counts), 0, 0, 1, 1},
  {&__pyx_n_s_cpu_count, __pyx_k_cpu_count, sizeof(__pyx_k_cpu_count), 0, 0, 1, 1},
  {&__pyx_n_s_cur_node_summary_n, __pyx_k_cur_node_summary_n, sizeof(__pyx_k_cur_node_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_cur_node_summary_p, __pyx_k_cur_node_summary_p, sizeof(__pyx_k_cur_node_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_cur_summary_n, __pyx_k_cur_summary_n, sizeof(__pyx_k_cur_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_cur_summary_p, __pyx_k_cur_summary_p, sizeof(__pyx_k_cur_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_currentDivergence, __pyx_k_currentDivergence, sizeof(__pyx_k_currentDivergence), 0, 0, 1, 1},
  {&__pyx_n_s_currentNodeSummary, __pyx_k_currentNodeSummary, sizeof(__pyx_k_currentNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_currentScore, __pyx_k_currentScore, sizeof(__pyx_k_currentScore), 0, 0, 1, 1},
  {&__pyx_n_s_currentScoreD, __pyx_k_currentScoreD, sizeof(__pyx_k_currentScoreD), 0, 0, 1, 1},
  {&__pyx_kp_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 0},
  {&__pyx_n_s_d_res, __pyx_k_d_res, sizeof(__pyx_k_d_res), 0, 0, 1, 1},
  {&__pyx_n_s_dataMissing, __pyx_k_dataMissing, sizeof(__pyx_k_dataMissing), 0, 0, 1, 1},
  {&__pyx_n_s_dcY, __pyx_k_dcY, sizeof(__pyx_k_dcY), 0, 0, 1, 1},
  {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
  {&__pyx_n_s_delayed, __pyx_k_delayed, sizeof(__pyx_k_delayed), 0, 0, 1, 1},
  {&__pyx_n_u_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 1, 0, 1},
  {&__pyx_n_s_delta_cols, __pyx_k_delta_cols, sizeof(__pyx_k_delta_cols), 0, 0, 1, 1},
  {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1},
  {&__pyx_n_s_df_res, __pyx_k_df_res, sizeof(__pyx_k_df_res), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_diff, __pyx_k_diff, sizeof(__pyx_k_diff), 0, 0, 1, 1},
  {&__pyx_n_s_diff_sq, __pyx_k_diff_sq, sizeof(__pyx_k_diff_sq), 0, 0, 1, 1},
  {&__pyx_n_s_divideSet, __pyx_k_divideSet, sizeof(__pyx_k_divideSet), 0, 0, 1, 1},
  {&__pyx_n_s_divideSet_len, __pyx_k_divideSet_len, sizeof(__pyx_k_divideSet_len), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  {&__pyx_n_s_early_stopping_eval_diff_scale, __pyx_k_early_stopping_eval_diff_scale, sizeof(__pyx_k_early_stopping_eval_diff_scale), 0, 0, 1, 1},
  {&__pyx_n_s_early_stopping_flag, __pyx_k_early_stopping_flag, sizeof(__pyx_k_early_stopping_flag), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_estimation_sample_size, __pyx_k_estimation_sample_size, sizeof(__pyx_k_estimation_sample_size), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_CIT, __pyx_k_evaluate_CIT, sizeof(__pyx_k_evaluate_CIT), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_CTS, __pyx_k_evaluate_CTS, sizeof(__pyx_k_evaluate_CTS), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_Chi, __pyx_k_evaluate_Chi, sizeof(__pyx_k_evaluate_Chi), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_DDP, __pyx_k_evaluate_DDP, sizeof(__pyx_k_evaluate_DDP), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_ED, __pyx_k_evaluate_ED, sizeof(__pyx_k_evaluate_ED), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_IDDP, __pyx_k_evaluate_IDDP, sizeof(__pyx_k_evaluate_IDDP), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_IT, __pyx_k_evaluate_IT, sizeof(__pyx_k_evaluate_IT), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_KL, __pyx_k_evaluate_KL, sizeof(__pyx_k_evaluate_KL), 0, 0, 1, 1},
  {&__pyx_n_s_evaluationFunction, __pyx_k_evaluationFunction, sizeof(__pyx_k_evaluationFunction), 0, 0, 1, 1},
  {&__pyx_kp_u_evaluationFunction_should_be_eit, __pyx_k_evaluationFunction_should_be_eit, sizeof(__pyx_k_evaluationFunction_should_be_eit), 0, 1, 0, 0},
  {&__pyx_n_s_falseBranch, __pyx_k_falseBranch, sizeof(__pyx_k_falseBranch), 0, 0, 1, 1},
  {&__pyx_n_s_falseNodeSummary, __pyx_k_falseNodeSummary, sizeof(__pyx_k_falseNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_falseScoreD, __pyx_k_falseScoreD, sizeof(__pyx_k_falseScoreD), 0, 0, 1, 1},
  {&__pyx_n_s_fcount, __pyx_k_fcount, sizeof(__pyx_k_fcount), 0, 0, 1, 1},
  {&__pyx_n_s_feature_imp_dict, __pyx_k_feature_imp_dict, sizeof(__pyx_k_feature_imp_dict), 0, 0, 1, 1},
  {&__pyx_n_s_feature_importances, __pyx_k_feature_importances, sizeof(__pyx_k_feature_importances), 0, 0, 1, 1},
  {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1},
  {&__pyx_n_s_fillTree, __pyx_k_fillTree, sizeof(__pyx_k_fillTree), 0, 0, 1, 1},
  {&__pyx_n_s_filt, __pyx_k_filt, sizeof(__pyx_k_filt), 0, 0, 1, 1},
  {&__pyx_n_s_fit, __pyx_k_fit, sizeof(__pyx_k_fit), 0, 0, 1, 1},
  {&__pyx_n_s_fitted_uplift_tree, __pyx_k_fitted_uplift_tree, sizeof(__pyx_k_fitted_uplift_tree), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_u_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 1, 0, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  {&__pyx_n_s_fr, __pyx_k_fr, sizeof(__pyx_k_fr), 0, 0, 1, 1},
  {&__pyx_n_s_full_output, __pyx_k_full_output, sizeof(__pyx_k_full_output), 0, 0, 1, 1},
  {&__pyx_n_s_fw, __pyx_k_fw, sizeof(__pyx_k_fw), 0, 0, 1, 1},
  {&__pyx_n_s_g_s, __pyx_k_g_s, sizeof(__pyx_k_g_s), 0, 0, 1, 1},
  {&__pyx_n_s_gain, __pyx_k_gain, sizeof(__pyx_k_gain), 0, 0, 1, 1},
  {&__pyx_n_s_gain_for_imp, __pyx_k_gain_for_imp, sizeof(__pyx_k_gain_for_imp), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
  {&__pyx_n_s_group_count_arr, __pyx_k_group_count_arr, sizeof(__pyx_k_group_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_group_counts_by_divide, __pyx_k_group_counts_by_divide, sizeof(__pyx_k_group_counts_by_divide), 0, 0, 1, 1},
  {&__pyx_n_u_group_size, __pyx_k_group_size, sizeof(__pyx_k_group_size), 0, 1, 0, 1},
  {&__pyx_n_s_group_uniqueCounts, __pyx_k_group_uniqueCounts, sizeof(__pyx_k_group_uniqueCounts), 0, 0, 1, 1},
  {&__pyx_n_s_group_uniqueCounts_to_arr, __pyx_k_group_uniqueCounts_to_arr, sizeof(__pyx_k_group_uniqueCounts_to_arr), 0, 0, 1, 1},
  {&__pyx_n_s_growDecisionTreeFrom, __pyx_k_growDecisionTreeFrom, sizeof(__pyx_k_growDecisionTreeFrom), 0, 0, 1, 1},
  {&__pyx_n_s_has_parent_summary, __pyx_k_has_parent_summary, sizeof(__pyx_k_has_parent_summary), 0, 0, 1, 1},
  {&__pyx_n_s_honestApproach, __pyx_k_honestApproach, sizeof(__pyx_k_honestApproach), 0, 0, 1, 1},
  {&__pyx_n_s_honesty, __pyx_k_honesty, sizeof(__pyx_k_honesty), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_i_row, __pyx_k_i_row, sizeof(__pyx_k_i_row), 0, 0, 1, 1},
  {&__pyx_n_s_i_tau, __pyx_k_i_tau, sizeof(__pyx_k_i_tau), 0, 0, 1, 1},
  {&__pyx_n_s_i_tau_l, __pyx_k_i_tau_l, sizeof(__pyx_k_i_tau_l), 0, 0, 1, 1},
  {&__pyx_n_s_i_tau_r, __pyx_k_i_tau_r, sizeof(__pyx_k_i_tau_r), 0, 0, 1, 1},
  {&__pyx_n_s_i_tr, __pyx_k_i_tr, sizeof(__pyx_k_i_tr), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_ignore_warnings, __pyx_k_ignore_warnings, sizeof(__pyx_k_ignore_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_iinfo, __pyx_k_iinfo, sizeof(__pyx_k_iinfo), 0, 0, 1, 1},
  {&__pyx_n_s_imp, __pyx_k_imp, sizeof(__pyx_k_imp), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_u_impurity, __pyx_k_impurity, sizeof(__pyx_k_impurity), 0, 1, 0, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1},
  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
  {&__pyx_kp_u_is_passed, __pyx_k_is_passed, sizeof(__pyx_k_is_passed), 0, 1, 0, 0},
  {&__pyx_n_s_is_split_by_gt, __pyx_k_is_split_by_gt, sizeof(__pyx_k_is_split_by_gt), 0, 0, 1, 1},
  {&__pyx_n_s_issubdtype, __pyx_k_issubdtype, sizeof(__pyx_k_issubdtype), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
  {&__pyx_n_s_joblib, __pyx_k_joblib, sizeof(__pyx_k_joblib), 0, 0, 1, 1},
  {&__pyx_n_s_joblib_prefer, __pyx_k_joblib_prefer, sizeof(__pyx_k_joblib_prefer), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_leftNodeSummary, __pyx_k_leftNodeSummary, sizeof(__pyx_k_leftNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_leftScore1, __pyx_k_leftScore1, sizeof(__pyx_k_leftScore1), 0, 0, 1, 1},
  {&__pyx_n_s_left_count_arr, __pyx_k_left_count_arr, sizeof(__pyx_k_left_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_left_node_summary_n, __pyx_k_left_node_summary_n, sizeof(__pyx_k_left_node_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_left_node_summary_p, __pyx_k_left_node_summary_p, sizeof(__pyx_k_left_node_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_left_summary_n, __pyx_k_left_summary_n, sizeof(__pyx_k_left_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_left_summary_p, __pyx_k_left_summary_p, sizeof(__pyx_k_left_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_len_X, __pyx_k_len_X, sizeof(__pyx_k_len_X), 0, 0, 1, 1},
  {&__pyx_n_s_len_X_l, __pyx_k_len_X_l, sizeof(__pyx_k_len_X_l), 0, 0, 1, 1},
  {&__pyx_n_s_len_X_r, __pyx_k_len_X_r, sizeof(__pyx_k_len_X_r), 0, 0, 1, 1},
  {&__pyx_n_s_len_X_val, __pyx_k_len_X_val, sizeof(__pyx_k_len_X_val), 0, 0, 1, 1},
  {&__pyx_n_s_len_X_val_l, __pyx_k_len_X_val_l, sizeof(__pyx_k_len_X_val_l), 0, 0, 1, 1},
  {&__pyx_n_u_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 1, 0, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_lrt, __pyx_k_lrt, sizeof(__pyx_k_lrt), 0, 0, 1, 1},
  {&__pyx_n_s_lsUnique, __pyx_k_lsUnique, sizeof(__pyx_k_lsUnique), 0, 0, 1, 1},
  {&__pyx_n_s_lspercentile, __pyx_k_lspercentile, sizeof(__pyx_k_lspercentile), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_matchScore, __pyx_k_matchScore, sizeof(__pyx_k_matchScore), 0, 0, 1, 1},
  {&__pyx_n_u_matchScore, __pyx_k_matchScore, sizeof(__pyx_k_matchScore), 0, 1, 0, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_maxAbsDiff, __pyx_k_maxAbsDiff, sizeof(__pyx_k_maxAbsDiff), 0, 0, 1, 1},
  {&__pyx_n_u_maxAbsDiff, __pyx_k_maxAbsDiff, sizeof(__pyx_k_maxAbsDiff), 0, 1, 0, 1},
  {&__pyx_n_s_maxDiff, __pyx_k_maxDiff, sizeof(__pyx_k_maxDiff), 0, 0, 1, 1},
  {&__pyx_n_s_maxDiffSign, __pyx_k_maxDiffSign, sizeof(__pyx_k_maxDiffSign), 0, 0, 1, 1},
  {&__pyx_n_s_maxDiffTreatment, __pyx_k_maxDiffTreatment, sizeof(__pyx_k_maxDiffTreatment), 0, 0, 1, 1},
  {&__pyx_n_u_max_delta, __pyx_k_max_delta, sizeof(__pyx_k_max_delta), 0, 1, 0, 1},
  {&__pyx_n_s_max_depth, __pyx_k_max_depth, sizeof(__pyx_k_max_depth), 0, 0, 1, 1},
  {&__pyx_n_s_max_eps_1_pc, __pyx_k_max_eps_1_pc, sizeof(__pyx_k_max_eps_1_pc), 0, 0, 1, 1},
  {&__pyx_n_s_max_eps_pc, __pyx_k_max_eps_pc, sizeof(__pyx_k_max_eps_pc), 0, 0, 1, 1},
  {&__pyx_n_s_max_features, __pyx_k_max_features, sizeof(__pyx_k_max_features), 0, 0, 1, 1},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_minGain, __pyx_k_minGain, sizeof(__pyx_k_minGain), 0, 0, 1, 1},
  {&__pyx_n_s_min_samples_leaf, __pyx_k_min_samples_leaf, sizeof(__pyx_k_min_samples_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_min_samples_treatment, __pyx_k_min_samples_treatment, sizeof(__pyx_k_min_samples_treatment), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_modifyEstimation, __pyx_k_modifyEstimation, sizeof(__pyx_k_modifyEstimation), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_mp, __pyx_k_mp, sizeof(__pyx_k_mp), 0, 0, 1, 1},
  {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_n_1, __pyx_k_n_1, sizeof(__pyx_k_n_1), 0, 0, 1, 1},
  {&__pyx_n_s_n_2, __pyx_k_n_2, sizeof(__pyx_k_n_2), 0, 0, 1, 1},
  {&__pyx_n_s_n_3, __pyx_k_n_3, sizeof(__pyx_k_n_3), 0, 0, 1, 1},
  {&__pyx_n_s_n_4, __pyx_k_n_4, sizeof(__pyx_k_n_4), 0, 0, 1, 1},
  {&__pyx_n_s_n_c, __pyx_k_n_c, sizeof(__pyx_k_n_c), 0, 0, 1, 1},
  {&__pyx_n_s_n_c_left, __pyx_k_n_c_left, sizeof(__pyx_k_n_c_left), 0, 0, 1, 1},
  {&__pyx_n_s_n_class, __pyx_k_n_class, sizeof(__pyx_k_n_class), 0, 0, 1, 1},
  {&__pyx_n_s_n_estimators, __pyx_k_n_estimators, sizeof(__pyx_k_n_estimators), 0, 0, 1, 1},
  {&__pyx_n_s_n_jobs, __pyx_k_n_jobs, sizeof(__pyx_k_n_jobs), 0, 0, 1, 1},
  {&__pyx_n_s_n_l_t, __pyx_k_n_l_t, sizeof(__pyx_k_n_l_t), 0, 0, 1, 1},
  {&__pyx_n_s_n_l_t_0, __pyx_k_n_l_t_0, sizeof(__pyx_k_n_l_t_0), 0, 0, 1, 1},
  {&__pyx_n_s_n_l_t_1, __pyx_k_n_l_t_1, sizeof(__pyx_k_n_l_t_1), 0, 0, 1, 1},
  {&__pyx_n_s_n_min_sams, __pyx_k_n_min_sams, sizeof(__pyx_k_n_min_sams), 0, 0, 1, 1},
  {&__pyx_n_s_n_pos, __pyx_k_n_pos, sizeof(__pyx_k_n_pos), 0, 0, 1, 1},
  {&__pyx_n_s_n_r_t, __pyx_k_n_r_t, sizeof(__pyx_k_n_r_t), 0, 0, 1, 1},
  {&__pyx_n_s_n_r_t_0, __pyx_k_n_r_t_0, sizeof(__pyx_k_n_r_t_0), 0, 0, 1, 1},
  {&__pyx_n_s_n_r_t_1, __pyx_k_n_r_t_1, sizeof(__pyx_k_n_r_t_1), 0, 0, 1, 1},
  {&__pyx_n_s_n_reg, __pyx_k_n_reg, sizeof(__pyx_k_n_reg), 0, 0, 1, 1},
  {&__pyx_n_s_n_reg_p, __pyx_k_n_reg_p, sizeof(__pyx_k_n_reg_p), 0, 0, 1, 1},
  {&__pyx_n_s_n_t, __pyx_k_n_t, sizeof(__pyx_k_n_t), 0, 0, 1, 1},
  {&__pyx_n_s_n_t_0, __pyx_k_n_t_0, sizeof(__pyx_k_n_t_0), 0, 0, 1, 1},
  {&__pyx_n_s_n_t_1, __pyx_k_n_t_1, sizeof(__pyx_k_n_t_1), 0, 0, 1, 1},
  {&__pyx_n_s_n_t_left, __pyx_k_n_t_left, sizeof(__pyx_k_n_t_left), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_nodeSummary, __pyx_k_nodeSummary, sizeof(__pyx_k_nodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_node_mst, __pyx_k_node_mst, sizeof(__pyx_k_node_mst), 0, 0, 1, 1},
  {&__pyx_n_s_node_summary_n, __pyx_k_node_summary_n, sizeof(__pyx_k_node_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_node_summary_p, __pyx_k_node_summary_p, sizeof(__pyx_k_node_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1},
  {&__pyx_n_s_normI, __pyx_k_normI, sizeof(__pyx_k_normI), 0, 0, 1, 1},
  {&__pyx_n_s_norm_factor, __pyx_k_norm_factor, sizeof(__pyx_k_norm_factor), 0, 0, 1, 1},
  {&__pyx_n_s_norm_res, __pyx_k_norm_res, sizeof(__pyx_k_norm_res), 0, 0, 1, 1},
  {&__pyx_n_s_normalization, __pyx_k_normalization, sizeof(__pyx_k_normalization), 0, 0, 1, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_num_samples, __pyx_k_num_samples, sizeof(__pyx_k_num_samples), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
  {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_observations, __pyx_k_observations, sizeof(__pyx_k_observations), 0, 0, 1, 1},
  {&__pyx_n_s_out_arr, __pyx_k_out_arr, sizeof(__pyx_k_out_arr), 0, 0, 1, 1},
  {&__pyx_n_s_out_arr_len, __pyx_k_out_arr_len, sizeof(__pyx_k_out_arr_len), 0, 0, 1, 1},
  {&__pyx_n_s_out_summary_n, __pyx_k_out_summary_n, sizeof(__pyx_k_out_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_out_summary_p, __pyx_k_out_summary_p, sizeof(__pyx_k_out_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_p_c, __pyx_k_p_c, sizeof(__pyx_k_p_c), 0, 0, 1, 1},
  {&__pyx_n_s_p_t, __pyx_k_p_t, sizeof(__pyx_k_p_t), 0, 0, 1, 1},
  {&__pyx_n_s_p_value, __pyx_k_p_value, sizeof(__pyx_k_p_value), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_packaging, __pyx_k_packaging, sizeof(__pyx_k_packaging), 0, 0, 1, 1},
  {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1},
  {&__pyx_n_s_parentNodeSummary, __pyx_k_parentNodeSummary, sizeof(__pyx_k_parentNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_parentNodeSummary_p, __pyx_k_parentNodeSummary_p, sizeof(__pyx_k_parentNodeSummary_p), 0, 0, 1, 1},
  {&__pyx_n_s_parent_summary_p, __pyx_k_parent_summary_p, sizeof(__pyx_k_parent_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_parse, __pyx_k_parse, sizeof(__pyx_k_parse), 0, 0, 1, 1},
  {&__pyx_n_s_pc, __pyx_k_pc, sizeof(__pyx_k_pc), 0, 0, 1, 1},
  {&__pyx_n_s_pc_a, __pyx_k_pc_a, sizeof(__pyx_k_pc_a), 0, 0, 1, 1},
  {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1},
  {&__pyx_n_s_percentile, __pyx_k_percentile, sizeof(__pyx_k_percentile), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_power, __pyx_k_power, sizeof(__pyx_k_power), 0, 0, 1, 1},
  {&__pyx_n_s_pred_leaf, __pyx_k_pred_leaf, sizeof(__pyx_k_pred_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_pred_nodes, __pyx_k_pred_nodes, sizeof(__pyx_k_pred_nodes), 0, 0, 1, 1},
  {&__pyx_n_s_predict, __pyx_k_predict, sizeof(__pyx_k_predict), 0, 0, 1, 1},
  {&__pyx_n_s_prefer, __pyx_k_prefer, sizeof(__pyx_k_prefer), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prune, __pyx_k_prune, sizeof(__pyx_k_prune), 0, 0, 1, 1},
  {&__pyx_n_s_pruneTree, __pyx_k_pruneTree, sizeof(__pyx_k_pruneTree), 0, 0, 1, 1},
  {&__pyx_n_s_pt_a, __pyx_k_pt_a, sizeof(__pyx_k_pt_a), 0, 0, 1, 1},
  {&__pyx_n_s_pt_a_i, __pyx_k_pt_a_i, sizeof(__pyx_k_pt_a_i), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_randint, __pyx_k_randint, sizeof(__pyx_k_randint), 0, 0, 1, 1},
  {&__pyx_n_s_random_state, __pyx_k_random_state, sizeof(__pyx_k_random_state), 0, 0, 1, 1},
  {&__pyx_n_s_random_state_2, __pyx_k_random_state_2, sizeof(__pyx_k_random_state_2), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_u_recommended_treatment, __pyx_k_recommended_treatment, sizeof(__pyx_k_recommended_treatment), 0, 1, 0, 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_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
  {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  {&__pyx_n_s_rightNodeSummary, __pyx_k_rightNodeSummary, sizeof(__pyx_k_rightNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_rightScore2, __pyx_k_rightScore2, sizeof(__pyx_k_rightScore2), 0, 0, 1, 1},
  {&__pyx_n_s_right_count_arr, __pyx_k_right_count_arr, sizeof(__pyx_k_right_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_right_node_summary_n, __pyx_k_right_node_summary_n, sizeof(__pyx_k_right_node_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_right_node_summary_p, __pyx_k_right_node_summary_p, sizeof(__pyx_k_right_node_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_right_summary_n, __pyx_k_right_summary_n, sizeof(__pyx_k_right_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_right_summary_p, __pyx_k_right_summary_p, sizeof(__pyx_k_right_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_s_rule, __pyx_k_rule, sizeof(__pyx_k_rule), 0, 0, 1, 1},
  {&__pyx_n_s_s_1, __pyx_k_s_1, sizeof(__pyx_k_s_1), 0, 0, 1, 1},
  {&__pyx_n_s_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 0, 1, 1},
  {&__pyx_n_s_s_3, __pyx_k_s_3, sizeof(__pyx_k_s_3), 0, 0, 1, 1},
  {&__pyx_n_s_s_4, __pyx_k_s_4, sizeof(__pyx_k_s_4), 0, 0, 1, 1},
  {&__pyx_n_u_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 1, 0, 1},
  {&__pyx_n_s_scipy_stats, __pyx_k_scipy_stats, sizeof(__pyx_k_scipy_stats), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_shuffle, __pyx_k_shuffle, sizeof(__pyx_k_shuffle), 0, 0, 1, 1},
  {&__pyx_n_s_sigma, __pyx_k_sigma, sizeof(__pyx_k_sigma), 0, 0, 1, 1},
  {&__pyx_n_s_sign, __pyx_k_sign, sizeof(__pyx_k_sign), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_sklearn, __pyx_k_sklearn, sizeof(__pyx_k_sklearn), 0, 0, 1, 1},
  {&__pyx_n_s_sklearn_model_selection, __pyx_k_sklearn_model_selection, sizeof(__pyx_k_sklearn_model_selection), 0, 0, 1, 1},
  {&__pyx_n_s_sklearn_utils, __pyx_k_sklearn_utils, sizeof(__pyx_k_sklearn_utils), 0, 0, 1, 1},
  {&__pyx_n_s_sklearn_utils__testing, __pyx_k_sklearn_utils__testing, sizeof(__pyx_k_sklearn_utils__testing), 0, 0, 1, 1},
  {&__pyx_n_s_sklearn_utils_testing, __pyx_k_sklearn_utils_testing, sizeof(__pyx_k_sklearn_utils_testing), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_sse_tau, __pyx_k_sse_tau, sizeof(__pyx_k_sse_tau), 0, 0, 1, 1},
  {&__pyx_n_s_sse_tau_l, __pyx_k_sse_tau_l, sizeof(__pyx_k_sse_tau_l), 0, 0, 1, 1},
  {&__pyx_n_s_sse_tau_r, __pyx_k_sse_tau_r, sizeof(__pyx_k_sse_tau_r), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_stat, __pyx_k_stat, sizeof(__pyx_k_stat), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_stratify, __pyx_k_stratify, sizeof(__pyx_k_stratify), 0, 0, 1, 1},
  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_suboptTreatment, __pyx_k_suboptTreatment, sizeof(__pyx_k_suboptTreatment), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_sum_n, __pyx_k_sum_n, sizeof(__pyx_k_sum_n), 0, 0, 1, 1},
  {&__pyx_n_s_sum_n_t, __pyx_k_sum_n_t, sizeof(__pyx_k_sum_n_t), 0, 0, 1, 1},
  {&__pyx_n_s_sum_n_t_left, __pyx_k_sum_n_t_left, sizeof(__pyx_k_sum_n_t_left), 0, 0, 1, 1},
  {&__pyx_n_s_summary, __pyx_k_summary, sizeof(__pyx_k_summary), 0, 0, 1, 1},
  {&__pyx_n_s_t_est, __pyx_k_t_est, sizeof(__pyx_k_t_est), 0, 0, 1, 1},
  {&__pyx_n_s_tcount, __pyx_k_tcount, sizeof(__pyx_k_tcount), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_size, __pyx_k_test_size, sizeof(__pyx_k_test_size), 0, 0, 1, 1},
  {&__pyx_n_u_threads, __pyx_k_threads, sizeof(__pyx_k_threads), 0, 1, 0, 1},
  {&__pyx_n_s_threshold_val, __pyx_k_threshold_val, sizeof(__pyx_k_threshold_val), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_total_count_arr, __pyx_k_total_count_arr, sizeof(__pyx_k_total_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_tr, __pyx_k_tr, sizeof(__pyx_k_tr), 0, 0, 1, 1},
  {&__pyx_n_s_train_test_split, __pyx_k_train_test_split, sizeof(__pyx_k_train_test_split), 0, 0, 1, 1},
  {&__pyx_n_s_treatment, __pyx_k_treatment, sizeof(__pyx_k_treatment), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_group, __pyx_k_treatment_group, sizeof(__pyx_k_treatment_group), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_groups, __pyx_k_treatment_groups, sizeof(__pyx_k_treatment_groups), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_idx, __pyx_k_treatment_idx, sizeof(__pyx_k_treatment_idx), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_idx_est, __pyx_k_treatment_idx_est, sizeof(__pyx_k_treatment_idx_est), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_left, __pyx_k_treatment_left, sizeof(__pyx_k_treatment_left), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_right, __pyx_k_treatment_right, sizeof(__pyx_k_treatment_right), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_train_bt, __pyx_k_treatment_train_bt, sizeof(__pyx_k_treatment_train_bt), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_val, __pyx_k_treatment_val, sizeof(__pyx_k_treatment_val), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_val_bt, __pyx_k_treatment_val_bt, sizeof(__pyx_k_treatment_val_bt), 0, 0, 1, 1},
  {&__pyx_n_s_treatment_val_idx, __pyx_k_treatment_val_idx, sizeof(__pyx_k_treatment_val_idx), 0, 0, 1, 1},
  {&__pyx_n_s_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 0, 0, 1, 1},
  {&__pyx_n_s_tree_node_summary, __pyx_k_tree_node_summary, sizeof(__pyx_k_tree_node_summary), 0, 0, 1, 1},
  {&__pyx_n_s_tree_node_summary_from_counts, __pyx_k_tree_node_summary_from_counts, sizeof(__pyx_k_tree_node_summary_from_counts), 0, 0, 1, 1},
  {&__pyx_n_s_tree_node_summary_to_arr, __pyx_k_tree_node_summary_to_arr, sizeof(__pyx_k_tree_node_summary_to_arr), 0, 0, 1, 1},
  {&__pyx_n_s_trueBranch, __pyx_k_trueBranch, sizeof(__pyx_k_trueBranch), 0, 0, 1, 1},
  {&__pyx_n_s_trueNodeSummary, __pyx_k_trueNodeSummary, sizeof(__pyx_k_trueNodeSummary), 0, 0, 1, 1},
  {&__pyx_n_s_trueScoreD, __pyx_k_trueScoreD, sizeof(__pyx_k_trueScoreD), 0, 0, 1, 1},
  {&__pyx_n_s_tv, __pyx_k_tv, sizeof(__pyx_k_tv), 0, 0, 1, 1},
  {&__pyx_n_s_tw, __pyx_k_tw, sizeof(__pyx_k_tw), 0, 0, 1, 1},
  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
  {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1},
  {&__pyx_n_s_unique, __pyx_k_unique, sizeof(__pyx_k_unique), 0, 0, 1, 1},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upliftScore, __pyx_k_upliftScore, sizeof(__pyx_k_upliftScore), 0, 0, 1, 1},
  {&__pyx_n_u_upliftScore, __pyx_k_upliftScore, sizeof(__pyx_k_upliftScore), 0, 1, 0, 1},
  {&__pyx_n_s_uplift_classification_results, __pyx_k_uplift_classification_results, sizeof(__pyx_k_uplift_classification_results), 0, 0, 1, 1},
  {&__pyx_n_s_uplift_forest, __pyx_k_uplift_forest, sizeof(__pyx_k_uplift_forest), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_val_left_count_arr, __pyx_k_val_left_count_arr, sizeof(__pyx_k_val_left_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_val_left_summary_n, __pyx_k_val_left_summary_n, sizeof(__pyx_k_val_left_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_val_left_summary_p, __pyx_k_val_left_summary_p, sizeof(__pyx_k_val_left_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_val_right_count_arr, __pyx_k_val_right_count_arr, sizeof(__pyx_k_val_right_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_val_right_summary_n, __pyx_k_val_right_summary_n, sizeof(__pyx_k_val_right_summary_n), 0, 0, 1, 1},
  {&__pyx_n_s_val_right_summary_p, __pyx_k_val_right_summary_p, sizeof(__pyx_k_val_right_summary_p), 0, 0, 1, 1},
  {&__pyx_n_s_val_total_count_arr, __pyx_k_val_total_count_arr, sizeof(__pyx_k_val_total_count_arr), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_w_1, __pyx_k_w_1, sizeof(__pyx_k_w_1), 0, 0, 1, 1},
  {&__pyx_n_s_w_2, __pyx_k_w_2, sizeof(__pyx_k_w_2), 0, 0, 1, 1},
  {&__pyx_n_s_w_3, __pyx_k_w_3, sizeof(__pyx_k_w_3), 0, 0, 1, 1},
  {&__pyx_n_s_w_4, __pyx_k_w_4, sizeof(__pyx_k_w_4), 0, 0, 1, 1},
  {&__pyx_n_s_w_l, __pyx_k_w_l, sizeof(__pyx_k_w_l), 0, 0, 1, 1},
  {&__pyx_n_s_w_r, __pyx_k_w_r, sizeof(__pyx_k_w_r), 0, 0, 1, 1},
  {&__pyx_n_s_w_val_l, __pyx_k_w_val_l, sizeof(__pyx_k_w_val_l), 0, 0, 1, 1},
  {&__pyx_n_s_w_val_r, __pyx_k_w_val_r, sizeof(__pyx_k_w_val_r), 0, 0, 1, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_x_train_bt, __pyx_k_x_train_bt, sizeof(__pyx_k_x_train_bt), 0, 0, 1, 1},
  {&__pyx_n_s_x_val_bt, __pyx_k_x_val_bt, sizeof(__pyx_k_x_val_bt), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_y_est, __pyx_k_y_est, sizeof(__pyx_k_y_est), 0, 0, 1, 1},
  {&__pyx_n_s_y_l, __pyx_k_y_l, sizeof(__pyx_k_y_l), 0, 0, 1, 1},
  {&__pyx_n_s_y_l_0, __pyx_k_y_l_0, sizeof(__pyx_k_y_l_0), 0, 0, 1, 1},
  {&__pyx_n_s_y_l_1, __pyx_k_y_l_1, sizeof(__pyx_k_y_l_1), 0, 0, 1, 1},
  {&__pyx_n_s_y_pred_ensemble, __pyx_k_y_pred_ensemble, sizeof(__pyx_k_y_pred_ensemble), 0, 0, 1, 1},
  {&__pyx_n_s_y_r, __pyx_k_y_r, sizeof(__pyx_k_y_r), 0, 0, 1, 1},
  {&__pyx_n_s_y_r_0, __pyx_k_y_r_0, sizeof(__pyx_k_y_r_0), 0, 0, 1, 1},
  {&__pyx_n_s_y_r_1, __pyx_k_y_r_1, sizeof(__pyx_k_y_r_1), 0, 0, 1, 1},
  {&__pyx_n_s_y_train_bt, __pyx_k_y_train_bt, sizeof(__pyx_k_y_train_bt), 0, 0, 1, 1},
  {&__pyx_n_s_y_val, __pyx_k_y_val, sizeof(__pyx_k_y_val), 0, 0, 1, 1},
  {&__pyx_n_s_y_val_bt, __pyx_k_y_val_bt, sizeof(__pyx_k_y_val_bt), 0, 0, 1, 1},
  {&__pyx_n_s_y_val_l, __pyx_k_y_val_l, sizeof(__pyx_k_y_val_l), 0, 0, 1, 1},
  {&__pyx_n_s_y_val_r, __pyx_k_y_val_r, sizeof(__pyx_k_y_val_r), 0, 0, 1, 1},
  {&__pyx_n_s_yv, __pyx_k_yv, sizeof(__pyx_k_yv), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {&__pyx_n_s_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 858, __pyx_L1_error)
  __pyx_builtin_FutureWarning = __Pyx_GetBuiltinName(__pyx_n_s_FutureWarning); if (!__pyx_builtin_FutureWarning) __PYX_ERR(0, 2547, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 237, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 475, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 485, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 821, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 827, __pyx_L1_error)
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 1513, __pyx_L1_error)
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 2329, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __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);

  /* "causalml/inference/tree/uplift.pyx":485
 * 
 *         if (self.n_class > 2) and (self.evaluationFunction in [self.evaluate_DDP, self.evaluate_IDDP, self.evaluate_IT, self.evaluate_CIT]):
 *             raise ValueError("The DDP, IDDP, IT, and CIT approach can only cope with two class problems, that is two different treatment "             # <<<<<<<<<<<<<<
 *                              "options (e.g., control vs treatment). Please select another approach or only use a "
 *                              "dataset which employs two treatment options.")
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_The_DDP_IDDP_IT_and_CIT_approach); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "causalml/inference/tree/uplift.pyx":544
 *         # Get treatment group keys. self.classes_[0] is reserved for the control group.
 *         treatment_idx = np.zeros_like(treatment)
 *         for i, tr in enumerate(self.classes_[1:], 1):             # <<<<<<<<<<<<<<
 *             treatment_idx[treatment == tr] = i
 * 
 */
  __pyx_slice__3 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__3);
  __Pyx_GIVEREF(__pyx_slice__3);

  /* "causalml/inference/tree/uplift.pyx":883
 *         # for int and float values
 *         if np.issubdtype(value.dtype, np.number):
 *             filt = X[:, column] >= value             # <<<<<<<<<<<<<<
 *         else:  # for strings
 *             filt = X[:, column] == value
 */
  __pyx_slice__7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__7);
  __Pyx_GIVEREF(__pyx_slice__7);

  /* "causalml/inference/tree/uplift.pyx":2277
 *         '''
 * 
 *         def classifyWithoutMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming without missing data.
 */
  __pyx_tuple__8 = PyTuple_Pack(4, __pyx_n_s_observations, __pyx_n_s_tree, __pyx_n_s_v, __pyx_n_s_branch); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_classifyWithoutMissingData, 2277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 2277, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2308
 *             return classifyWithoutMissingData(observations, branch)
 * 
 *         def classifyWithMissingData(observations, tree):             # <<<<<<<<<<<<<<
 *             '''
 *             Classifies (prediction) the observations according to the tree, assuming with missing data.
 */
  __pyx_tuple__10 = PyTuple_Pack(12, __pyx_n_s_observations, __pyx_n_s_tree, __pyx_n_s_v, __pyx_n_s_tr, __pyx_n_s_fr, __pyx_n_s_tcount, __pyx_n_s_fcount, __pyx_n_s_tw, __pyx_n_s_fw, __pyx_n_s_result, __pyx_n_s_k, __pyx_n_s_branch); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 2308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_classifyWithMissingData, 2308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 2308, __pyx_L1_error)

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":944
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "../../../../private/var/folders/fl/7k6qv4d52nd7yt716k81s4fm0000gn/T/build-env-4vyyya2z/lib/python3.8/site-packages/numpy/__init__.pxd":950
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "View.MemoryView":134
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "View.MemoryView":137
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "View.MemoryView":149
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "View.MemoryView":177
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "View.MemoryView":193
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "(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__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "(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__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "View.MemoryView":420
 *     def __setitem__(memoryview self, object index, object value):
 *         if self.view.readonly:
 *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "View.MemoryView":497
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "View.MemoryView":522
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_WRITABLE and self.view.readonly:
 *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_ND:
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "View.MemoryView":572
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "View.MemoryView":579
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
  __pyx_tuple__25 = PyTuple_New(1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_tuple__25, 0, __pyx_int_neg_1);
  __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(2, 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(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "View.MemoryView":705
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "(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__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "(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__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_tuple__31 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "causalml/inference/tree/uplift.pyx":37
 * from sklearn.utils import check_X_y, check_array, check_random_state
 * 
 * if version.parse(sklearn.__version__) >= version.parse('0.22.0'):             # <<<<<<<<<<<<<<
 *     from sklearn.utils._testing import ignore_warnings
 * else:
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_u_0_22_0); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "causalml/inference/tree/uplift.pyx":54
 * MAX_INT = np.iinfo(np.int32).max
 * 
 * logger = logging.getLogger("causalml")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h":
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_u_causalml); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "causalml/inference/tree/uplift.pyx":183
 *     """
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,             # <<<<<<<<<<<<<<
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 */
  __pyx_tuple__35 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_classes, __pyx_n_s_col, __pyx_n_s_value, __pyx_n_s_trueBranch, __pyx_n_s_falseBranch, __pyx_n_s_results, __pyx_n_s_summary, __pyx_n_s_maxDiffTreatment, __pyx_n_s_maxDiffSign, __pyx_n_s_nodeSummary, __pyx_n_s_backupResults, __pyx_n_s_bestTreatment, __pyx_n_s_upliftScore, __pyx_n_s_matchScore); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(15, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_init, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 183, __pyx_L1_error)
  __pyx_tuple__37 = PyTuple_Pack(13, ((PyObject *)__pyx_int_neg_1), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject*)__pyx_float_1_), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "causalml/inference/tree/uplift.pyx":205
 * 
 * 
 * def group_uniqueCounts_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                               np.ndarray[Y_TYPE_t, ndim=1] y,
 *                               np.ndarray[N_TYPE_t, ndim=1] out_arr):
 */
  __pyx_tuple__38 = PyTuple_Pack(9, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_out_arr, __pyx_n_s_out_arr_len, __pyx_n_s_n_class, __pyx_n_s_num_samples, __pyx_n_s_yv, __pyx_n_s_tv, __pyx_n_s_i); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_group_uniqueCounts_to_arr, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 205, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":252
 *     # done, modified out_arr, so no need to return it
 * 
 * def group_counts_by_divide(             # <<<<<<<<<<<<<<
 *         col_vals, threshold_val, is_split_by_gt,
 *         np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,
 */
  __pyx_tuple__40 = PyTuple_Pack(14, __pyx_n_s_col_vals, __pyx_n_s_threshold_val, __pyx_n_s_is_split_by_gt, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_out_arr, __pyx_n_s_out_arr_len, __pyx_n_s_n_class, __pyx_n_s_num_samples, __pyx_n_s_yv, __pyx_n_s_tv, __pyx_n_s_i, __pyx_n_s_len_X_l, __pyx_n_s_filt); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(6, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_group_counts_by_divide, 252, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 252, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":385
 * 
 *     """
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,             # <<<<<<<<<<<<<<
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 */
  __pyx_tuple__42 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_control_name, __pyx_n_s_max_features, __pyx_n_s_max_depth, __pyx_n_s_min_samples_leaf, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_n_s_evaluationFunction, __pyx_n_s_normalization, __pyx_n_s_honesty, __pyx_n_s_estimation_sample_size, __pyx_n_s_random_state); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(13, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_init, 385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 385, __pyx_L1_error)
  __pyx_tuple__44 = PyTuple_Pack(11, ((PyObject *)Py_None), ((PyObject *)__pyx_int_3), ((PyObject *)__pyx_int_100), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100), ((PyObject *)__pyx_int_1), ((PyObject*)__pyx_n_u_KL), ((PyObject *)Py_True), ((PyObject *)Py_False), ((PyObject*)__pyx_float_0_5), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "causalml/inference/tree/uplift.pyx":437
 * 
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """ Fit the uplift model.
 * 
 */
  __pyx_tuple__45 = PyTuple_Pack(18, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment, __pyx_n_s_y, __pyx_n_s_X_val, __pyx_n_s_treatment_val, __pyx_n_s_y_val, __pyx_n_s_treatment_groups, __pyx_n_s_treatment_idx, __pyx_n_s_treatment_val_idx, __pyx_n_s_i, __pyx_n_s_tr, __pyx_n_s_X_est, __pyx_n_s_treatment_idx_est, __pyx_n_s_y_est, __pyx_n_s_col, __pyx_n_s_imp, __pyx_n_s_x); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(7, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_fit, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 437, __pyx_L1_error)
  __pyx_tuple__47 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "causalml/inference/tree/uplift.pyx":515
 * 
 *     # Prune Trees
 *     def prune(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff'):             # <<<<<<<<<<<<<<
 *         """ Prune the uplift model.
 *         Args
 */
  __pyx_tuple__48 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment, __pyx_n_s_y, __pyx_n_s_minGain, __pyx_n_s_rule, __pyx_n_s_treatment_idx, __pyx_n_s_i, __pyx_n_s_tr); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_prune, 515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 515, __pyx_L1_error)
  __pyx_tuple__50 = PyTuple_Pack(2, ((PyObject*)__pyx_float_0_0001), ((PyObject*)__pyx_n_u_maxAbsDiff)); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "causalml/inference/tree/uplift.pyx":555
 *         return self
 * 
 *     def honestApproach(self, X_est, T_est, Y_est):             # <<<<<<<<<<<<<<
 *         """ Apply the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 *         Args
 */
  __pyx_tuple__51 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_X_est, __pyx_n_s_T_est, __pyx_n_s_Y_est); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_honestApproach, 555, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 555, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":569
 *         self.modifyEstimation(X_est, T_est, Y_est, self.fitted_uplift_tree)
 * 
 *     def modifyEstimation(self, X_est, t_est, y_est, tree):             # <<<<<<<<<<<<<<
 *         """ Modifies the leafs of the current decision tree to only contain unbiased estimates.
 *         Applies the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 */
  __pyx_tuple__53 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_X_est, __pyx_n_s_t_est, __pyx_n_s_y_est, __pyx_n_s_tree, __pyx_n_s_X_l, __pyx_n_s_X_r, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_y_l, __pyx_n_s_y_r); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_modifyEstimation, 569, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 569, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":598
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,             # <<<<<<<<<<<<<<
 *                   n_reg=0,
 *                   parentNodeSummary=None):
 */
  __pyx_tuple__55 = PyTuple_Pack(22, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_tree, __pyx_n_s_rule, __pyx_n_s_minGain, __pyx_n_s_n_reg, __pyx_n_s_parentNodeSummary, __pyx_n_s_currentNodeSummary, __pyx_n_s_X_l, __pyx_n_s_X_r, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_y_l, __pyx_n_s_y_r, __pyx_n_s_currentScoreD, __pyx_n_s_trueNodeSummary, __pyx_n_s_trueScoreD, __pyx_n_s_falseNodeSummary, __pyx_n_s_falseScoreD, __pyx_n_s_gain); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(9, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_pruneTree, 598, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 598, __pyx_L1_error)
  __pyx_tuple__57 = PyTuple_Pack(4, ((PyObject*)__pyx_n_u_maxAbsDiff), ((PyObject*)__pyx_float_0_), ((PyObject *)__pyx_int_0), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "causalml/inference/tree/uplift.pyx":750
 *         return self
 * 
 *     def fill(self, X, treatment, y):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a higher-level function to transform the original data inputs
 */
  __pyx_tuple__58 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment, __pyx_n_s_y, __pyx_n_s_treatment_idx, __pyx_n_s_i, __pyx_n_s_tr); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_fill, 750, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 750, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":781
 *         return self
 * 
 *     def fillTree(self, X, treatment_idx, y, tree):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a lower-level function to execute on the tree filling task.
 */
  __pyx_tuple__60 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_tree, __pyx_n_s_currentNodeSummary, __pyx_n_s_X_l, __pyx_n_s_X_r, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_y_l, __pyx_n_s_y_r, __pyx_n_s_matchScore, __pyx_n_s_treatment_group, __pyx_n_s_summary); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_fillTree, 781, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 781, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":834
 *         return self
 * 
 *     def predict(self, X):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */
  __pyx_tuple__63 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_pred_nodes, __pyx_n_s_i_row, __pyx_n_s_pred_leaf, __pyx_n_s__62); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_predict, 834, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 834, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":859
 * 
 *     @staticmethod
 *     def divideSet(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node split.
 */
  __pyx_tuple__65 = PyTuple_Pack(6, __pyx_n_s_X, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_column, __pyx_n_s_value, __pyx_n_s_filt); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_divideSet, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 859, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":890
 * 
 *     @staticmethod
 *     def divideSet_len(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''Tree node split.
 * 
 */
  __pyx_tuple__67 = PyTuple_Pack(7, __pyx_n_s_X, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_column, __pyx_n_s_value, __pyx_n_s_filt, __pyx_n_s_len_X_l); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_divideSet_len, 890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 890, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":926
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 *     def group_uniqueCounts(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Count sample size by experiment group.
 */
  __pyx_tuple__69 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_results, __pyx_n_s_i, __pyx_n_s_filt, __pyx_n_s_n_pos); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_group_uniqueCounts, 926, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 926, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":953
 * 
 *     @staticmethod
 *     def evaluate_KL(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate KL Divergence as split evaluation criterion for a given node.
 */
  __pyx_tuple__71 = PyTuple_Pack(4, __pyx_n_s_nodeSummary, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_KL, 953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 953, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":974
 * 
 *     @staticmethod
 *     def arr_evaluate_KL(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__73 = PyTuple_Pack(6, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_i); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_KL, 974, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 974, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1004
 * 
 *     @staticmethod
 *     def evaluate_ED(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Euclidean Distance as split evaluation criterion for a given node.
 */
  __pyx_tuple__75 = PyTuple_Pack(4, __pyx_n_s_nodeSummary, __pyx_n_s_pc, __pyx_n_s_d_res, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_ED, 1004, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 1004, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1025
 * 
 *     @staticmethod
 *     def arr_evaluate_ED(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__77 = PyTuple_Pack(6, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_i); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_ED, 1025, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1025, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1054
 * 
 *     @staticmethod
 *     def evaluate_Chi(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Chi-Square statistic as split evaluation criterion for a given node.
 */
  __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_nodeSummary, __pyx_n_s_pc, __pyx_n_s_d_res, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_Chi, 1054, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1054, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1075
 * 
 *     @staticmethod
 *     def arr_evaluate_Chi(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__81 = PyTuple_Pack(9, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_i, __pyx_n_s_max_eps_pc, __pyx_n_s_max_eps_1_pc, __pyx_n_s_diff_sq); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_Chi, 1075, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 1075, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1108
 * 
 *     @staticmethod
 *     def evaluate_DDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */
  __pyx_tuple__83 = PyTuple_Pack(4, __pyx_n_s_nodeSummary, __pyx_n_s_pc, __pyx_n_s_d_res, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_DDP, 1108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1108, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1128
 * 
 *     @staticmethod
 *     def arr_evaluate_DDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__85 = PyTuple_Pack(6, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_i); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_DDP, 1128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1128, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1157
 * 
 *     @staticmethod
 *     def evaluate_IT(leftNodeSummary, rightNodeSummary, w_l, w_r):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Squared T-Statistic as split evaluation criterion for a given node
 */
  __pyx_tuple__87 = PyTuple_Pack(25, __pyx_n_s_leftNodeSummary, __pyx_n_s_rightNodeSummary, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_g_s, __pyx_n_s_y_l_0, __pyx_n_s_y_r_0, __pyx_n_s_n_3, __pyx_n_s_n_4, __pyx_n_s_s_3, __pyx_n_s_s_4, __pyx_n_s_treatment_left, __pyx_n_s_treatment_right, __pyx_n_s_y_l_1, __pyx_n_s_y_r_1, __pyx_n_s_n_1, __pyx_n_s_n_2, __pyx_n_s_s_1, __pyx_n_s_s_2, __pyx_n_s_sum_n, __pyx_n_s_w_1, __pyx_n_s_w_2, __pyx_n_s_w_3, __pyx_n_s_w_4, __pyx_n_s_sigma); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(4, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_IT, 1157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 1157, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1216
 * 
 *     @staticmethod
 *     def arr_evaluate_IT(np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] left_node_summary_n,
 *                         np.ndarray[P_TYPE_t, ndim=1] right_node_summary_p,
 */
  __pyx_tuple__89 = PyTuple_Pack(23, __pyx_n_s_left_node_summary_p, __pyx_n_s_left_node_summary_n, __pyx_n_s_right_node_summary_p, __pyx_n_s_right_node_summary_n, __pyx_n_s_y_l_0, __pyx_n_s_y_r_0, __pyx_n_s_n_3, __pyx_n_s_n_4, __pyx_n_s_s_3, __pyx_n_s_s_4, __pyx_n_s_y_l_1, __pyx_n_s_y_r_1, __pyx_n_s_n_1, __pyx_n_s_n_2, __pyx_n_s_s_1, __pyx_n_s_s_2, __pyx_n_s_sum_n, __pyx_n_s_w_1, __pyx_n_s_w_2, __pyx_n_s_w_3, __pyx_n_s_w_4, __pyx_n_s_sigma, __pyx_n_s_g_s); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_IT, 1216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1216, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1287
 * 
 *     @staticmethod
 *     def evaluate_CIT(currentNodeSummary, leftNodeSummary, rightNodeSummary, y_l, y_r, w_l, w_r, y, w):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate likelihood ratio test statistic as split evaluation criterion for a given node
 */
  __pyx_tuple__91 = PyTuple_Pack(27, __pyx_n_s_currentNodeSummary, __pyx_n_s_leftNodeSummary, __pyx_n_s_rightNodeSummary, __pyx_n_s_y_l, __pyx_n_s_y_r, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_y, __pyx_n_s_w, __pyx_n_s_lrt, __pyx_n_s_n_l_t_0, __pyx_n_s_n_r_t_0, __pyx_n_s_treatment_left, __pyx_n_s_treatment_right, __pyx_n_s_n_l_t_1, __pyx_n_s_n_r_t_1, __pyx_n_s_n_l_t, __pyx_n_s_n_r_t, __pyx_n_s_n_t, __pyx_n_s_n_t_1, __pyx_n_s_n_t_0, __pyx_n_s_sse_tau_l, __pyx_n_s_sse_tau_r, __pyx_n_s_sse_tau, __pyx_n_s_i_tau_l, __pyx_n_s_i_tau_r, __pyx_n_s_i_tau); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(9, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_CIT, 1287, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1287, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1359
 * 
 *     @staticmethod
 *     def arr_evaluate_CIT(np.ndarray[P_TYPE_t, ndim=1] cur_node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] cur_node_summary_n,
 *                          np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,
 */
  __pyx_tuple__93 = PyTuple_Pack(22, __pyx_n_s_cur_node_summary_p, __pyx_n_s_cur_node_summary_n, __pyx_n_s_left_node_summary_p, __pyx_n_s_left_node_summary_n, __pyx_n_s_right_node_summary_p, __pyx_n_s_right_node_summary_n, __pyx_n_s_lrt, __pyx_n_s_n_l_t_0, __pyx_n_s_n_r_t_0, __pyx_n_s_n_l_t_1, __pyx_n_s_n_r_t_1, __pyx_n_s_n_l_t, __pyx_n_s_n_r_t, __pyx_n_s_n_t, __pyx_n_s_n_t_1, __pyx_n_s_n_t_0, __pyx_n_s_sse_tau_l, __pyx_n_s_sse_tau_r, __pyx_n_s_sse_tau, __pyx_n_s_i_tau_l, __pyx_n_s_i_tau_r, __pyx_n_s_i_tau); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);
  __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(6, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_CIT, 1359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 1359, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1450
 * 
 *     @staticmethod
 *     def evaluate_IDDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */
  __pyx_tuple__95 = PyTuple_Pack(4, __pyx_n_s_nodeSummary, __pyx_n_s_pc, __pyx_n_s_d_res, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);
  __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_IDDP, 1450, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1450, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1471
 * 
 *     @staticmethod
 *     def arr_evaluate_IDDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                           np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__97 = PyTuple_Pack(6, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_p_c, __pyx_n_s_d_res, __pyx_n_s_i); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);
  __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_IDDP, 1471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1471, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1500
 * 
 *     @staticmethod
 *     def evaluate_CTS(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.
 */
  __pyx_tuple__99 = PyTuple_Pack(2, __pyx_n_s_nodeSummary, __pyx_n_s_stat); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_evaluate_CTS, 1500, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1500, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1516
 * 
 *     @staticmethod
 *     def arr_evaluate_CTS(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_tuple__101 = PyTuple_Pack(5, __pyx_n_s_node_summary_p, __pyx_n_s_node_summary_n, __pyx_n_s_n_class, __pyx_n_s_d_res, __pyx_n_s_i); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_evaluate_CTS, 1516, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1516, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1546
 *         return -d_res
 * 
 *     def normI(self, n_c: cython.int, n_c_left: cython.int, n_t: list, n_t_left: list, alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:             # <<<<<<<<<<<<<<
 *         '''
 *         Normalization factor.
 */
  __pyx_tuple__103 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_n_c, __pyx_n_s_n_c_left, __pyx_n_s_n_t, __pyx_n_s_n_t_left, __pyx_n_s_alpha, __pyx_n_s_currentDivergence, __pyx_n_s_norm_res, __pyx_n_s_pt_a, __pyx_n_s_pc_a, __pyx_n_s_i, __pyx_n_s_pt_a_i); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_normI, 1546, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 1546, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1594
 *         return norm_res
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,             # <<<<<<<<<<<<<<
 *                   alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:
 *         '''
 */
  __pyx_tuple__105 = PyTuple_Pack(17, __pyx_n_s_self, __pyx_n_s_cur_node_summary_n, __pyx_n_s_left_node_summary_n, __pyx_n_s_alpha, __pyx_n_s_currentDivergence, __pyx_n_s_cur_summary_n, __pyx_n_s_left_summary_n, __pyx_n_s_n_class, __pyx_n_s_i, __pyx_n_s_norm_res, __pyx_n_s_n_c, __pyx_n_s_n_c_left, __pyx_n_s_pt_a, __pyx_n_s_pt_a_i, __pyx_n_s_pc_a, __pyx_n_s_sum_n_t_left, __pyx_n_s_sum_n_t); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);
  __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(5, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_arr_normI, 1594, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 1594, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1656
 *         return norm_res
 * 
 *     def tree_node_summary(self, treatment_idx, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node summary statistics.
 */
  __pyx_tuple__107 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_parentNodeSummary, __pyx_n_s_counts, __pyx_n_s_nodeSummary, __pyx_n_s_i, __pyx_n_s_count, __pyx_n_s_n_pos, __pyx_n_s_n, __pyx_n_s_p); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_tree_node_summary, 1656, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 1656, __pyx_L1_error)
  __pyx_tuple__109 = PyTuple_Pack(3, ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 1656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);

  /* "causalml/inference/tree/uplift.pyx":1703
 * 
 *     @staticmethod
 *     def tree_node_summary_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                                  np.ndarray[Y_TYPE_t, ndim=1] y,
 *                                  np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */
  __pyx_tuple__110 = PyTuple_Pack(16, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_out_summary_p, __pyx_n_s_out_summary_n, __pyx_n_s_buf_count_arr, __pyx_n_s_parentNodeSummary_p, __pyx_n_s_has_parent_summary, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_i, __pyx_n_s_n_class, __pyx_n_s_n, __pyx_n_s_n_pos, __pyx_n_s_p, __pyx_n_s_n_min_sams, __pyx_n_s_n_reg_p); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(9, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_tree_node_summary_to_arr, 1703, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __pyx_tuple__112 = PyTuple_Pack(2, ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100)); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);

  /* "causalml/inference/tree/uplift.pyx":1786
 * 
 *     @staticmethod
 *     def tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             np.ndarray[N_TYPE_t, ndim=1] group_count_arr,
 *             np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */
  __pyx_tuple__113 = PyTuple_Pack(14, __pyx_n_s_group_count_arr, __pyx_n_s_out_summary_p, __pyx_n_s_out_summary_n, __pyx_n_s_parentNodeSummary_p, __pyx_n_s_has_parent_summary, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_i, __pyx_n_s_n_class, __pyx_n_s_n, __pyx_n_s_n_pos, __pyx_n_s_p, __pyx_n_s_n_min_sams, __pyx_n_s_n_reg_p); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(7, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_tree_node_summary_from_counts, 1786, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __pyx_tuple__115 = PyTuple_Pack(2, ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100)); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);

  /* "causalml/inference/tree/uplift.pyx":1863
 *                 out_summary_p[i] = p
 * 
 *     def uplift_classification_results(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Classification probability for each treatment in the tree node.
 */
  __pyx_tuple__116 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_counts, __pyx_n_s_res, __pyx_n_s_count, __pyx_n_s_n_pos, __pyx_n_s_n, __pyx_n_s_p); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_uplift_classification_results, 1863, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 1863, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":1889
 *         return res
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *                              early_stopping_eval_diff_scale=1, max_depth=10,
 *                              min_samples_leaf=100, depth=1,
 */
  __pyx_tuple__118 = PyTuple_Pack(98, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment_idx, __pyx_n_s_y, __pyx_n_s_X_val, __pyx_n_s_treatment_val_idx, __pyx_n_s_y_val, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_n_s_max_depth, __pyx_n_s_min_samples_leaf, __pyx_n_s_depth, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_parentNodeSummary_p, __pyx_n_s_n_class, __pyx_n_s_left_count_arr, __pyx_n_s_right_count_arr, __pyx_n_s_total_count_arr, __pyx_n_s_val_left_count_arr, __pyx_n_s_val_right_count_arr, __pyx_n_s_val_total_count_arr, __pyx_n_s_cur_summary_p, __pyx_n_s_cur_summary_n, __pyx_n_s_left_summary_p, __pyx_n_s_left_summary_n, __pyx_n_s_right_summary_p, __pyx_n_s_right_summary_n, __pyx_n_s_val_left_summary_p, __pyx_n_s_val_left_summary_n, __pyx_n_s_val_right_summary_p, __pyx_n_s_val_right_summary_n, __pyx_n_s_has_parent_summary, __pyx_n_s_parent_summary_p, __pyx_n_s_i, __pyx_n_s_currentNodeSummary, __pyx_n_s_currentScore, __pyx_n_s_maxAbsDiff, __pyx_n_s_maxDiff, __pyx_n_s_bestTreatment, __pyx_n_s_suboptTreatment, __pyx_n_s_maxDiffTreatment, __pyx_n_s_maxDiffSign, __pyx_n_s_p_c, __pyx_n_s_n_c, __pyx_n_s_n_t, __pyx_n_s_i_tr, __pyx_n_s_p_t, __pyx_n_s_diff, __pyx_n_s_p_value, __pyx_n_s_upliftScore, __pyx_n_s_bestGain, __pyx_n_s_bestGainImp, __pyx_n_s_bestAttribute, __pyx_n_s_best_col, __pyx_n_s_best_value, __pyx_n_s_len_X, __pyx_n_s_len_X_val, __pyx_n_s_c_num_percentiles, __pyx_n_s_c_cat_percentiles, __pyx_n_s_columnCount, __pyx_n_s_max_features, __pyx_n_s_col, __pyx_n_s_columnValues, __pyx_n_s_lsUnique, __pyx_n_s_is_split_by_gt, __pyx_n_s_lspercentile, __pyx_n_s_value, __pyx_n_s_len_X_l, __pyx_n_s_len_X_r, __pyx_n_s_p, __pyx_n_s_len_X_val_l, __pyx_n_s_early_stopping_flag, __pyx_n_s_k, __pyx_n_s_node_mst, __pyx_n_s_leftScore1, __pyx_n_s_rightScore2, __pyx_n_s_gain, __pyx_n_s_gain_for_imp, __pyx_n_s_currentDivergence, __pyx_n_s_norm_factor, __pyx_n_s_X_l, __pyx_n_s_X_r, __pyx_n_s_w_l, __pyx_n_s_w_r, __pyx_n_s_y_l, __pyx_n_s_y_r, __pyx_n_s_X_val_l, __pyx_n_s_X_val_r, __pyx_n_s_w_val_l, __pyx_n_s_w_val_r, __pyx_n_s_y_val_l, __pyx_n_s_y_val_r, __pyx_n_s_best_set_left, __pyx_n_s_best_set_right, __pyx_n_s_dcY, __pyx_n_s_summary, __pyx_n_s_trueBranch, __pyx_n_s_falseBranch); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(14, 0, 98, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_growDecisionTreeFrom, 1889, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __pyx_tuple__120 = PyTuple_Pack(7, ((PyObject *)__pyx_int_1), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100), ((PyObject *)__pyx_int_1), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_100), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);

  /* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */
  __pyx_tuple__121 = PyTuple_Pack(7, __pyx_n_s_observations, __pyx_n_s_tree, __pyx_n_s_dataMissing, __pyx_n_s_classifyWithoutMissingData, __pyx_n_s_classifyWithoutMissingData, __pyx_n_s_classifyWithMissingData, __pyx_n_s_classifyWithMissingData); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_classify, 2259, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __pyx_tuple__123 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "causalml/inference/tree/uplift.pyx":2426
 *         A user-level results dataframe containing the estimated individual treatment effect.
 *     """
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  control_name,
 *                  n_estimators=10,
 */
  __pyx_tuple__124 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_control_name, __pyx_n_s_n_estimators, __pyx_n_s_max_features, __pyx_n_s_random_state, __pyx_n_s_max_depth, __pyx_n_s_min_samples_leaf, __pyx_n_s_min_samples_treatment, __pyx_n_s_n_reg, __pyx_n_s_early_stopping_eval_diff_scale, __pyx_n_s_evaluationFunction, __pyx_n_s_normalization, __pyx_n_s_honesty, __pyx_n_s_estimation_sample_size, __pyx_n_s_n_jobs, __pyx_n_s_joblib_prefer); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(16, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_init, 2426, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __pyx_tuple__126 = PyTuple_Pack(14, ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_10), ((PyObject *)Py_None), ((PyObject *)__pyx_int_5), ((PyObject *)__pyx_int_100), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_1), ((PyObject*)__pyx_n_u_KL), ((PyObject *)Py_True), ((PyObject *)Py_False), ((PyObject*)__pyx_float_0_5), ((PyObject *)__pyx_int_neg_1), ((PyObject*)__pyx_n_u_threads)); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);

  /* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */
  __pyx_tuple__127 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_treatment, __pyx_n_s_y, __pyx_n_s_X_val, __pyx_n_s_treatment_val, __pyx_n_s_y_val, __pyx_n_s_random_state, __pyx_n_s_treatment_groups, __pyx_n_s_tr, __pyx_n_s_all_importances, __pyx_n_s__62, __pyx_n_s_x, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_tree); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_fit, 2470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __pyx_tuple__129 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);

  /* "causalml/inference/tree/uplift.pyx":2529
 * 
 *     @staticmethod
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):             # <<<<<<<<<<<<<<
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))
 */
  __pyx_tuple__130 = PyTuple_Pack(16, __pyx_n_s_X, __pyx_n_s_treatment, __pyx_n_s_y, __pyx_n_s_X_val, __pyx_n_s_treatment_val, __pyx_n_s_y_val, __pyx_n_s_tree, __pyx_n_s_random_state, __pyx_n_s_bt_index, __pyx_n_s_x_train_bt, __pyx_n_s_y_train_bt, __pyx_n_s_treatment_train_bt, __pyx_n_s_bt_val_index, __pyx_n_s_x_val_bt, __pyx_n_s_y_val_bt, __pyx_n_s_treatment_val_bt); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_bootstrap, 2529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 2529, __pyx_L1_error)

  /* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */
  __pyx_tuple__132 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_X, __pyx_n_s_full_output, __pyx_n_s_y_pred_ensemble, __pyx_n_s_df_res, __pyx_n_s_delta_cols, __pyx_n_s_i_tr, __pyx_n_s_treatment_group, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_tree, __pyx_n_s_treatment_group); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);
  __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_causalml_inference_tree_uplift_p, __pyx_n_s_predict, 2548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __pyx_tuple__134 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);

  /* "View.MemoryView":287
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(2, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "View.MemoryView":288
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_tuple__136 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(2, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);

  /* "View.MemoryView":289
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__137 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(2, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);

  /* "View.MemoryView":292
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(2, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);

  /* "View.MemoryView":293
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__139 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(2, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__140 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_1 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_float_0_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_9 = PyFloat_FromDouble(0.9); if (unlikely(!__pyx_float_0_9)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_0001 = PyFloat_FromDouble(0.0001); if (unlikely(!__pyx_float_0_0001)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_70 = PyInt_FromLong(70); if (unlikely(!__pyx_int_70)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_90 = PyInt_FromLong(90); if (unlikely(!__pyx_int_90)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_95 = PyInt_FromLong(95); if (unlikely(!__pyx_int_95)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_97 = PyInt_FromLong(97); if (unlikely(!__pyx_int_97)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify) < 0) __PYX_ERR(0, 2259, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify.tp_dictoffset && __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify = &__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct__classify;
  if (PyType_Ready(&__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit) < 0) __PYX_ERR(0, 2470, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit.tp_dictoffset && __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit = &__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_1_fit;
  if (PyType_Ready(&__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 2521, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr.tp_dictoffset && __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr = &__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_2_genexpr;
  if (PyType_Ready(&__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict) < 0) __PYX_ERR(0, 2548, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict.tp_dictoffset && __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict = &__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_3_predict;
  if (PyType_Ready(&__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 2578, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr.tp_dictoffset && __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr = &__pyx_type_8causalml_9inference_4tree_6uplift___pyx_scope_struct_4_genexpr;
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_array.tp_print = 0;
  #endif
  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
  __pyx_array_type = &__pyx_type___pyx_array;
  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryview.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(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(1, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr),
  __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject),
  __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject),
  __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject),
  __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error)
  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error)
  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error)
  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error)
  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error)
  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error)
  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error)
  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error)
  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error)
  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error)
  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject),
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject),
  __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __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 inituplift(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC inituplift(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_uplift(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_uplift(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_uplift(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  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;
  static PyThread_type_lock __pyx_t_7[8];
  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 'uplift' 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_uplift(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("uplift", __pyx_methods, __pyx_k_Forest_of_trees_based_ensemble, 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_causalml__inference__tree__uplift) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "causalml.inference.tree.uplift")) {
      if (unlikely(PyDict_SetItemString(modules, "causalml.inference.tree.uplift", __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

  /* "causalml/inference/tree/uplift.pyx":22
 * #          Totte Harinen <totte@uber.com>
 * 
 * import multiprocessing as mp             # <<<<<<<<<<<<<<
 * from collections import defaultdict
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mp, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":23
 * 
 * import multiprocessing as mp
 * from collections import defaultdict             # <<<<<<<<<<<<<<
 * 
 * import logging
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_defaultdict);
  __Pyx_GIVEREF(__pyx_n_s_defaultdict);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":25
 * from collections import defaultdict
 * 
 * import logging             # <<<<<<<<<<<<<<
 * import cython
 * import numpy as np
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":27
 * import logging
 * import cython
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * import pandas as pd
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":29
 * import numpy as np
 * cimport numpy as np
 * import pandas as pd             # <<<<<<<<<<<<<<
 * import scipy.stats as stats
 * import sklearn
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pandas, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":30
 * cimport numpy as np
 * import pandas as pd
 * import scipy.stats as stats             # <<<<<<<<<<<<<<
 * import sklearn
 * from joblib import Parallel, delayed
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s__32);
  __Pyx_GIVEREF(__pyx_n_s__32);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__32);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_stats, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_stats, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":31
 * import pandas as pd
 * import scipy.stats as stats
 * import sklearn             # <<<<<<<<<<<<<<
 * from joblib import Parallel, delayed
 * from packaging import version
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sklearn, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sklearn, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":32
 * import scipy.stats as stats
 * import sklearn
 * from joblib import Parallel, delayed             # <<<<<<<<<<<<<<
 * from packaging import version
 * from sklearn.model_selection import train_test_split
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Parallel);
  __Pyx_GIVEREF(__pyx_n_s_Parallel);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Parallel);
  __Pyx_INCREF(__pyx_n_s_delayed);
  __Pyx_GIVEREF(__pyx_n_s_delayed);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_delayed);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_joblib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Parallel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Parallel, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_delayed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_delayed, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":33
 * import sklearn
 * from joblib import Parallel, delayed
 * from packaging import version             # <<<<<<<<<<<<<<
 * from sklearn.model_selection import train_test_split
 * from sklearn.utils import check_X_y, check_array, check_random_state
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_version);
  __Pyx_GIVEREF(__pyx_n_s_version);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_version);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_packaging, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":34
 * from joblib import Parallel, delayed
 * from packaging import version
 * from sklearn.model_selection import train_test_split             # <<<<<<<<<<<<<<
 * from sklearn.utils import check_X_y, check_array, check_random_state
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_train_test_split);
  __Pyx_GIVEREF(__pyx_n_s_train_test_split);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_train_test_split);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sklearn_model_selection, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_train_test_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_test_split, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":35
 * from packaging import version
 * from sklearn.model_selection import train_test_split
 * from sklearn.utils import check_X_y, check_array, check_random_state             # <<<<<<<<<<<<<<
 * 
 * if version.parse(sklearn.__version__) >= version.parse('0.22.0'):
 */
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_check_X_y);
  __Pyx_GIVEREF(__pyx_n_s_check_X_y);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_check_X_y);
  __Pyx_INCREF(__pyx_n_s_check_array);
  __Pyx_GIVEREF(__pyx_n_s_check_array);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_check_array);
  __Pyx_INCREF(__pyx_n_s_check_random_state);
  __Pyx_GIVEREF(__pyx_n_s_check_random_state);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_check_random_state);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sklearn_utils, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_X_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_X_y, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_array, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_random_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_random_state, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":37
 * from sklearn.utils import check_X_y, check_array, check_random_state
 * 
 * if version.parse(sklearn.__version__) >= version.parse('0.22.0'):             # <<<<<<<<<<<<<<
 *     from sklearn.utils._testing import ignore_warnings
 * else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_parse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sklearn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_parse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "causalml/inference/tree/uplift.pyx":38
 * 
 * if version.parse(sklearn.__version__) >= version.parse('0.22.0'):
 *     from sklearn.utils._testing import ignore_warnings             # <<<<<<<<<<<<<<
 * else:
 *     from sklearn.utils.testing import ignore_warnings
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_ignore_warnings);
    __Pyx_GIVEREF(__pyx_n_s_ignore_warnings);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ignore_warnings);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_sklearn_utils__testing, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ignore_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_ignore_warnings, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "causalml/inference/tree/uplift.pyx":37
 * from sklearn.utils import check_X_y, check_array, check_random_state
 * 
 * if version.parse(sklearn.__version__) >= version.parse('0.22.0'):             # <<<<<<<<<<<<<<
 *     from sklearn.utils._testing import ignore_warnings
 * else:
 */
    goto __pyx_L2;
  }

  /* "causalml/inference/tree/uplift.pyx":40
 *     from sklearn.utils._testing import ignore_warnings
 * else:
 *     from sklearn.utils.testing import ignore_warnings             # <<<<<<<<<<<<<<
 * 
 * N_TYPE = np.int32
 */
  /*else*/ {
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_ignore_warnings);
    __Pyx_GIVEREF(__pyx_n_s_ignore_warnings);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ignore_warnings);
    __pyx_t_2 = __Pyx_Import(__pyx_n_s_sklearn_utils_testing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ignore_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_ignore_warnings, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L2:;

  /* "causalml/inference/tree/uplift.pyx":42
 *     from sklearn.utils.testing import ignore_warnings
 * 
 * N_TYPE = np.int32             # <<<<<<<<<<<<<<
 * TR_TYPE = np.int8
 * Y_TYPE = np.int8
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_N_TYPE, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":43
 * 
 * N_TYPE = np.int32
 * TR_TYPE = np.int8             # <<<<<<<<<<<<<<
 * Y_TYPE = np.int8
 * P_TYPE = np.float64
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TR_TYPE, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":44
 * N_TYPE = np.int32
 * TR_TYPE = np.int8
 * Y_TYPE = np.int8             # <<<<<<<<<<<<<<
 * P_TYPE = np.float64
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Y_TYPE, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":45
 * TR_TYPE = np.int8
 * Y_TYPE = np.int8
 * P_TYPE = np.float64             # <<<<<<<<<<<<<<
 * 
 * ctypedef np.int32_t N_TYPE_t
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_P_TYPE, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":52
 * ctypedef np.float64_t P_TYPE_t
 * 
 * MAX_INT = np.iinfo(np.int32).max             # <<<<<<<<<<<<<<
 * 
 * logger = logging.getLogger("causalml")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_INT, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":54
 * MAX_INT = np.iinfo(np.int32).max
 * 
 * logger = logging.getLogger("causalml")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h":
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":100
 * 
 * @cython.cfunc
 * def entropyH(p: cython.float, q: cython.float=-1.) -> cython.float:             # <<<<<<<<<<<<<<
 *     '''
 *     Entropy
 */
  __pyx_k_ = (-1.);

  /* "causalml/inference/tree/uplift.pyx":127
 * 
 * 
 * class DecisionTree:             # <<<<<<<<<<<<<<
 *     """ Tree Node Class
 * 
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_DecisionTree, __pyx_n_s_DecisionTree, (PyObject *) NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_kp_s_Tree_Node_Class_Tree_node_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "causalml/inference/tree/uplift.pyx":183
 *     """
 * 
 *     def __init__(self, classes_, col=-1, value=None, trueBranch=None, falseBranch=None, results=None, summary=None,             # <<<<<<<<<<<<<<
 *                   maxDiffTreatment=None, maxDiffSign=1., nodeSummary=None, backupResults=None, bestTreatment=None,
 *                   upliftScore=None, matchScore=None):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_12DecisionTree_1__init__, 0, __pyx_n_s_DecisionTree___init, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__37);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":127
 * 
 * 
 * class DecisionTree:             # <<<<<<<<<<<<<<
 *     """ Tree Node Class
 * 
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_DecisionTree, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DecisionTree, __pyx_t_2) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":205
 * 
 * 
 * def group_uniqueCounts_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                               np.ndarray[Y_TYPE_t, ndim=1] y,
 *                               np.ndarray[N_TYPE_t, ndim=1] out_arr):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8causalml_9inference_4tree_6uplift_1group_uniqueCounts_to_arr, NULL, __pyx_n_s_causalml_inference_tree_uplift); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_group_uniqueCounts_to_arr, __pyx_t_1) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":252
 *     # done, modified out_arr, so no need to return it
 * 
 * def group_counts_by_divide(             # <<<<<<<<<<<<<<
 *         col_vals, threshold_val, is_split_by_gt,
 *         np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8causalml_9inference_4tree_6uplift_3group_counts_by_divide, NULL, __pyx_n_s_causalml_inference_tree_uplift); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_group_counts_by_divide, __pyx_t_1) < 0) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":333
 * 
 * # Uplift Tree Classifier
 * class UpliftTreeClassifier:             # <<<<<<<<<<<<<<
 *     """ Uplift Tree Classifier for Classification Task.
 * 
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_UpliftTreeClassifier, __pyx_n_s_UpliftTreeClassifier, (PyObject *) NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_kp_s_Uplift_Tree_Classifier_for_Clas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "causalml/inference/tree/uplift.pyx":385
 * 
 *     """
 *     def __init__(self, control_name, max_features=None, max_depth=3, min_samples_leaf=100,             # <<<<<<<<<<<<<<
 *                  min_samples_treatment=10, n_reg=100, early_stopping_eval_diff_scale=1, evaluationFunction='KL',
 *                  normalization=True, honesty=False, estimation_sample_size=0.5, random_state=None):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_1__init__, 0, __pyx_n_s_UpliftTreeClassifier___init, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__44);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":437
 * 
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """ Fit the uplift model.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_3fit, 0, __pyx_n_s_UpliftTreeClassifier_fit, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__47);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fit, __pyx_t_2) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":515
 * 
 *     # Prune Trees
 *     def prune(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff'):             # <<<<<<<<<<<<<<
 *         """ Prune the uplift model.
 *         Args
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_5prune, 0, __pyx_n_s_UpliftTreeClassifier_prune, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__50);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_prune, __pyx_t_2) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":555
 *         return self
 * 
 *     def honestApproach(self, X_est, T_est, Y_est):             # <<<<<<<<<<<<<<
 *         """ Apply the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 *         Args
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_7honestApproach, 0, __pyx_n_s_UpliftTreeClassifier_honestAppro, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_honestApproach, __pyx_t_2) < 0) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":569
 *         self.modifyEstimation(X_est, T_est, Y_est, self.fitted_uplift_tree)
 * 
 *     def modifyEstimation(self, X_est, t_est, y_est, tree):             # <<<<<<<<<<<<<<
 *         """ Modifies the leafs of the current decision tree to only contain unbiased estimates.
 *         Applies the honest approach based on "Athey, S., & Imbens, G. (2016). Recursive partitioning for heterogeneous causal effects."
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_9modifyEstimation, 0, __pyx_n_s_UpliftTreeClassifier_modifyEstim, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_modifyEstimation, __pyx_t_2) < 0) __PYX_ERR(0, 569, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":598
 *             tree.results = self.uplift_classification_results(t_est, y_est)
 * 
 *     def pruneTree(self, X, treatment_idx, y, tree, rule='maxAbsDiff', minGain=0.,             # <<<<<<<<<<<<<<
 *                   n_reg=0,
 *                   parentNodeSummary=None):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_11pruneTree, 0, __pyx_n_s_UpliftTreeClassifier_pruneTree, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__57);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_pruneTree, __pyx_t_2) < 0) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":750
 *         return self
 * 
 *     def fill(self, X, treatment, y):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a higher-level function to transform the original data inputs
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_13fill, 0, __pyx_n_s_UpliftTreeClassifier_fill, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fill, __pyx_t_2) < 0) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":781
 *         return self
 * 
 *     def fillTree(self, X, treatment_idx, y, tree):             # <<<<<<<<<<<<<<
 *         """ Fill the data into an existing tree.
 *         This is a lower-level function to execute on the tree filling task.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_15fillTree, 0, __pyx_n_s_UpliftTreeClassifier_fillTree, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fillTree, __pyx_t_2) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":834
 *         return self
 * 
 *     def predict(self, X):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_17predict, 0, __pyx_n_s_UpliftTreeClassifier_predict, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_predict, __pyx_t_2) < 0) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":859
 * 
 *     @staticmethod
 *     def divideSet(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node split.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_19divideSet, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_divideSet, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":858
 *         return np.array(pred_nodes)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def divideSet(X, treatment_idx, y, column, value):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_divideSet, __pyx_t_3) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":890
 * 
 *     @staticmethod
 *     def divideSet_len(X, treatment_idx, y, column, value):             # <<<<<<<<<<<<<<
 *         '''Tree node split.
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_21divideSet_len, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_divideSet_l, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":889
 *         return X[filt], X[~filt], treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def divideSet_len(X, treatment_idx, y, column, value):
 *         '''Tree node split.
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_divideSet_len, __pyx_t_2) < 0) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":926
 *         return len_X_l, len(X) - len_X_l, treatment_idx[filt], treatment_idx[~filt], y[filt], y[~filt]
 * 
 *     def group_uniqueCounts(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Count sample size by experiment group.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_23group_uniqueCounts, 0, __pyx_n_s_UpliftTreeClassifier_group_uniqu, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_group_uniqueCounts, __pyx_t_2) < 0) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":953
 * 
 *     @staticmethod
 *     def evaluate_KL(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate KL Divergence as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_25evaluate_KL, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_KL, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":952
 *         return results
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_KL(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_KL, __pyx_t_3) < 0) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":974
 * 
 *     @staticmethod
 *     def arr_evaluate_KL(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_27arr_evaluate_KL, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":973
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_KL(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_KL, __pyx_t_2) < 0) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1004
 * 
 *     @staticmethod
 *     def evaluate_ED(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Euclidean Distance as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_29evaluate_ED, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_ED, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1003
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_ED(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_ED, __pyx_t_3) < 0) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1025
 * 
 *     @staticmethod
 *     def arr_evaluate_ED(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_31arr_evaluate_ED, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_2, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1024
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_ED(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                         np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_ED, __pyx_t_2) < 0) __PYX_ERR(0, 1025, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1054
 * 
 *     @staticmethod
 *     def evaluate_Chi(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Chi-Square statistic as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_33evaluate_Chi, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_Ch, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1053
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_Chi(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_Chi, __pyx_t_3) < 0) __PYX_ERR(0, 1054, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1075
 * 
 *     @staticmethod
 *     def arr_evaluate_Chi(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_35arr_evaluate_Chi, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_3, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1074
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_Chi(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_Chi, __pyx_t_2) < 0) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1108
 * 
 *     @staticmethod
 *     def evaluate_DDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_37evaluate_DDP, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_DD, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1107
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_DDP(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_DDP, __pyx_t_3) < 0) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1128
 * 
 *     @staticmethod
 *     def arr_evaluate_DDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_39arr_evaluate_DDP, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_4, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1127
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_DDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_DDP, __pyx_t_2) < 0) __PYX_ERR(0, 1128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1157
 * 
 *     @staticmethod
 *     def evaluate_IT(leftNodeSummary, rightNodeSummary, w_l, w_r):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Squared T-Statistic as split evaluation criterion for a given node
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_41evaluate_IT, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_IT, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1156
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_IT(leftNodeSummary, rightNodeSummary, w_l, w_r):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_IT, __pyx_t_3) < 0) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1216
 * 
 *     @staticmethod
 *     def arr_evaluate_IT(np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,             # <<<<<<<<<<<<<<
 *                         np.ndarray[N_TYPE_t, ndim=1] left_node_summary_n,
 *                         np.ndarray[P_TYPE_t, ndim=1] right_node_summary_p,
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_43arr_evaluate_IT, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_5, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1215
 *         return g_s
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_IT(np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,
 *                         np.ndarray[N_TYPE_t, ndim=1] left_node_summary_n,
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_IT, __pyx_t_2) < 0) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1287
 * 
 *     @staticmethod
 *     def evaluate_CIT(currentNodeSummary, leftNodeSummary, rightNodeSummary, y_l, y_r, w_l, w_r, y, w):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate likelihood ratio test statistic as split evaluation criterion for a given node
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_45evaluate_CIT, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_CI, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1286
 *         return g_s
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_CIT(currentNodeSummary, leftNodeSummary, rightNodeSummary, y_l, y_r, w_l, w_r, y, w):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_CIT, __pyx_t_3) < 0) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1359
 * 
 *     @staticmethod
 *     def arr_evaluate_CIT(np.ndarray[P_TYPE_t, ndim=1] cur_node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] cur_node_summary_n,
 *                          np.ndarray[P_TYPE_t, ndim=1] left_node_summary_p,
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_47arr_evaluate_CIT, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_6, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1358
 *         return lrt
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_CIT(np.ndarray[P_TYPE_t, ndim=1] cur_node_summary_p,
 *                          np.ndarray[N_TYPE_t, ndim=1] cur_node_summary_n,
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_CIT, __pyx_t_2) < 0) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1450
 * 
 *     @staticmethod
 *     def evaluate_IDDP(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate Delta P as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_49evaluate_IDDP, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_ID, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1449
 *         return lrt
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_IDDP(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_IDDP, __pyx_t_3) < 0) __PYX_ERR(0, 1450, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1471
 * 
 *     @staticmethod
 *     def arr_evaluate_IDDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                           np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_51arr_evaluate_IDDP, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_7, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1470
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_IDDP(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                           np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_IDDP, __pyx_t_2) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1500
 * 
 *     @staticmethod
 *     def evaluate_CTS(nodeSummary):             # <<<<<<<<<<<<<<
 *         '''
 *         Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_53evaluate_CTS, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_evaluate_CT, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":1499
 *         return d_res
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def evaluate_CTS(nodeSummary):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_CTS, __pyx_t_3) < 0) __PYX_ERR(0, 1500, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1516
 * 
 *     @staticmethod
 *     def arr_evaluate_CTS(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,             # <<<<<<<<<<<<<<
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 *         '''
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_55arr_evaluate_CTS, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_arr_evaluat_8, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1515
 *         return -max([stat[0] for stat in nodeSummary])
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def arr_evaluate_CTS(np.ndarray[P_TYPE_t, ndim=1] node_summary_p,
 *                          np.ndarray[N_TYPE_t, ndim=1] node_summary_n):
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_evaluate_CTS, __pyx_t_2) < 0) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1546
 *         return -d_res
 * 
 *     def normI(self, n_c: cython.int, n_c_left: cython.int, n_t: list, n_t_left: list, alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:             # <<<<<<<<<<<<<<
 *         '''
 *         Normalization factor.
 */
  __pyx_t_2 = PyFloat_FromDouble(((double)0.9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_c, __pyx_n_u_int) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_c_left, __pyx_n_u_int) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_t, __pyx_n_u_list) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_t_left, __pyx_n_u_list) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_alpha, __pyx_n_u_float) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_currentDivergence, __pyx_n_u_float) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_float) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_57normI, 0, __pyx_n_s_UpliftTreeClassifier_normI, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_normI, __pyx_t_2) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1595
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,
 *                   alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:             # <<<<<<<<<<<<<<
 *         '''
 *         Normalization factor.
 */
  __pyx_t_2 = PyFloat_FromDouble(((double)0.9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "causalml/inference/tree/uplift.pyx":1594
 *         return norm_res
 * 
 *     def arr_normI(self, cur_node_summary_n, left_node_summary_n,             # <<<<<<<<<<<<<<
 *                   alpha: cython.float = 0.9, currentDivergence: cython.float = 0.0) -> cython.float:
 *         '''
 */
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_alpha, __pyx_n_u_float) < 0) __PYX_ERR(0, 1594, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_currentDivergence, __pyx_n_u_float) < 0) __PYX_ERR(0, 1594, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_float) < 0) __PYX_ERR(0, 1594, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_59arr_normI, 0, __pyx_n_s_UpliftTreeClassifier_arr_normI, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__106)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_arr_normI, __pyx_t_2) < 0) __PYX_ERR(0, 1594, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1656
 *         return norm_res
 * 
 *     def tree_node_summary(self, treatment_idx, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None):             # <<<<<<<<<<<<<<
 *         '''
 *         Tree node summary statistics.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_61tree_node_summary, 0, __pyx_n_s_UpliftTreeClassifier_tree_node_s, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__109);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_tree_node_summary, __pyx_t_2) < 0) __PYX_ERR(0, 1656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1703
 * 
 *     @staticmethod
 *     def tree_node_summary_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,             # <<<<<<<<<<<<<<
 *                                  np.ndarray[Y_TYPE_t, ndim=1] y,
 *                                  np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_63tree_node_summary_to_arr, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_tree_node_s_2, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__112);

  /* "causalml/inference/tree/uplift.pyx":1702
 *         return nodeSummary
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def tree_node_summary_to_arr(np.ndarray[TR_TYPE_t, ndim=1] treatment_idx,
 *                                  np.ndarray[Y_TYPE_t, ndim=1] y,
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_tree_node_summary_to_arr, __pyx_t_3) < 0) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":1786
 * 
 *     @staticmethod
 *     def tree_node_summary_from_counts(             # <<<<<<<<<<<<<<
 *             np.ndarray[N_TYPE_t, ndim=1] group_count_arr,
 *             np.ndarray[P_TYPE_t, ndim=1] out_summary_p,
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_65tree_node_summary_from_counts, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_tree_node_s_3, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__115);

  /* "causalml/inference/tree/uplift.pyx":1785
 *                 out_summary_p[i] = p
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def tree_node_summary_from_counts(
 *             np.ndarray[N_TYPE_t, ndim=1] group_count_arr,
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_tree_node_summary_from_counts, __pyx_t_2) < 0) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1863
 *                 out_summary_p[i] = p
 * 
 *     def uplift_classification_results(self, treatment_idx, y):             # <<<<<<<<<<<<<<
 *         '''
 *         Classification probability for each treatment in the tree node.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_67uplift_classification_results, 0, __pyx_n_s_UpliftTreeClassifier_uplift_clas, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_uplift_classification_results, __pyx_t_2) < 0) __PYX_ERR(0, 1863, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":1889
 *         return res
 * 
 *     def growDecisionTreeFrom(self, X, treatment_idx, y, X_val, treatment_val_idx, y_val,             # <<<<<<<<<<<<<<
 *                              early_stopping_eval_diff_scale=1, max_depth=10,
 *                              min_samples_leaf=100, depth=1,
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_69growDecisionTreeFrom, 0, __pyx_n_s_UpliftTreeClassifier_growDecisio, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__120);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_growDecisionTreeFrom, __pyx_t_2) < 0) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2259
 * 
 *     @staticmethod
 *     def classify(observations, tree, dataMissing=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Classifies (prediction) the observations according to the tree.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_20UpliftTreeClassifier_71classify, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftTreeClassifier_classify, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__123);

  /* "causalml/inference/tree/uplift.pyx":2258
 *                 )
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def classify(observations, tree, dataMissing=False):
 *         '''
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_classify, __pyx_t_3) < 0) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":333
 * 
 * # Uplift Tree Classifier
 * class UpliftTreeClassifier:             # <<<<<<<<<<<<<<
 *     """ Uplift Tree Classifier for Classification Task.
 * 
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_UpliftTreeClassifier, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UpliftTreeClassifier, __pyx_t_3) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":2363
 * 
 * # Uplift Random Forests
 * class UpliftRandomForestClassifier:             # <<<<<<<<<<<<<<
 *     """ Uplift Random Forest for Classification Task.
 * 
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_UpliftRandomForestClassifier, __pyx_n_s_UpliftRandomForestClassifier, (PyObject *) NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_kp_s_Uplift_Random_Forest_for_Classi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "causalml/inference/tree/uplift.pyx":2426
 *         A user-level results dataframe containing the estimated individual treatment effect.
 *     """
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  control_name,
 *                  n_estimators=10,
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_joblib_prefer, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2426, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_1__init__, 0, __pyx_n_s_UpliftRandomForestClassifier___i, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__126);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 2426, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2470
 *             self.n_jobs = mp.cpu_count()
 * 
 *     def fit(self, X, treatment, y, X_val=None, treatment_val=None, y_val=None):             # <<<<<<<<<<<<<<
 *         """
 *         Fit the UpliftRandomForestClassifier.
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_3fit, 0, __pyx_n_s_UpliftRandomForestClassifier_fit_2, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__129);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fit, __pyx_t_2) < 0) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "causalml/inference/tree/uplift.pyx":2529
 * 
 *     @staticmethod
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):             # <<<<<<<<<<<<<<
 *         random_state = check_random_state(tree.random_state)
 *         bt_index = random_state.choice(len(X), len(X))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_5bootstrap, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_UpliftRandomForestClassifier_boo, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "causalml/inference/tree/uplift.pyx":2528
 *         self.feature_importances_ /= self.feature_importances_.sum()  # normalize to add to 1
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def bootstrap(X, treatment, y, X_val, treatment_val, y_val, tree):
 *         random_state = check_random_state(tree.random_state)
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_bootstrap, __pyx_t_3) < 0) __PYX_ERR(0, 2529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2547
 *         return tree
 * 
 *     @ignore_warnings(category=FutureWarning)             # <<<<<<<<<<<<<<
 *     def predict(self, X, full_output=False):
 *         '''
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ignore_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_category, __pyx_builtin_FutureWarning) < 0) __PYX_ERR(0, 2547, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "causalml/inference/tree/uplift.pyx":2548
 * 
 *     @ignore_warnings(category=FutureWarning)
 *     def predict(self, X, full_output=False):             # <<<<<<<<<<<<<<
 *         '''
 *         Returns the recommended treatment group and predicted optimal
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_8causalml_9inference_4tree_6uplift_28UpliftRandomForestClassifier_7predict, 0, __pyx_n_s_UpliftRandomForestClassifier_pre_2, NULL, __pyx_n_s_causalml_inference_tree_uplift, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__134);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_predict, __pyx_t_3) < 0) __PYX_ERR(0, 2548, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "causalml/inference/tree/uplift.pyx":2363
 * 
 * # Uplift Random Forests
 * class UpliftRandomForestClassifier:             # <<<<<<<<<<<<<<
 *     """ Uplift Random Forest for Classification Task.
 * 
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_UpliftRandomForestClassifier, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UpliftRandomForestClassifier, __pyx_t_3) < 0) __PYX_ERR(0, 2363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "causalml/inference/tree/uplift.pyx":1
 * # cython: cdivision=True             # <<<<<<<<<<<<<<
 * # cython: boundscheck=False
 * # cython: wraparound=False
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); 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_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":210
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_array_type);

  /* "View.MemoryView":287
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":288
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__136, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":289
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__137, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":292
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__138, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":293
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__139, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":317
 * 
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
 */
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":318
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
 */
  __pyx_t_7[0] = PyThread_allocate_lock();
  __pyx_t_7[1] = PyThread_allocate_lock();
  __pyx_t_7[2] = PyThread_allocate_lock();
  __pyx_t_7[3] = PyThread_allocate_lock();
  __pyx_t_7[4] = PyThread_allocate_lock();
  __pyx_t_7[5] = PyThread_allocate_lock();
  __pyx_t_7[6] = PyThread_allocate_lock();
  __pyx_t_7[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":551
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryview_type);

  /* "View.MemoryView":997
 *         return self.from_object
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryviewslice_type);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init causalml.inference.tree.uplift", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init causalml.inference.tree.uplift");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_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;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

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

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

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

/* BufferFallbackError */
  static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_SetString(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

/* BytesEquals */
  static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_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
}

/* JoinPyUnicode */
  static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* PyDictVersioning */
  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
  #if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
  #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
  #if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = 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

/* PyObjectCall2Args */
  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__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

/* RaiseTooManyValuesToUnpack */
  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
  static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
  static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

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

/* PyObjectCallMethod1 */
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
  static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* 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_FAST_THREAD_STATE
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#else
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

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

/* None */
  static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

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

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

/* PyObjectCallMethod0 */
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
  static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
  static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
  static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* SliceObject */
  static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* ObjectGetItem */
  #if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

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

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyIntCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                        || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            if (unlikely(zerodivision_check && b == 0)) {
                PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
                return NULL;
            }
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* MemviewSliceInit */
    static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (unlikely(memviewslice->memview || memviewslice->data)) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF(memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}
#ifndef Py_NO_RETURN
#define Py_NO_RETURN
#endif
static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
    va_list vargs;
    char msg[200];
#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    va_end(vargs);
    Py_FatalError(msg);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    int first_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None))
        return;
    if (unlikely(__pyx_get_slice_count(memview) < 0))
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    first_time = __pyx_add_acquisition_count(memview) == 0;
    if (unlikely(first_time)) {
        if (have_gil) {
            Py_INCREF((PyObject *) memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_INCREF((PyObject *) memview);
            PyGILState_Release(_gilstate);
        }
    }
}
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    int last_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (unlikely(!memview || (PyObject *) memview == Py_None)) {
        memslice->memview = NULL;
        return;
    }
    if (unlikely(__pyx_get_slice_count(memview) <= 0))
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    last_time = __pyx_sub_acquisition_count(memview) == 1;
    memslice->data = NULL;
    if (unlikely(last_time)) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        memslice->memview = NULL;
    }
}

/* PyFloatBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* None */
      static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* FetchCommonType */
      static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
      #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
#if PY_MAJOR_VERSION > 2
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
#else
            PyErr_SetString(PyExc_TypeError,
                            "unbound method needs an argument");
#endif
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
      static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* PyIntCompare */
      static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_FALSE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_TRUE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_TRUE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* GetAttr */
      static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* decode_c_string */
      static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* GetAttr3 */
      static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* SwapException */
      #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

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

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

/* ImportFrom */
      static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* HasAttr */
      static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* 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_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_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, size_t alignment, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#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;
    py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
    if (!py_itemsize)
        goto bad;
    itemsize = PyLong_AsSsize_t(py_itemsize);
    Py_DECREF(py_itemsize);
    py_itemsize = 0;
    if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (itemsize) {
        if (size % alignment) {
            alignment = size % alignment;
        }
        if (itemsize < (Py_ssize_t)alignment)
            itemsize = (Py_ssize_t)alignment;
    }
    if ((size_t)(basicsize + itemsize) < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        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

/* CalculateMetaclass */
      static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
      static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

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

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


      /* MemviewSliceIsContig */
      static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
      static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* Capsule */
      static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
{
    PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
    return cobj;
}

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

/* TypeInfoCompare */
      static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
    int i;
    if (!a || !b)
        return 0;
    if (a == b)
        return 1;
    if (a->size != b->size || a->typegroup != b->typegroup ||
            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
        if (a->typegroup == 'H' || b->typegroup == 'H') {
            return a->size == b->size;
        } else {
            return 0;
        }
    }
    if (a->ndim) {
        for (i = 0; i < a->ndim; i++)
            if (a->arraysize[i] != b->arraysize[i])
                return 0;
    }
    if (a->typegroup == 'S') {
        if (a->flags != b->flags)
            return 0;
        if (a->fields || b->fields) {
            if (!(a->fields && b->fields))
                return 0;
            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                __Pyx_StructField *field_a = a->fields + i;
                __Pyx_StructField *field_b = b->fields + i;
                if (field_a->offset != field_b->offset ||
                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                    return 0;
            }
            return !a->fields[i].type && !b->fields[i].type;
        }
    }
    return 1;
}

/* MemviewSliceValidateAndInit */
      static int
__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
{
    if (buf->shape[dim] <= 1)
        return 1;
    if (buf->strides) {
        if (spec & __Pyx_MEMVIEW_CONTIG) {
            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                if (unlikely(buf->strides[dim] != sizeof(void *))) {
                    PyErr_Format(PyExc_ValueError,
                                 "Buffer is not indirectly contiguous "
                                 "in dimension %d.", dim);
                    goto fail;
                }
            } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_FOLLOW) {
            Py_ssize_t stride = buf->strides[dim];
            if (stride < 0)
                stride = -stride;
            if (unlikely(stride < buf->itemsize)) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
    } else {
        if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not contiguous in "
                         "dimension %d", dim);
            goto fail;
        } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not indirect in "
                         "dimension %d", dim);
            goto fail;
        } else if (unlikely(buf->suboffsets)) {
            PyErr_SetString(PyExc_ValueError,
                            "Buffer exposes suboffsets but no strides");
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
{
    if (spec & __Pyx_MEMVIEW_DIRECT) {
        if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer not compatible with direct access "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    if (spec & __Pyx_MEMVIEW_PTR) {
        if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer is not indirectly accessible "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
{
    int i;
    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = 0; i < ndim; i++) {
            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not fortran contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = ndim - 1; i >- 1; i--) {
            if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not C contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    }
    return 1;
fail:
    return 0;
}
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj)
{
    struct __pyx_memoryview_obj *memview, *new_memview;
    __Pyx_RefNannyDeclarations
    Py_buffer *buf;
    int i, spec = 0, retval = -1;
    __Pyx_BufFmt_Context ctx;
    int from_memoryview = __pyx_memoryview_check(original_obj);
    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                            original_obj)->typeinfo)) {
        memview = (struct __pyx_memoryview_obj *) original_obj;
        new_memview = NULL;
    } else {
        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                            original_obj, buf_flags, 0, dtype);
        new_memview = memview;
        if (unlikely(!memview))
            goto fail;
    }
    buf = &memview->view;
    if (unlikely(buf->ndim != ndim)) {
        PyErr_Format(PyExc_ValueError,
                "Buffer has wrong number of dimensions (expected %d, got %d)",
                ndim, buf->ndim);
        goto fail;
    }
    if (new_memview) {
        __Pyx_BufFmt_Init(&ctx, stack, dtype);
        if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
    }
    if (unlikely((unsigned) buf->itemsize != dtype->size)) {
        PyErr_Format(PyExc_ValueError,
                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                     buf->itemsize,
                     (buf->itemsize > 1) ? "s" : "",
                     dtype->name,
                     dtype->size,
                     (dtype->size > 1) ? "s" : "");
        goto fail;
    }
    if (buf->len > 0) {
        for (i = 0; i < ndim; i++) {
            spec = axes_specs[i];
            if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
                goto fail;
            if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
                goto fail;
        }
        if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
            goto fail;
    }
    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                         new_memview != NULL) == -1)) {
        goto fail;
    }
    retval = 0;
    goto no_fail;
fail:
    Py_XDECREF(new_memview);
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* ObjectToMemviewSlice */
      static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t(PyObject *obj, int writable_flag) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
                                                 &__Pyx_TypeInfo_nn___pyx_t_8causalml_9inference_4tree_6uplift_N_TYPE_t, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

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

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

/* MemviewSliceCopyTemplate */
      static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object)
{
    __Pyx_RefNannyDeclarations
    int i;
    __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
    struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
    Py_buffer *buf = &from_memview->view;
    PyObject *shape_tuple = NULL;
    PyObject *temp_int = NULL;
    struct __pyx_array_obj *array_obj = NULL;
    struct __pyx_memoryview_obj *memview_obj = NULL;
    __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
    for (i = 0; i < ndim; i++) {
        if (unlikely(from_mvs->suboffsets[i] >= 0)) {
            PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                           "indirect dimensions (axis %d)", i);
            goto fail;
        }
    }
    shape_tuple = PyTuple_New(ndim);
    if (unlikely(!shape_tuple)) {
        goto fail;
    }
    __Pyx_GOTREF(shape_tuple);
    for(i = 0; i < ndim; i++) {
        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
        if(unlikely(!temp_int)) {
            goto fail;
        } else {
            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
            temp_int = NULL;
        }
    }
    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
    if (unlikely(!array_obj)) {
        goto fail;
    }
    __Pyx_GOTREF(array_obj);
    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                    (PyObject *) array_obj, contig_flag,
                                    dtype_is_object,
                                    from_mvs->memview->typeinfo);
    if (unlikely(!memview_obj))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
        goto fail;
    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                dtype_is_object) < 0))
        goto fail;
    goto no_fail;
fail:
    __Pyx_XDECREF(new_mvs.memview);
    new_mvs.memview = NULL;
    new_mvs.data = NULL;
no_fail:
    __Pyx_XDECREF(shape_tuple);
    __Pyx_XDECREF(temp_int);
    __Pyx_XDECREF(array_obj);
    __Pyx_RefNannyFinishContext();
    return new_mvs;
}

/* CIntFromPy */
      static CYTHON_INLINE 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;
}

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

/* CIntToPy */
      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(npy_int32) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(npy_int32) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(npy_int32) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(npy_int32) <= 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(npy_int32),
                                     little, !is_unsigned);
    }
}

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

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

/* CIntFromPy */
      static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const char neg_one = (char) -1, const_zero = (char) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* CoroutineBase */
      #include <structmember.h>
#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 __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
      static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
      #ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
      static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

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