Skip to content

Commit 63ee91e

Browse files
committed
fixing the doctests
1 parent 023f37f commit 63ee91e

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

src/sage/combinat/chas/wqsym.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class Monomial(WQSymBasis_abstract):
574574
sage: M = WQSym.M(); M
575575
Word Quasi-symmetric functions over Rational Field in the Monomial basis
576576
sage: sorted(M.basis(2))
577-
[M[{1, 2}], M[{2}, {1}], M[{1}, {2}]]
577+
[M[{1}, {2}], M[{2}, {1}], M[{1, 2}]]
578578
"""
579579
_prefix = "M"
580580
_basis_name = "Monomial"
@@ -625,6 +625,7 @@ def product_on_basis(self, x, y):
625625

626626
def union(X, Y):
627627
return X.union(Y)
628+
628629
return self.sum_of_monomials(ShuffleProduct_overlapping(x, yshift,
629630
K, union))
630631

@@ -975,12 +976,15 @@ def _C_to_X(self, P):
975976
temp = temp[:j]
976977
break
977978

979+
def union(X, Y):
980+
return X.union(Y)
981+
978982
# Perform the quasi-shuffle product
979983
cur = {data[0]: 1}
980984
for B in data[1:]:
981985
ret = {}
982986
for A in cur:
983-
for C in ShuffleProduct_overlapping(A, B, element_constructor=OSP):
987+
for C in ShuffleProduct_overlapping(A, B, element_constructor=OSP, add=union):
984988
if C in ret:
985989
ret[C] += cur[A]
986990
else:
@@ -2220,7 +2224,7 @@ def algebraic_complement(self):
22202224
sage: M[[1,4],[2,5],[3,6]].algebraic_complement()
22212225
M[{3, 6}, {2, 5}, {1, 4}]
22222226
sage: (3*M[[1]] - 4*M[[]] + 5*M[[1],[2]]).algebraic_complement()
2223-
-4*M[] + 3*M[{1}] + 5*M[{2}, {1}]
2227+
3*M[{1}] - 4*M[] + 5*M[{2}, {1}]
22242228
sage: X = WQSym.X()
22252229
sage: X[[1,3],[2]].algebraic_complement()
22262230
X[{2}, {1, 3}]
@@ -2385,7 +2389,7 @@ def coalgebraic_complement(self):
23852389
sage: M[[1,4],[2,5],[3,6]].coalgebraic_complement()
23862390
M[{3, 6}, {2, 5}, {1, 4}]
23872391
sage: (3*M[[1]] - 4*M[[]] + 5*M[[1],[2]]).coalgebraic_complement()
2388-
-4*M[] + 3*M[{1}] + 5*M[{2}, {1}]
2392+
3*M[{1}] - 4*M[] + 5*M[{2}, {1}]
23892393
sage: X = WQSym.X()
23902394
sage: X[[1,3],[2]].coalgebraic_complement()
23912395
X[{1, 3}, {2}]
@@ -2496,7 +2500,7 @@ def star_involution(self):
24962500
sage: M[[1,4],[2,5],[3,6]].star_involution()
24972501
M[{1, 4}, {2, 5}, {3, 6}]
24982502
sage: (3*M[[1]] - 4*M[[]] + 5*M[[1],[2]]).star_involution()
2499-
-4*M[] + 3*M[{1}] + 5*M[{1}, {2}]
2503+
3*M[{1}] - 4*M[] + 5*M[{1}, {2}]
25002504
sage: X = WQSym.X()
25012505
sage: X[[1,3],[2]].star_involution()
25022506
X[{2}, {1, 3}]

src/sage/combinat/set_partition_ordered.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ def fatter(self):
568568
sage: C.cardinality()
569569
4
570570
sage: sorted(C)
571-
[[{1, 2, 3, 4, 5}],
572-
[{1, 2, 5}, {3, 4}],
571+
[[{2, 5}, {1}, {3, 4}],
573572
[{2, 5}, {1, 3, 4}],
574-
[{2, 5}, {1}, {3, 4}]]
573+
[{1, 2, 5}, {3, 4}],
574+
[{1, 2, 3, 4, 5}]]
575575
576576
sage: OrderedSetPartition([[4, 9], [-1, 2]]).fatter().list()
577577
[[{4, 9}, {-1, 2}], [{-1, 2, 4, 9}]]
@@ -583,14 +583,14 @@ def fatter(self):
583583
sage: list(Composition([]).fatter())
584584
[[]]
585585
sage: sorted(OrderedSetPartition([[1], [2], [3], [4]]).fatter())
586-
[[{1, 2, 3, 4}],
587-
[{1, 2, 3}, {4}],
588-
[{1, 2}, {3, 4}],
589-
[{1, 2}, {3}, {4}],
590-
[{1}, {2, 3, 4}],
591-
[{1}, {2, 3}, {4}],
586+
[[{1}, {2}, {3}, {4}],
592587
[{1}, {2}, {3, 4}],
593-
[{1}, {2}, {3}, {4}]]
588+
[{1}, {2, 3}, {4}],
589+
[{1}, {2, 3, 4}],
590+
[{1, 2}, {3}, {4}],
591+
[{1, 2}, {3, 4}],
592+
[{1, 2, 3}, {4}],
593+
[{1, 2, 3, 4}]]
594594
"""
595595
return Compositions(len(self)).map(self.fatten)
596596

@@ -742,8 +742,7 @@ def strongly_fatter(self):
742742
sage: C.cardinality()
743743
2
744744
sage: sorted(C)
745-
[[{2, 5}, {1, 3, 4}],
746-
[{2, 5}, {1}, {3, 4}]]
745+
[[{2, 5}, {1}, {3, 4}], [{2, 5}, {1, 3, 4}]]
747746
748747
sage: OrderedSetPartition([[4, 9], [-1, 2]]).strongly_fatter().list()
749748
[[{4, 9}, {-1, 2}]]
@@ -755,21 +754,21 @@ def strongly_fatter(self):
755754
sage: list(OrderedSetPartition([]).strongly_fatter())
756755
[[]]
757756
sage: sorted(OrderedSetPartition([[1], [2], [3], [4]]).strongly_fatter())
758-
[[{1, 2, 3, 4}],
759-
[{1, 2, 3}, {4}],
760-
[{1, 2}, {3, 4}],
761-
[{1, 2}, {3}, {4}],
762-
[{1}, {2, 3, 4}],
763-
[{1}, {2, 3}, {4}],
757+
[[{1}, {2}, {3}, {4}],
764758
[{1}, {2}, {3, 4}],
765-
[{1}, {2}, {3}, {4}]]
759+
[{1}, {2, 3}, {4}],
760+
[{1}, {2, 3, 4}],
761+
[{1, 2}, {3}, {4}],
762+
[{1, 2}, {3, 4}],
763+
[{1, 2, 3}, {4}],
764+
[{1, 2, 3, 4}]]
766765
sage: sorted(OrderedSetPartition([[1], [3], [2], [4]]).strongly_fatter())
767-
[[{1, 3}, {2, 4}],
768-
[{1, 3}, {2}, {4}],
766+
[[{1}, {3}, {2}, {4}],
769767
[{1}, {3}, {2, 4}],
770-
[{1}, {3}, {2}, {4}]]
768+
[{1, 3}, {2}, {4}],
769+
[{1, 3}, {2, 4}]]
771770
sage: sorted(OrderedSetPartition([[4], [1], [5], [3]]).strongly_fatter())
772-
[[{4}, {1, 5}, {3}], [{4}, {1}, {5}, {3}]]
771+
[[{4}, {1}, {5}, {3}], [{4}, {1, 5}, {3}]]
773772
"""
774773
c = [sorted(X) for X in self]
775774
l = len(c) - 1

0 commit comments

Comments
 (0)