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

Commit f082858

Browse files
author
Travis Scrimshaw
committed
Merge branch 'public/combinat/invol-nsym-2' of trac.sagemath.org:sage into public/combinat/invol-nsym-2
* 'public/combinat/invol-nsym-2' of trac.sagemath.org:sage: more bugfixes left-padded Kronecker product on Sym too, and fixes for my own bugs: fixes to reduced Kronecker product on Sym, and a new (fake-)reduced Kronecker product on NSym; also a bugfix for some operations on NSym needlessly extending the base ring by QQ implemented internal product on Psi using NCSF2 Lemma 5.10; not using it as default because of its ugly worstcase running time verschiebung on elementary basis of NSym omega involution on QSym omega involution on NSym; alias for omega involution on Sym (to have notations match); subtle changes in duality pairing to avoid unadorned sum([...]). immaculate functions for arbitrary integer vectors First (slow but functional) implementation of reduced Kronecker product; also, t-completion of a partition (the docstring is probably more useful than the code here), and (unrelatedly) an additional option (and improved doc) in the partitions-to-Dyck-paths method.
2 parents 9db8c5c + bff955a commit f082858

11 files changed

+1799
-113
lines changed

src/sage/combinat/ncsf_qsym/generic_basis_code.py

+131-8
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,20 @@ def duality_pairing(self, x, y):
519519
0
520520
sage: S.duality_pairing(S[1,1,1,1], F[4])
521521
1
522+
523+
TESTS:
524+
525+
The result has the right parent even if the sum is empty::
526+
527+
sage: x = S.duality_pairing(S.zero(), F.zero()); x
528+
0
529+
sage: parent(x)
530+
Rational Field
522531
"""
523532
if hasattr(self, 'dual'):
524533
x = self(x)
525534
y = self.dual()(y)
526-
return sum(coeff * y[I] for (I, coeff) in x)
535+
return self.base_ring().sum(coeff * y[I] for (I, coeff) in x)
527536
else:
528537
return self.duality_pairing_by_coercion(x, y)
529538

@@ -541,8 +550,8 @@ def duality_pairing_by_coercion(self, x, y):
541550
542551
OUTPUT:
543552
544-
- The result of pairing the function ``x`` from ``self`` with the function
545-
``y`` from the dual basis of ``self``
553+
- The result of pairing the function ``x`` from ``self`` with
554+
the function ``y`` from the dual basis of ``self``
546555
547556
EXAMPLES::
548557
@@ -556,11 +565,20 @@ def duality_pairing_by_coercion(self, x, y):
556565
1
557566
sage: F.duality_pairing_by_coercion(F[1,2], L[1,1,1])
558567
1
568+
569+
TESTS:
570+
571+
The result has the right parent even if the sum is empty::
572+
573+
sage: x = F.duality_pairing_by_coercion(F.zero(), L.zero()); x
574+
0
575+
sage: parent(x)
576+
Rational Field
559577
"""
560578
a_realization = self.realization_of().a_realization()
561579
x = a_realization(x)
562580
y = a_realization.dual()(y)
563-
return sum(coeff * y[I] for (I, coeff) in x)
581+
return self.base_ring().sum(coeff * y[I] for (I, coeff) in x)
564582

565583
def duality_pairing_matrix(self, basis, degree):
566584
r"""
@@ -574,8 +592,9 @@ def duality_pairing_matrix(self, basis, degree):
574592
575593
OUTPUT:
576594
577-
- The matrix of scalar products between the basis ``self`` and the basis
578-
``basis`` in the dual Hopf algebra of degree ``degree``.
595+
- The matrix of scalar products between the basis ``self``
596+
and the basis ``basis`` in the dual Hopf algebra in
597+
degree ``degree``.
579598
580599
EXAMPLES:
581600
@@ -733,10 +752,53 @@ def degree_negation(self, element):
733752
Generalize this to all graded vector spaces?
734753
"""
735754
return self.sum_of_terms([ (lam, (-1)**(sum(lam)%2) * a)
736-
for lam, a in self(element) ])
755+
for lam, a in self(element) ],
756+
distinct=True)
737757

738758
class ElementMethods:
739759

760+
def degree_negation(self):
761+
r"""
762+
Return the image of ``self`` under the degree negation
763+
automorphism of the parent of ``self``.
764+
765+
The degree negation is the automorphism which scales every
766+
homogeneous element of degree `k` by `(-1)^k` (for all `k`).
767+
768+
Calling ``degree_negation(self)`` is equivalent to calling
769+
``self.parent().degree_negation(self)``.
770+
771+
EXAMPLES::
772+
773+
sage: NSym = NonCommutativeSymmetricFunctions(ZZ)
774+
sage: S = NSym.S()
775+
sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]]
776+
sage: f.degree_negation()
777+
-3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1]
778+
779+
sage: QSym = QuasiSymmetricFunctions(QQ)
780+
sage: dI = QSym.dualImmaculate()
781+
sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1]
782+
sage: f.degree_negation()
783+
-2*dI[1] + 4*dI[2] + 3*dI[2, 1]
784+
785+
TESTS:
786+
787+
The zero element behaves well::
788+
789+
sage: a = S.zero().degree_negation(); a
790+
0
791+
sage: parent(a)
792+
Non-Commutative Symmetric Functions over the Integer Ring in the Complete basis
793+
794+
.. TODO::
795+
796+
Generalize this to all graded vector spaces?
797+
"""
798+
return self.parent().sum_of_terms([ (lam, (-1)**(sum(lam)%2) * a)
799+
for lam, a in self ],
800+
distinct=True)
801+
740802
def duality_pairing(self, y):
741803
r"""
742804
The duality pairing between elements of `NSym` and elements
@@ -1131,7 +1193,68 @@ def internal_product(self, other):
11311193
\rangle \langle g, h^{\prime\prime}_i \rangle,
11321194
11331195
where we write `\Delta^{\times}(h)` as `\sum_i h^{\prime}_i
1134-
\otimes h^{\prime\prime}_i`.
1196+
\otimes h^{\prime\prime}_i`. Here, `f * g` denotes the internal
1197+
product of the non-commutative symmetric functions `f` and `g`.
1198+
1199+
If `f` and `g` are two homogeneous elements of `NSym` having
1200+
distinct degrees, then the internal product `f * g` is zero.
1201+
1202+
Explicit formulas can be given for internal products of
1203+
elements of the complete and the Psi bases. First, the formula
1204+
for the complete basis ([NCSF1]_ Proposition 5.1): If `I` and
1205+
`J` are two compositions of lengths `p` and `q`, respectively,
1206+
then the corresponding complete homogeneous non-commutative
1207+
symmetric functions `S^I` and `S^J` have internal product
1208+
1209+
.. MATH::
1210+
1211+
S^I * S^J = \sum S^{\operatorname*{comp}M},
1212+
1213+
where the sum ranges over all `p \times q`-matrices
1214+
`M \in \NN^{p \times q}` (with nonnegative integers as
1215+
entries) whose row sum vector is `I` (that is, the sum of the
1216+
entries of the `r`-th row is the `r`-th part of `I` for all
1217+
`r`) and whose column sum vector is `J` (that is, the sum of
1218+
all entries of the `s`-th row is the `s`-th part of `J` for
1219+
all `s`). Here, for any `M \in \NN^{p \times q}`, we denote
1220+
by `\operatorname*{comp}M` the composition obtained by
1221+
reading the entries of the matrix `M` in the usual order
1222+
(row by row, proceeding left to right in each row,
1223+
traversing the rows from top to bottom).
1224+
1225+
The formula on the Psi basis ([NCSF2]_ Lemma 3.10) is more
1226+
complicated. Let `I` and `J` be two compositions of lengths
1227+
`p` and `q`, respectively, having the same size `|I| = |J|`.
1228+
We denote by `\Psi^K` the element of the Psi-basis
1229+
corresponding to any composition `K`.
1230+
1231+
- If `p > q`, then `\Psi^I * \Psi^J` is plainly `0`.
1232+
1233+
- Assume that `p = q`. Let `\widetilde{\delta}_{I, J}` denote
1234+
the integer `1` if the compositions `I` and `J` are
1235+
permutations of each other, and the integer `0` otherwise.
1236+
For every positive integer `i`, let `m_i` denote the number
1237+
of parts of `I` equal to `i`. Then, `\Psi^I * \Psi^J` equals
1238+
`\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I`.
1239+
1240+
- Now assume that `p < q`. Write the composition `I` as
1241+
`I = (i_1, i_2, \ldots, i_p)`. For every nonempty
1242+
composition `K = (k_1, k_2, \ldots, k_s)`, denote by
1243+
`\Gamma_K` the non-commutative symmetric function
1244+
`k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}],
1245+
\ldots \Psi_{k_s}]`. For any subset `S` of
1246+
`\{ 1, 2, \ldots, q \}`, let `J_S` be the composition
1247+
obtained from `J` by removing the `r`-th parts for all
1248+
`r \notin S` (while keeping the `r`-th parts for all
1249+
`r \in S` in order). Then, `\Psi^I * \Psi^J` equals the
1250+
sum of `\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots
1251+
\Gamma_{J_{K_p}}` over all ordered set partitions
1252+
`(K_1, K_2, \ldots, K_p)` of `\{ 1, 2, \ldots, q \}`
1253+
into `p` parts such that each `1 \leq k \leq p` satisfies
1254+
`|J_{K_k}| = i_k`.
1255+
(See
1256+
:meth:`~sage.combinat.set_partition_ordered.OrderedSetPartition`
1257+
for the meaning of "ordered set partition".)
11351258
11361259
Aliases for :meth:`internal_product()` are :meth:`itensor()` and
11371260
:meth:`kronecker_product()`.

0 commit comments

Comments
 (0)