Skip to content

Commit f657815

Browse files
committed
Add conversion from InfinitePolynomial to SchubertPolynomial
1 parent 4855ece commit f657815

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/sage/combinat/schubert_polynomial.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,18 @@
7373
#
7474
# https://www.gnu.org/licenses/
7575
# ****************************************************************************
76-
from sage.combinat.free_module import CombinatorialFreeModule
7776
from sage.categories.all import GradedAlgebrasWithBasis
77+
from sage.combinat.free_module import CombinatorialFreeModule
78+
from sage.combinat.key_polynomial import KeyPolynomial
79+
from sage.combinat.permutation import Permutations, Permutation
80+
from sage.misc.cachefunc import cached_method
7881
from sage.rings.integer import Integer
7982
from sage.rings.integer_ring import ZZ
83+
from sage.rings.polynomial.infinite_polynomial_element import InfinitePolynomial_sparse
8084
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
8185
from sage.rings.polynomial.multi_polynomial import is_MPolynomial
82-
from sage.combinat.permutation import Permutations, Permutation
83-
import sage.libs.symmetrica.all as symmetrica
84-
from sage.misc.cachefunc import cached_method
8586

87+
import sage.libs.symmetrica.all as symmetrica
8688

8789
def SchubertPolynomialRing(R):
8890
"""
@@ -414,6 +416,17 @@ def _element_constructor_(self, x):
414416
sage: X(x1^2*x2)
415417
X[3, 2, 1]
416418
419+
sage: S.<x> = InfinitePolynomialRing(QQ)
420+
sage: X(x[0]^2*x[1])
421+
X[3, 2, 1]
422+
sage: X(x[0]*x[1]^2*x[2]^2*x[3] + x[0]^2*x[1]^2*x[2]*x[3] + x[0]^2*x[1]*x[2]^2*x[3])
423+
X[2, 4, 5, 3, 1]
424+
425+
sage: from sage.combinat.key_polynomial import KeyPolynomialBasis
426+
sage: k = KeyPolynomialBasis(QQ)
427+
sage: X(k([3,2,1]))
428+
X[4, 3, 2, 1]
429+
417430
TESTS:
418431
419432
We check that :trac:`12924` is fixed::
@@ -441,6 +454,14 @@ def _element_constructor_(self, x):
441454
return self._from_dict({perm: self.base_ring().one()})
442455
elif is_MPolynomial(x):
443456
return symmetrica.t_POLYNOM_SCHUBERT(x)
457+
elif isinstance(x, InfinitePolynomial_sparse):
458+
R = x.polynomial().parent()
459+
# massage the term order to be what symmetrica expects
460+
S = PolynomialRing(R.base_ring(),
461+
names=list(map(repr,reversed(R.gens()))))
462+
return symmetrica.t_POLYNOM_SCHUBERT(S(x.polynomial()))
463+
elif isinstance(x, KeyPolynomial):
464+
return self(x.expand())
444465
else:
445466
raise TypeError
446467

0 commit comments

Comments
 (0)