Skip to content

Commit 11bbef9

Browse files
committed
Small language fixes; for brevity move one example to tests
1 parent 884a618 commit 11bbef9

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/sage/combinat/integer_vectors_mod_permgroup.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,24 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
5353
v = \max_{\text{lex order}} \{g \cdot v | g \in G \}
5454
5555
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]`
5858
5959
.. MATH::
6060
6161
s_1 \cdot v = [a_2, a_1, a_3, \dots , a_n]
6262
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.
6967
7068
INPUT:
7169
7270
- ``G`` - a permutation group
7371
- ``sum`` - (default: None) - a nonnegative integer
7472
- ``max_part`` - (default: None) - a nonnegative integer setting the
75-
maximum of entries of elements
73+
maximum value for every element
7674
- ``sgs`` - (default: None) - a strong generating system of the
7775
group `G`. If you do not provide it, it will be calculated at the
7876
creation of the parent
@@ -118,7 +116,7 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
118116
119117
The method
120118
: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
122120
is also used in the containment test::
123121
124122
sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]))
@@ -137,7 +135,7 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
137135
sage: I.is_canonical('bla')
138136
Traceback (most recent call last):
139137
...
140-
AssertionError: bla should be a list or a integer vector
138+
AssertionError: bla should be a list or an integer vector
141139
142140
If you give a value to the extra argument ``sum``, the set returned
143141
will be a finite set containing only canonical vectors whose entries
@@ -185,23 +183,23 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation):
185183
186184
sgs = tuple(tuple(s) for s in G.strong_generating_system())
187185
188-
and provide it as the optional `sgs` argument to the
186+
and provide it as the optional ``sgs`` argument to the
189187
constructor.
190188
191189
TESTS:
192190
193191
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::
195193
196194
sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time
197195
sage: p = iter(I) # long time
198196
sage: for i in range(100): # long time
199197
....: v = list(next(p))
200198
....: assert sorted(v, reverse=True) == v
201199
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::
205203
206204
sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time
207205
sage: for i in range(10): # long time
@@ -481,7 +479,7 @@ def is_canonical(self, v, check=True):
481479
False
482480
"""
483481
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
485483
assert (self.n == len(v)), '%s should be of length %s' % (v, self.n)
486484
for p in v:
487485
assert (p == NN(p)), 'Elements of %s should be integers' % v
@@ -879,17 +877,12 @@ def cardinality(self):
879877
21
880878
881879
With two interchangeable elements, the smaller one
882-
ranges from zero to `sum//2`::
880+
ranges from zero to ``sum//2``::
883881
884882
sage: G = PermutationGroup([(1,2)])
885883
sage: IntegerVectorsModPermutationGroup(G, 1000).cardinality()
886884
501
887885
888-
sage: G = PermutationGroup([(1,2,3)])
889-
sage: I = IntegerVectorsModPermutationGroup(G, sum=10, max_part=5)
890-
sage: I.cardinality()
891-
7
892-
893886
Binary vectors up to full symmetry are first some ones and
894887
then some zeros::
895888
@@ -919,6 +912,13 @@ def cardinality(self):
919912
sage: V.cardinality()
920913
0
921914
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+
922922
All permutation groups of degree 4::
923923
924924
sage: for G in SymmetricGroup(4).subgroups():
@@ -1032,7 +1032,7 @@ def is_canonical(self, v, check=True):
10321032
True
10331033
"""
10341034
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
10361036
assert (self.n == len(v)), '%s should be of length %s' % (v, self.n)
10371037
for p in v:
10381038
assert (p == NN(p)), 'Elements of %s should be integers' % v
@@ -1214,7 +1214,7 @@ class Element(ClonableIntArray):
12141214
sage: v = I.element_class(I, [3,2,0,0])
12151215
Traceback (most recent call last):
12161216
...
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
12181218
"""
12191219

12201220
def check(self):
@@ -1234,7 +1234,7 @@ def check(self):
12341234
AssertionError
12351235
"""
12361236
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)
12381238
if self.parent()._max_part >= 0:
12391239
assert max(self) <= self.parent()._max_part, 'Entries of %s must be inferior to %s' % (self, self.parent()._max_part)
12401240
assert self.parent().is_canonical(self)

0 commit comments

Comments
 (0)