Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Rewrite to pass to Permutations
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkarn committed Oct 13, 2022
1 parent d74232f commit 427b392
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/sage/categories/weyl_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ def stanley_symmetric_function(self):
EXAMPLES::
sage: W = WeylGroup(['A', 3])
sage: W.from_reduced_word([3,2,3,1]).stanley_symmetric_function()
3*m[1, 1, 1, 1] + 2*m[2, 1, 1] + m[2, 2] + m[3, 1]
sage: W = WeylGroup(['A', 3, 1])
sage: W.from_reduced_word([3,1,2,0,3,1,0]).stanley_symmetric_function()
8*m[1, 1, 1, 1, 1, 1, 1] + 4*m[2, 1, 1, 1, 1, 1] + 2*m[2, 2, 1, 1, 1] + m[2, 2, 2, 1]
Expand Down Expand Up @@ -571,22 +575,19 @@ def stanley_symmetric_function(self):
In type-A, utilize the peelable tableaux algorithm of [RS1995]_.
In other types, use induction on left Pieri factors.
"""
import sage.combinat.sf
from sage.rings.rational_field import QQ
m = sage.combinat.sf.sf.SymmetricFunctions(QQ).monomial()
cartan_type = self.parent().cartan_type()

# the setting for [RS1995]_
if cartan_type[0] == 'A' and not cartan_type.is_affine():
is_affine = cartan_type.is_affine()
if cartan_type == 'A' and not is_affine:
from sage.combinat.permutation import Permutation
from sage.combinat.diagram import RotheDiagram
s = sage.combinat.sf.sf.SymmetricFunctions(QQ).schur()
try:
p = Permutation(self.to_permutation())
except AttributeError: # to handle SymmetricGroupElements
p = Permutation(self.domain())
return m.sum(s[T.shape()] for T in RotheDiagram(p).peelable_tableaux())
try: # handle WeylGroupElements
return Permutation(list(self.to_permutation())).stanley_symmetric_function()
except AttributeError: # handle SymmetricGroupElements
return Permutation(self.domain).stanley_symmetric_function()

# handle other types
import sage.combinat.sf
from sage.rings.rational_field import QQ
m = sage.combinat.sf.sf.SymmetricFunctions(QQ).monomial()
return m.from_polynomial_exp(self.stanley_symmetric_function_as_polynomial())

@cached_in_parent_method
Expand Down

0 comments on commit 427b392

Please sign in to comment.