# 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_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_rvs = np.ascontiguousarray(rvs, dtype='float64')
        arr_S = np.ascontiguousarray(S, dtype='float64')
        arr_SS = np.ascontiguousarray(SS, dtype='float64')
        arr_B = np.ascontiguousarray(B, dtype='int32')
        arr_logQ = np.ascontiguousarray(logQ, dtype='float64')
        arr_logP = np.ascontiguousarray(logP, dtype='float64')
        support_library.core_sample(arr_logw.ctypes.data_as(c_double_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),
                                    arr_G.ctypes.data_as(c_double_p),
                                    arr_rvs.ctypes.data_as(c_double_p),
                                    arr_S.ctypes.data_as(c_double_p),
                                    arr_SS.ctypes.data_as(c_double_p),
                                    arr_B.ctypes.data_as(c_int_p),
                                    arr_logQ.ctypes.data_as(c_double_p),
                                    arr_logP.ctypes.data_as(c_double_p))
        return (arr_B, arr_logQ[0], arr_logP[0])
    
    c_support_loaded = True
except:

# 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_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_rvs = np.ascontiguousarray(rvs, dtype='float64')
        arr_S = np.ascontiguousarray(S, dtype='float64')
        arr_SS = np.ascontiguousarray(SS, dtype='float64')
        arr_B = np.ascontiguousarray(B, dtype='int32')
        arr_logQ = np.ascontiguousarray(logQ, dtype='float64')
        arr_logP = np.ascontiguousarray(logP, dtype='float64')
        support_library.core_sample(arr_logw.ctypes.data_as(c_double_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),
                                    arr_G.ctypes.data_as(c_double_p),
                                    arr_rvs.ctypes.data_as(c_double_p),
                                    arr_S.ctypes.data_as(c_double_p),
                                    arr_SS.ctypes.data_as(c_double_p),
                                    arr_B.ctypes.data_as(c_int_p),
                                    arr_logQ.ctypes.data_as(c_double_p),
                                    arr_logP.ctypes.data_as(c_double_p))
        return (arr_B, arr_logQ[0], arr_logP[0])
    
    c_support_loaded = True
except:

    print 'C support code can\'t load. Falling back to Python.'