def _k_to_fp(k, num_p):
    """ Given the index 'k' (i.e., the 1-d index), find the equivalent index
    in '[f,p]' (i.e., the 2-d index). """
    p = k % num_p + 1
    f = (k + num_p - p + 1) / num_p
    return f, p
