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 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'%s return is_canonical(self._sgs, self.element_class(self, list(v), check=False))