# Path: Utility.py
# def l2(x):
# def apply_scale(w, a, b):
# def logabsdiffexp(x, y):
#     def f(x, y):
# def logit_mean(x):
# def digest(x):
# def tree():
# def lift_tree(src, dst):
# def init_latex_rendering():
# def draw_confidence(a, m, S, levels = [0.95]):


import numpy as np
    import ctypes
            import sys; sys.exit()
from scipy import optimize as opt
from Utility import logsumexp, logabsdiffexp, digest, apply_scale
                               arr_G.ctypes.data_as(c_double_p))

    support_library.core_cnll.argtypes = [c_int_p,
                                          c_int, c_int, c_int,
                                          c_int_p, c_int_p, c_int_p,
                                          c_int_p, c_int_p, c_int_p,
                                          c_double_p,
                                          c_double_p, c_double_p, c_int_p]
    support_library.core_cnll.restype = c_double
    def core_cnll(A,
                  count, m, n, r, rndx, irndx, csort, cndx, cconj, G,
                  S, SS, B):
        arr_A = np.ascontiguousarray(A, dtype='int32')
        arr_r = np.ascontiguousarray(r, dtype='int32')
        arr_rndx = np.ascontiguousarray(rndx, dtype='int32')
        arr_irndx = np.ascontiguousarray(irndx, dtype='int32')
        arr_csort = np.ascontiguousarray(csort, dtype='int32')
        arr_cndx = np.ascontiguousarray(cndx, dtype='int32')
        arr_cconj = np.ascontiguousarray(cconj, dtype='int32')
        arr_G = np.ascontiguousarray(G, dtype='float64')
        arr_S = np.ascontiguousarray(S, dtype='float64')
        arr_SS = np.ascontiguousarray(SS, dtype='float64')
        arr_B = np.ascontiguousarray(B, dtype='int32')
        return support_library.core_cnll(arr_A.ctypes.data_as(c_int_p),
                                         count, m, n,
                                         arr_r.ctypes.data_as(c_int_p),
                                         arr_rndx.ctypes.data_as(c_int_p),
                                         arr_irndx.ctypes.data_as(c_int_p),
                                         arr_csort.ctypes.data_as(c_int_p),
                                         arr_cndx.ctypes.data_as(c_int_p),

# Path: Utility.py
# def l2(x):
# def apply_scale(w, a, b):
# def logabsdiffexp(x, y):
#     def f(x, y):
# def logit_mean(x):
# def digest(x):
# def tree():
# def lift_tree(src, dst):
# def init_latex_rendering():
# def draw_confidence(a, m, S, levels = [0.95]):


# Path: BinaryMatrix.py
import numpy as np
    import ctypes
            import sys; sys.exit()
from scipy import optimize as opt
from Utility import logsumexp, logabsdiffexp, digest, apply_scale

                               arr_G.ctypes.data_as(c_double_p))

    support_library.core_cnll.argtypes = [c_int_p,
                                          c_int, c_int, c_int,
                                          c_int_p, c_int_p, c_int_p,
                                          c_int_p, c_int_p, c_int_p,
                                          c_double_p,
                                          c_double_p, c_double_p, c_int_p]
    support_library.core_cnll.restype = c_double
    def core_cnll(A,
                  count, m, n, r, rndx, irndx, csort, cndx, cconj, G,
                  S, SS, B):
        arr_A = np.ascontiguousarray(A, dtype='int32')
        arr_r = np.ascontiguousarray(r, dtype='int32')
        arr_rndx = np.ascontiguousarray(rndx, dtype='int32')
        arr_irndx = np.ascontiguousarray(irndx, dtype='int32')
        arr_csort = np.ascontiguousarray(csort, dtype='int32')
        arr_cndx = np.ascontiguousarray(cndx, dtype='int32')
        arr_cconj = np.ascontiguousarray(cconj, dtype='int32')
        arr_G = np.ascontiguousarray(G, dtype='float64')
        arr_S = np.ascontiguousarray(S, dtype='float64')
        arr_SS = np.ascontiguousarray(SS, dtype='float64')
        arr_B = np.ascontiguousarray(B, dtype='int32')
        return support_library.core_cnll(arr_A.ctypes.data_as(c_int_p),
                                         count, m, n,
                                         arr_r.ctypes.data_as(c_int_p),
                                         arr_rndx.ctypes.data_as(c_int_p),
                                         arr_irndx.ctypes.data_as(c_int_p),
                                         arr_csort.ctypes.data_as(c_int_p),
                                         arr_cndx.ctypes.data_as(c_int_p),

                                         arr_cconj.ctypes.data_as(c_int_p),