

@jit
def rotT_loops(T, g):

    def compute_elt(i, j, k, l):
        total = 0
        for ii in range(3):
            for jj in range(3):
                for kk in range(3):
                    for ll in range(3):
                        gg = (((g[(ii, i)] * g[(jj, j)]) * g[(kk, k)]) * g[(ll, l)])
                        total += (gg * T[(ii, jj, kk, ll)])
        return total
    return np.array([[[[compute_elt(i, j, k, l) for i in xrange(3)] for j in xrange(3)] for k in xrange(3)] for l in xrange(3)])

dataset/ETHPy150Open iskandr/parakeet/examples/tensor_rotation.py rotT_loops/original