|
73 | 73 | #
|
74 | 74 | # https://www.gnu.org/licenses/
|
75 | 75 | # ****************************************************************************
|
76 |
| -from sage.combinat.free_module import CombinatorialFreeModule |
77 | 76 | 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 |
78 | 81 | from sage.rings.integer import Integer
|
79 | 82 | from sage.rings.integer_ring import ZZ
|
| 83 | +from sage.rings.polynomial.infinite_polynomial_element import InfinitePolynomial_sparse |
80 | 84 | from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
|
81 | 85 | 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 |
85 | 86 |
|
| 87 | +import sage.libs.symmetrica.all as symmetrica |
86 | 88 |
|
87 | 89 | def SchubertPolynomialRing(R):
|
88 | 90 | """
|
@@ -414,6 +416,17 @@ def _element_constructor_(self, x):
|
414 | 416 | sage: X(x1^2*x2)
|
415 | 417 | X[3, 2, 1]
|
416 | 418 |
|
| 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 | +
|
417 | 430 | TESTS:
|
418 | 431 |
|
419 | 432 | We check that :trac:`12924` is fixed::
|
@@ -441,6 +454,14 @@ def _element_constructor_(self, x):
|
441 | 454 | return self._from_dict({perm: self.base_ring().one()})
|
442 | 455 | elif is_MPolynomial(x):
|
443 | 456 | 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()) |
444 | 465 | else:
|
445 | 466 | raise TypeError
|
446 | 467 |
|
|
0 commit comments