@@ -53,26 +53,24 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
53
53
v = \max_{\text{lex order}} \{g \cdot v | g \in G \}
54
54
55
55
The action of `G` is on position. This means for example that the
56
- simple transposition `s_1 = (1, 2)` swaps the first and the second entries
57
- of any integer vector `v = [a_1, a_2, a_3, \dots , a_n]`
56
+ simple transposition `s_1 = (1, 2)` swaps the first and the second
57
+ entries of any integer vector `v = [a_1, a_2, a_3, \dots , a_n]`
58
58
59
59
.. MATH::
60
60
61
61
s_1 \cdot v = [a_2, a_1, a_3, \dots , a_n]
62
62
63
- This functions returns a parent which contains a single integer
64
- vector by orbit under the action of the permutation group `G`. The
65
- approach chosen here is to keep the maximal integer vector for the
66
- lexicographic order in each orbit. Such maximal vector will be
67
- called canonical integer vector under the action of the
68
- permutation group `G`.
63
+ This function returns a parent which contains, from each orbit
64
+ orbit under the action of the permutation group `G`, a single
65
+ canonical vector. The canonical vector is the one that is maximal
66
+ within the orbit according to lexicographic order.
69
67
70
68
INPUT:
71
69
72
70
- ``G`` - a permutation group
73
71
- ``sum`` - (default: None) - a nonnegative integer
74
72
- ``max_part`` - (default: None) - a nonnegative integer setting the
75
- maximum of entries of elements
73
+ maximum value for every element
76
74
- ``sgs`` - (default: None) - a strong generating system of the
77
75
group `G`. If you do not provide it, it will be calculated at the
78
76
creation of the parent
@@ -118,7 +116,7 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
118
116
119
117
The method
120
118
:meth:`~sage.combinat.integer_vectors_mod_permgroup.IntegerVectorsModPermutationGroup_All.is_canonical`
121
- tests if any integer vector is maximal in its orbit. This method
119
+ tests if an integer vector is maximal in its orbit. This method
122
120
is also used in the containment test::
123
121
124
122
sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]))
@@ -137,7 +135,7 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
137
135
sage: I.is_canonical('bla')
138
136
Traceback (most recent call last):
139
137
...
140
- AssertionError: bla should be a list or a integer vector
138
+ AssertionError: bla should be a list or an integer vector
141
139
142
140
If you give a value to the extra argument ``sum``, the set returned
143
141
will be a finite set containing only canonical vectors whose entries
@@ -185,23 +183,23 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
185
183
186
184
sgs = tuple(tuple(s) for s in G.strong_generating_system())
187
185
188
- and provide it as the optional `sgs` argument to the
186
+ and provide it as the optional `` sgs` ` argument to the
189
187
constructor.
190
188
191
189
TESTS:
192
190
193
191
Let us check that canonical integer vectors of the symmetric group
194
- are just sorted list of integers::
192
+ are just nonincreasing lists of integers::
195
193
196
194
sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time
197
195
sage: p = iter(I) # long time
198
196
sage: for i in range(100): # long time
199
197
....: v = list(next(p))
200
198
....: assert sorted(v, reverse=True) == v
201
199
202
- We now check that there is as much of canonical vectors under the
203
- symmetric group `S_n` whose entries sum to `d` than partitions of
204
- `d` of at most `n` parts::
200
+ We now check that there are as many canonical vectors under the
201
+ symmetric group `S_n` whose entries sum to `d` as there are
202
+ partitions of `d` of at most `n` parts::
205
203
206
204
sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time
207
205
sage: for i in range(10): # long time
@@ -481,7 +479,7 @@ def is_canonical(self, v, check=True):
481
479
False
482
480
"""
483
481
if check :
484
- assert isinstance (v , (ClonableIntArray , list )), '%s should be a list or a integer vector' % v
482
+ assert isinstance (v , (ClonableIntArray , list )), '%s should be a list or an integer vector' % v
485
483
assert (self .n == len (v )), '%s should be of length %s' % (v , self .n )
486
484
for p in v :
487
485
assert (p == NN (p )), 'Elements of %s should be integers' % v
@@ -879,17 +877,12 @@ def cardinality(self):
879
877
21
880
878
881
879
With two interchangeable elements, the smaller one
882
- ranges from zero to `sum//2`::
880
+ ranges from zero to `` sum//2` `::
883
881
884
882
sage: G = PermutationGroup([(1,2)])
885
883
sage: IntegerVectorsModPermutationGroup(G, 1000).cardinality()
886
884
501
887
885
888
- sage: G = PermutationGroup([(1,2,3)])
889
- sage: I = IntegerVectorsModPermutationGroup(G, sum=10, max_part=5)
890
- sage: I.cardinality()
891
- 7
892
-
893
886
Binary vectors up to full symmetry are first some ones and
894
887
then some zeros::
895
888
@@ -919,6 +912,13 @@ def cardinality(self):
919
912
sage: V.cardinality()
920
913
0
921
914
915
+ The case when both ``sum`` and ``max_part`` are specified::
916
+
917
+ sage: G = PermutationGroup([(1,2,3)])
918
+ sage: I = IntegerVectorsModPermutationGroup(G, sum=10, max_part=5)
919
+ sage: I.cardinality()
920
+ 7
921
+
922
922
All permutation groups of degree 4::
923
923
924
924
sage: for G in SymmetricGroup(4).subgroups():
@@ -1032,7 +1032,7 @@ def is_canonical(self, v, check=True):
1032
1032
True
1033
1033
"""
1034
1034
if check :
1035
- assert isinstance (v , (ClonableIntArray , list )), '%s should be a list or a integer vector' % v
1035
+ assert isinstance (v , (ClonableIntArray , list )), '%s should be a list or an integer vector' % v
1036
1036
assert (self .n == len (v )), '%s should be of length %s' % (v , self .n )
1037
1037
for p in v :
1038
1038
assert (p == NN (p )), 'Elements of %s should be integers' % v
@@ -1214,7 +1214,7 @@ class Element(ClonableIntArray):
1214
1214
sage: v = I.element_class(I, [3,2,0,0])
1215
1215
Traceback (most recent call last):
1216
1216
...
1217
- AssertionError: [3, 2, 0, 0] should be a integer vector of sum 4
1217
+ AssertionError: [3, 2, 0, 0] should be an integer vector of sum 4
1218
1218
"""
1219
1219
1220
1220
def check (self ):
@@ -1234,7 +1234,7 @@ def check(self):
1234
1234
AssertionError
1235
1235
"""
1236
1236
if self .parent ()._sum is not None :
1237
- assert sum (self ) == self .parent ()._sum , '%s should be a integer vector of sum %s' % (self , self .parent ()._sum )
1237
+ assert sum (self ) == self .parent ()._sum , '%s should be an integer vector of sum %s' % (self , self .parent ()._sum )
1238
1238
if self .parent ()._max_part >= 0 :
1239
1239
assert max (self ) <= self .parent ()._max_part , 'Entries of %s must be inferior to %s' % (self , self .parent ()._max_part )
1240
1240
assert self .parent ().is_canonical (self )
0 commit comments