# Path: cubical/kernels/generics.py
# def compute_2x2_inverse(x, xinv, flags, eps, flagbit):
# def compute_diag_inverse(x, xinv, flags, eps, flagbit):
# def compute_chisq(r, chisq):
# def compute_chisq_diag(r, chisq):
# def compute_chisq_offdiag(r, chisq):
# 
# Path: cubical/kernels/full_complex.py
# def allocate_vis_array(shape, dtype, zeros=False):
# def allocate_gain_array(shape, dtype, zeros=False):
# def allocate_flag_array(shape, dtype, zeros=False):
# def compute_residual(m, g, gh, r, t_int, f_int):
# def compute_jh(m, g, jh, t_int, f_int):
# def compute_jhr(jh, r, jhr, t_int, f_int):
# def compute_jhj(jh, jhj, t_int, f_int):
# def compute_update(jhr, jhjinv, upd):
# def compute_corrected(o, g, gh, corr, t_int, f_int):
# def apply_gains(m, g, gh, t_int, f_int):
# def right_multiply_gains(g, g_next, t_int, f_int):


from builtins import range
from numba import jit, prange
from cubical.kernels import generics
from cubical.kernels import full_complex
import numpy as np
import cubical.kernels
    broadcast_dirs = np.array([d%g_dir for d in range(n_dir)])

    for aa in prange(n_ant):
        for t in range(n_tim):
            bt = broadcast_times[t]
            for f in range(n_fre):
                bf = broadcast_freqs[f]
                for d in range(n_dir):
                    bd = broadcast_dirs[d]

                    g00 = g[d,t,f,aa,0,0]
                    g11 = g[d,t,f,aa,1,1]

                    g_next00 = g_next[bd,bt,bf,aa,0,0]
                    g_next01 = g_next[bd,bt,bf,aa,0,1]
                    g_next10 = g_next[bd,bt,bf,aa,1,0]
                    g_next11 = g_next[bd,bt,bf,aa,1,1]

                    g[d,t,f,aa,0,0] *= g_next00
                    g[d,t,f,aa,0,1] *= g_next11
                    g[d,t,f,aa,1,0] *= g_next00
                    g[d,t,f,aa,1,1] *= g_next11

# Map compute_jhr method to a generic complex case.
compute_jhr = full_complex.compute_jhr

# Map compute_jhj method to a generic complex case.
compute_jhj = full_complex.compute_jhj

# Map the J^H.J inversion method to a generic inversion.

# Path: cubical/kernels/generics.py
# def compute_2x2_inverse(x, xinv, flags, eps, flagbit):
# def compute_diag_inverse(x, xinv, flags, eps, flagbit):
# def compute_chisq(r, chisq):
# def compute_chisq_diag(r, chisq):
# def compute_chisq_offdiag(r, chisq):
# 
# Path: cubical/kernels/full_complex.py
# def allocate_vis_array(shape, dtype, zeros=False):
# def allocate_gain_array(shape, dtype, zeros=False):
# def allocate_flag_array(shape, dtype, zeros=False):
# def compute_residual(m, g, gh, r, t_int, f_int):
# def compute_jh(m, g, jh, t_int, f_int):
# def compute_jhr(jh, r, jhr, t_int, f_int):
# def compute_jhj(jh, jhj, t_int, f_int):
# def compute_update(jhr, jhjinv, upd):
# def compute_corrected(o, g, gh, corr, t_int, f_int):
# def apply_gains(m, g, gh, t_int, f_int):
# def right_multiply_gains(g, g_next, t_int, f_int):


# Path: cubical/kernels/diag_complex.py
from builtins import range
from numba import jit, prange
from cubical.kernels import generics
from cubical.kernels import full_complex
import numpy as np
import cubical.kernels

    broadcast_dirs = np.array([d%g_dir for d in range(n_dir)])

    for aa in prange(n_ant):
        for t in range(n_tim):
            bt = broadcast_times[t]
            for f in range(n_fre):
                bf = broadcast_freqs[f]
                for d in range(n_dir):
                    bd = broadcast_dirs[d]

                    g00 = g[d,t,f,aa,0,0]
                    g11 = g[d,t,f,aa,1,1]

                    g_next00 = g_next[bd,bt,bf,aa,0,0]
                    g_next01 = g_next[bd,bt,bf,aa,0,1]
                    g_next10 = g_next[bd,bt,bf,aa,1,0]
                    g_next11 = g_next[bd,bt,bf,aa,1,1]

                    g[d,t,f,aa,0,0] *= g_next00
                    g[d,t,f,aa,0,1] *= g_next11
                    g[d,t,f,aa,1,0] *= g_next00
                    g[d,t,f,aa,1,1] *= g_next11

# Map compute_jhr method to a generic complex case.
compute_jhr = full_complex.compute_jhr

# Map compute_jhj method to a generic complex case.
compute_jhj = full_complex.compute_jhj

# Map the J^H.J inversion method to a generic inversion.

compute_jhjinv = generics.compute_2x2_inverse