Numba jit version of `k_array_rank`.

    Notes
    -----
    An incorrect value will be returned without warning or error if
    overflow occurs during the computation. It is the user's
    responsibility to ensure that the rank of the input array fits
    within the range of possible values of `np.intp`; a sufficient
    condition for it is `scipy.special.comb(a[-1]+1, len(a), exact=True)
    <= np.iinfo(np.intp).max`.

def k_array_rank_jit(a):
    """
    Numba jit version of `k_array_rank`.

    Notes
    -----
    An incorrect value will be returned without warning or error if
    overflow occurs during the computation. It is the user's
    responsibility to ensure that the rank of the input array fits
    within the range of possible values of `np.intp`; a sufficient
    condition for it is `scipy.special.comb(a[-1]+1, len(a), exact=True)
    <= np.iinfo(np.intp).max`.

    """
    k = len(a)
    idx = a[0]
    for i in range(1, k):
        idx += comb_jit(a[i], i+1)
    return idx