def getInversePermutation(permutation):
    """Invert a given permutation vector.

    :param list | tuple | np.ndarray permutation: Permutation vector to invert.
    :return: Inverted permutation vector.
    :rtype: list
    """

    inverse = [0] * len(permutation)
    for i, p in enumerate(permutation):
        inverse[p] = i

    return inverse