'A coset table is standardized if when running through the cosets and
within each coset through the generator images (ignoring generator
inverses), the cosets appear in order of the integers
`0, 1, , \ldots, n`. "Standardize" reorders the elements of `\Omega`
such that, if we scan the coset table first by elements of `\Omega`
and then by elements of A, then the cosets occur in ascending order.
``standardize()`` is used at the end of an enumeration to permute the
cosets so that they occur in some sort of standard order.
Notes
procedure is described on pg. 167-168 [1], it also makes use of the
``switch`` routine to replace by smaller integer value.
>>> from sympy.combinatorics.free_groups import free_group
>>> from sympy.combinatorics.fp_groups import FpGroup, coset_enumeration_r
>>> F, x, y = free_group("x, y")
# Example 5.3 from [1]
>>> f = FpGroup(F, [x**2*y**2, x**3*y**5])
>>> C = coset_enumeration_r(f, [])
>>> C.compress()
>>> C.table
[[1, 3, 1, 3], [2, 0, 2, 0], [3, 1, 3, 1], [0, 2, 0, 2]]
>>> C.standardize()
>>> C.table
[[1, 2, 1, 2], [3, 0, 3, 0], [0, 3, 0, 3], [2, 1, 2, 1]]'

def standardize(self):

    A = self.A
    A_dict = self.A_dict
    A_dict_inv = self.A_dict_inv
    gamma = 1
    for (alpha, x) in product(range(self.n), A):
        beta = self.table[alpha][A_dict[x]]
        if (beta >= gamma):
            if (beta > gamma):
                self.switch(gamma, beta)
            gamma += 1
            if (gamma == self.n):
                return
