def is_canonical(self, v, check=True): r""" Returns ``True`` if the integer list ``v`` is maximal in its orbit under the action of the permutation group given to define ``self``. Such integer vectors are said to be canonical. A vector `v` is canonical if and only if .. MATH:: v = \max_{\text{lex order}} \{g \cdot v | g \in G \} EXAMPLES:: sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), max_part=3) sage: I.is_canonical([3,0,0,0]) True sage: I.is_canonical([1,0,2,0]) False sage: I.is_canonical([2,0,1,0]) True """ if check: assert isinstance( v, (ClonableIntArray, list)), '%s should be a list or a integer vector' % v assert ( self.n == len(v)), '%s should be of length %s' % (v, self.n) for p in v: assert (p == NN(p)), 'Elements of %s should be integers' % v return is_canonical(self._sgs, self.element_class(self, list(v), check=False))
def __classcall__(cls, G, sum=None, max_part=None, sgs=None): r""" TESTS:: sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]])) sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), None) sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), 2) sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), -2) Traceback (most recent call last): ... ValueError: Value -2 in not in Non negative integer semiring. sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), 8, max_part=5) """ if sum is None and max_part is None: return IntegerVectorsModPermutationGroup_All(G, sgs=sgs) else: if sum is not None: assert (sum == NN(sum)) if max_part is not None: assert (max_part == NN(max_part)) return IntegerVectorsModPermutationGroup_with_constraints(G, sum, max_part, sgs=sgs)