@njit
def _repeat_1d(x, K, out):

    N = x.shape[0]
    L = out.shape[0] // (K*N) # number of outer iterations
    # K                       # number of inner iterations

    # the result out should enumerate in C-order the elements
    # of a 3-dimensional array T of dimensions (K,N,L)
    # such that for all k,n,l, we have T[k,n,l] == x[n]

    for n in range(N):
        val = x[n]
        for k in range(K):
            for l in range(L):
                ind = k*N*L + n*L + l
                out[ind] = val
Repeats each element of a vector many times and repeats the whole result many times
dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/gridtools.py/_repeat_1d