def i_to_r(i, L, dx):
    """Return coordinates of lattice indices in continuous space.

    Parameters
    ----------
    i: integer array, shape (a1, a2, ..., d)
        Integer indices, with last axis indexing the dimension.
        It's assumed that all components of the vector
        lie within plus or minus (L / dx) / 2.
    L: float
        Length of the lattice, assumed to be centred on the origin.
    dx: float
        Spatial lattice spacing.
        This means the number of lattice points is (L / dx).

    Returns
    -------
    r: float array, shape of i
        Coordinate vectors of the lattice points specified by the indices.

    """
    return -L / 2.0 + (i + 0.5) * dx