@@ -69,9 +69,12 @@ def __init__(self, alg, graded=True):
69
69
sage: M = algebras.WQSym(QQ).M()
70
70
sage: TestSuite(M).run() # long time
71
71
"""
72
+ def sorting_key (X ):
73
+ return (sum (map (len , X )), X )
72
74
CombinatorialFreeModule .__init__ (self , alg .base_ring (),
73
75
OrderedSetPartitions (),
74
76
category = WQSymBases (alg , graded ),
77
+ sorting_key = sorting_key ,
75
78
bracket = "" , prefix = self ._prefix )
76
79
77
80
def _repr_term (self , osp ):
@@ -574,7 +577,7 @@ class Monomial(WQSymBasis_abstract):
574
577
sage: M = WQSym.M(); M
575
578
Word Quasi-symmetric functions over Rational Field in the Monomial basis
576
579
sage: sorted(M.basis(2))
577
- [M[{1, 2}], M[{2}, {1}], M[{1}, { 2}]]
580
+ [M[{1}, { 2}], M[{2}, {1}], M[{1, 2}]]
578
581
"""
579
582
_prefix = "M"
580
583
_basis_name = "Monomial"
@@ -625,6 +628,7 @@ def product_on_basis(self, x, y):
625
628
626
629
def union (X , Y ):
627
630
return X .union (Y )
631
+
628
632
return self .sum_of_monomials (ShuffleProduct_overlapping (x , yshift ,
629
633
K , union ))
630
634
@@ -975,12 +979,15 @@ def _C_to_X(self, P):
975
979
temp = temp [:j ]
976
980
break
977
981
982
+ def union (X , Y ):
983
+ return X .union (Y )
984
+
978
985
# Perform the quasi-shuffle product
979
986
cur = {data [0 ]: 1 }
980
987
for B in data [1 :]:
981
988
ret = {}
982
989
for A in cur :
983
- for C in ShuffleProduct_overlapping (A , B , element_constructor = OSP ):
990
+ for C in ShuffleProduct_overlapping (A , B , element_constructor = OSP , add = union ):
984
991
if C in ret :
985
992
ret [C ] += cur [A ]
986
993
else :
0 commit comments