@@ -1671,7 +1671,8 @@ class Stream_plethysm(Stream_binary):
1671
1671
INPUT:
1672
1672
1673
1673
- ``f`` -- a :class:`Stream`
1674
- - ``g`` -- a :class:`Stream` with positive order
1674
+ - ``g`` -- a :class:`Stream` with positive order, unless ``f`` is
1675
+ of :class:`Stream_exact`.
1675
1676
- ``p`` -- the powersum symmetric functions
1676
1677
- ``ring`` (optional, default ``None``) -- the ring the result
1677
1678
should be in, by default ``p``
@@ -1702,12 +1703,20 @@ class Stream_plethysm(Stream_binary):
1702
1703
s[1, 1, 1] + s[2, 1] + 2*s[3],
1703
1704
s[1, 1, 1, 1] + s[2, 1, 1] + 3*s[3, 1] + 2*s[4]]
1704
1705
1706
+ This class also handles the plethysm of an exact stream with a
1707
+ stream of order `0`::
1708
+
1709
+ sage: from sage.data_structures.stream import Stream_exact
1710
+ sage: f = Stream_exact([s[1]], True, order=1)
1711
+ sage: g = Stream_function(lambda n: s[n], s, True, 0)
1712
+ sage: r = Stream_plethysm(f, g, p, s)
1713
+ sage: [r[n] for n in range(3)]
1714
+ [s[], s[1], s[2]]
1715
+
1705
1716
TESTS:
1706
1717
1707
1718
Check corner cases::
1708
1719
1709
- sage: from sage.data_structures.stream import Stream_exact
1710
- sage: p = SymmetricFunctions(QQ).p()
1711
1720
sage: f0 = Stream_exact([p([])], True)
1712
1721
sage: f1 = Stream_exact([p[1]], True, order=1)
1713
1722
sage: f2 = Stream_exact([p[2]], True, order=2 )
@@ -1768,7 +1777,10 @@ def __init__(self, f, g, p, ring=None, include=None, exclude=None):
1768
1777
else :
1769
1778
self ._tensor_power = None
1770
1779
p_f = Stream_map_coefficients (f , lambda x : x , p )
1771
-
1780
+ if isinstance (f , Stream_exact ) and not f ._constant :
1781
+ self ._degree_f = f ._degree
1782
+ else :
1783
+ self ._degree_f = None
1772
1784
self ._degree_one = _variables_recursive (R , include = include , exclude = exclude )
1773
1785
super ().__init__ (p_f , p_g , f ._is_sparse , val )
1774
1786
@@ -1799,9 +1811,13 @@ def get_coefficient(self, n):
1799
1811
4*s[1, 1, 1, 1, 1] + 4*s[2, 1, 1, 1] + 2*s[2, 2, 1] + 2*s[3, 1, 1] + s[3, 2] + s[4, 1] + s[5]]
1800
1812
"""
1801
1813
if not n : # special case of 0
1802
- if self ._tensor_power is None :
1803
- return self ._left [0 ]
1804
- return self ._basis (self ._left [0 ].coefficient ([]))
1814
+ if self ._right [0 ]:
1815
+ assert self ._degree_f is not None , "the plethysm with a lazy symmetric function of valuation 0 is defined only for symmetric functions of finite support"
1816
+
1817
+ return sum ((c * self ._compute_product (n , la )
1818
+ for k in range (self ._left ._approximate_order , self ._degree_f )
1819
+ for la , c in self ._left [k ]),
1820
+ self ._basis .zero ())
1805
1821
1806
1822
return sum ((c * self ._compute_product (n , la )
1807
1823
for k in range (self ._left ._approximate_order , n + 1 )
@@ -1823,18 +1839,25 @@ def _compute_product(self, n, la):
1823
1839
sage: A = h._compute_product(7, Partition([2, 1])); A
1824
1840
1/12*p[2, 2, 1, 1, 1] + 1/4*p[2, 2, 2, 1] + 1/6*p[3, 2, 2]
1825
1841
+ 1/12*p[4, 1, 1, 1] + 1/4*p[4, 2, 1] + 1/6*p[4, 3]
1826
- sage: A == p[2,1](s[2] + s[3]).homogeneous_component(7)
1842
+ sage: A == p[2, 1](s[2] + s[3]).homogeneous_component(7)
1827
1843
True
1828
1844
1829
1845
sage: p2 = tensor([p, p])
1830
1846
sage: f = Stream_zero(True) # irrelevant for this test
1831
1847
sage: g = Stream_function(lambda n: sum(tensor([p[k], p[n-k]]) for k in range(n+1)), p2, True, 1)
1832
1848
sage: h = Stream_plethysm(f, g, p2)
1833
1849
sage: A = h._compute_product(7, Partition([2, 1]))
1834
- sage: B = p[2,1](sum(g[n] for n in range(7)))
1850
+ sage: B = p[2, 1](sum(g[n] for n in range(7)))
1835
1851
sage: B = p2.element_class(p2, {m: c for m, c in B if sum(mu.size() for mu in m) == 7})
1836
1852
sage: A == B
1837
1853
True
1854
+
1855
+ sage: f = Stream_zero(True) # irrelevant for this test
1856
+ sage: g = Stream_function(lambda n: s[n], p, True, 0)
1857
+ sage: h = Stream_plethysm(f, g, p)
1858
+ sage: B = p[2, 2, 1](sum(s[i] for i in range(7)))
1859
+ sage: all(h._compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7))
1860
+ True
1838
1861
"""
1839
1862
ret = self ._basis .zero ()
1840
1863
la_exp = la .to_exp ()
@@ -1846,10 +1869,10 @@ def _compute_product(self, n, la):
1846
1869
if any (d < self ._right ._approximate_order * m
1847
1870
for m , d in zip (exp , k )):
1848
1871
continue
1849
- temp = self ._basis .one ()
1872
+ prod = self ._basis .one ()
1850
1873
for i , m , d in zip (wgt , exp , k ):
1851
- temp *= self ._stretched_power_restrict_degree (i , m , d )
1852
- ret += temp
1874
+ prod *= self ._stretched_power_restrict_degree (i , m , d )
1875
+ ret += prod
1853
1876
return ret
1854
1877
1855
1878
def _stretched_power_restrict_degree (self , i , m , d ):
0 commit comments