def condensed_coords_within(pop, n):
    """Return indices into a condensed distance matrix for all
    pairwise comparisons within the given population.

    Parameters
    ----------
    pop : array_like, int
        Indices of samples or haplotypes within the population.
    n : int
        Size of the square matrix (length of first or second dimension).

    Returns
    -------
    indices : ndarray, int

    """

    return [condensed_coords(i, j, n)
            for i, j in itertools.combinations(sorted(pop), 2)]