-
-
Notifications
You must be signed in to change notification settings - Fork 842
provide a construction functor using individual functors #37686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,23 @@ | |||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class generic_character(SFA_generic): | ||||||||||||
|
|
||||||||||||
| def construction(self): | ||||||||||||
| """ | ||||||||||||
| Return a pair ``(F, R)``, where ``F`` is a | ||||||||||||
| :class:`SymmetricFunctionsFunctor` and `R` is a ring, such | ||||||||||||
| that ``F(R)`` returns ``self``. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: ht = SymmetricFunctions(QQ).ht() | ||||||||||||
| sage: ht.construction() | ||||||||||||
| (SymmetricFunctionsFunctor[induced trivial symmetric group character], | ||||||||||||
| Rational Field) | ||||||||||||
| """ | ||||||||||||
| return (CharacterSymmetricFunctionsFunctor(self, self.basis_name()), | ||||||||||||
| self.base_ring()) | ||||||||||||
|
|
||||||||||||
| def _my_key(self, la): | ||||||||||||
| r""" | ||||||||||||
| A rank function for partitions. | ||||||||||||
|
|
@@ -151,6 +168,61 @@ def _b_power_k(self, k): | |||||||||||
| for d in divisors(k)) | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| from sage.combinat.sf.sfa import SymmetricFunctionsFunctor | ||||||||||||
| class CharacterSymmetricFunctionsFunctor(SymmetricFunctionsFunctor): | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every basis should come with a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The strange thing here is that |
||||||||||||
| def __init__(self, basis, name): | ||||||||||||
|
Comment on lines
+172
to
+173
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would move the |
||||||||||||
| r""" | ||||||||||||
| Initialise the functor. | ||||||||||||
|
|
||||||||||||
| INPUT: | ||||||||||||
|
|
||||||||||||
| - ``basis`` -- the basis of the Character symmetric function algebra | ||||||||||||
| - ``name`` -- the name of the basis | ||||||||||||
|
|
||||||||||||
| .. WARNING:: | ||||||||||||
|
|
||||||||||||
| The codomain of this functor could actually be | ||||||||||||
| :class:`CommutativeAlgebras` over the given ring, but | ||||||||||||
| parameterized functors are currently not available. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: from sage.combinat.sf.character import CharacterSymmetricFunctionsFunctor | ||||||||||||
| sage: B = SymmetricFunctions(QQ).ht() | ||||||||||||
| sage: CharacterSymmetricFunctionsFunctor(B, B.basis_name()) | ||||||||||||
| SymmetricFunctionsFunctor[induced trivial symmetric group character] | ||||||||||||
|
|
||||||||||||
| """ | ||||||||||||
|
Comment on lines
+193
to
+195
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| super().__init__(basis, name) | ||||||||||||
| self._prefix = basis._prefix | ||||||||||||
|
|
||||||||||||
| def _apply_functor(self, R): | ||||||||||||
| """ | ||||||||||||
| Apply the functor to an object of ``self``'s domain. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: B = SymmetricFunctions(QQ).ht() | ||||||||||||
| sage: F, R = B.construction() # indirect doctest | ||||||||||||
| sage: F(QQbar) | ||||||||||||
| Symmetric Functions over Algebraic Field in the induced trivial | ||||||||||||
| symmetric group character basis | ||||||||||||
| """ | ||||||||||||
| from sage.combinat.sf.sf import SymmetricFunctions | ||||||||||||
| return self._basis(SymmetricFunctions(R), self._prefix) | ||||||||||||
|
|
||||||||||||
| def __eq__(self, other): | ||||||||||||
| """ | ||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: B1 = SymmetricFunctions(QQ).ht() | ||||||||||||
| sage: B2 = SymmetricFunctions(QQ).st() | ||||||||||||
| sage: B1.construction()[0] == B2.construction()[0] | ||||||||||||
| False | ||||||||||||
| """ | ||||||||||||
| return super().__eq__(other) and self._prefix == other._prefix | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class induced_trivial_character_basis(generic_character): | ||||||||||||
| r""" | ||||||||||||
| The induced trivial symmetric group character basis of | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,16 @@ | |
|
|
||
|
|
||
| class SymmetricFunctionAlgebra_dual(classical.SymmetricFunctionAlgebra_classical): | ||
| def __init__(self, dual_basis, scalar, scalar_name="", basis_name=None, prefix=None): | ||
| @staticmethod | ||
| def __classcall__(cls, dual_basis, scalar, scalar_name="", basis_name=None, prefix=None): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a doctest (e.g., checking the uniqueness). |
||
| """ | ||
| Normalize the arguments. | ||
| """ | ||
| if prefix is None: | ||
| prefix = 'd_'+dual_basis.prefix() | ||
| return super().__classcall__(cls, dual_basis, scalar, scalar_name, basis_name, prefix) | ||
|
|
||
| def __init__(self, dual_basis, scalar, scalar_name, basis_name, prefix): | ||
| r""" | ||
| Generic dual basis of a basis of symmetric functions. | ||
|
|
||
|
|
@@ -72,9 +81,9 @@ def __init__(self, dual_basis, scalar, scalar_name="", basis_name=None, prefix=N | |
| EXAMPLES:: | ||
|
|
||
| sage: e = SymmetricFunctions(QQ).e() | ||
| sage: f = e.dual_basis(prefix = "m", basis_name="Forgotten symmetric functions"); f | ||
| sage: f = e.dual_basis(prefix="m", basis_name="Forgotten symmetric functions"); f | ||
| Symmetric Functions over Rational Field in the Forgotten symmetric functions basis | ||
| sage: TestSuite(f).run(elements = [f[1,1]+2*f[2], f[1]+3*f[1,1]]) | ||
| sage: TestSuite(f).run(elements=[f[1,1]+2*f[2], f[1]+3*f[1,1]]) | ||
| sage: TestSuite(f).run() # long time (11s on sage.math, 2011) | ||
|
|
||
| This class defines canonical coercions between ``self`` and | ||
|
|
@@ -145,9 +154,6 @@ def __init__(self, dual_basis, scalar, scalar_name="", basis_name=None, prefix=N | |
| self._sym = sage.combinat.sf.sf.SymmetricFunctions(scalar_target) | ||
| self._p = self._sym.power() | ||
|
|
||
| if prefix is None: | ||
| prefix = 'd_'+dual_basis.prefix() | ||
|
|
||
| classical.SymmetricFunctionAlgebra_classical.__init__(self, self._sym, | ||
| basis_name=basis_name, | ||
| prefix=prefix) | ||
|
|
@@ -157,6 +163,20 @@ def __init__(self, dual_basis, scalar, scalar_name="", basis_name=None, prefix=N | |
| self.register_coercion(SetMorphism(Hom(self._dual_basis, self, category), self._dual_to_self)) | ||
| self._dual_basis.register_coercion(SetMorphism(Hom(self, self._dual_basis, category), self._self_to_dual)) | ||
|
|
||
| def construction(self): | ||
| """ | ||
| Return a pair ``(F, R)``, where ``F`` is a | ||
| :class:`SymmetricFunctionsFunctor` and `R` is a ring, such | ||
| that ``F(R)`` returns ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: w = SymmetricFunctions(ZZ).witt() | ||
| sage: w.dual_basis().construction() | ||
| (SymmetricFunctionsFunctor[dual Witt], Integer Ring) | ||
| """ | ||
| return DualBasisFunctor(self), self.base_ring() | ||
|
|
||
| def _dual_to_self(self, x): | ||
| """ | ||
| Coerce an element of the dual of ``self`` canonically into ``self``. | ||
|
|
@@ -259,6 +279,24 @@ def _dual_basis_default(self): | |
| """ | ||
| return self._dual_basis | ||
|
|
||
| def basis_name(self): | ||
| r""" | ||
| Return the name of the basis of ``self``. | ||
|
|
||
| This is used for output and, for the classical bases of | ||
| symmetric functions, to connect this basis with Symmetrica. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: Sym = SymmetricFunctions(QQ) | ||
| sage: f = Sym.f() | ||
| sage: f.basis_name() | ||
| 'forgotten' | ||
| """ | ||
| if self._basis_name is None: | ||
| return "dual " + self._dual_basis.basis_name() | ||
| return self._basis_name | ||
|
|
||
| def _repr_(self): | ||
| """ | ||
| Representation of ``self``. | ||
|
|
@@ -276,12 +314,11 @@ def _repr_(self): | |
| sage: h = m.dual_basis(scalar=zee, scalar_name='Hall scalar product'); h #indirect doctest | ||
| Dual basis to Symmetric Functions over Rational Field in the monomial basis with respect to the Hall scalar product | ||
| """ | ||
| if hasattr(self, "_basis"): | ||
| if self._basis_name is not None: | ||
| return super()._repr_() | ||
| if self._scalar_name: | ||
| return "Dual basis to %s" % self._dual_basis + " with respect to the " + self._scalar_name | ||
| else: | ||
| return "Dual basis to %s" % self._dual_basis | ||
| return "Dual basis to %s" % self._dual_basis | ||
|
|
||
| def _precompute(self, n): | ||
| """ | ||
|
|
@@ -890,6 +927,72 @@ def expand(self, n, alphabet='x'): | |
| return self._dual.expand(n, alphabet) | ||
|
|
||
|
|
||
| from sage.combinat.sf.sfa import SymmetricFunctionsFunctor | ||
| class DualBasisFunctor(SymmetricFunctionsFunctor): | ||
| """ | ||
| A constructor for algebras of symmetric functions constructed by | ||
| duality. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: w = SymmetricFunctions(ZZ).witt() | ||
| sage: w.dual_basis().construction() | ||
| (SymmetricFunctionsFunctor[dual Witt], Integer Ring) | ||
| """ | ||
| def __init__(self, basis): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a doctest (as always, a |
||
| r""" | ||
| Initialise the functor. | ||
|
|
||
| INPUT: | ||
|
|
||
| - ``basis`` -- the basis of the symmetric function algebra | ||
| """ | ||
| self._dual_basis = basis._dual_basis | ||
| self._basis_name = basis._basis_name | ||
| self._scalar = basis._scalar | ||
| self._scalar_name = basis._scalar_name | ||
| self._prefix = basis._prefix | ||
| super().__init__(basis, self._basis_name) | ||
|
|
||
| def _apply_functor(self, R): | ||
| """ | ||
| Apply the functor to an object of ``self``'s domain. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: m = SymmetricFunctions(ZZ).monomial() | ||
| sage: zee = sage.combinat.sf.sfa.zee | ||
| sage: h = m.dual_basis(scalar=zee) | ||
| sage: F, R = h.construction() # indirect doctest | ||
| sage: F(QQ) | ||
| Dual basis to Symmetric Functions over Rational Field in the monomial basis | ||
|
|
||
| sage: b = m.dual_basis(scalar=zee).dual_basis(scalar=lambda x: 1) | ||
| sage: F, R = b.construction() # indirect doctest | ||
| sage: F(QQ) | ||
| Dual basis to Dual basis to Symmetric Functions over Rational Field in the monomial basis | ||
| """ | ||
| dual_basis = self._dual_basis.change_ring(R) | ||
| return self._basis(dual_basis, self._scalar, self._scalar_name, | ||
| self._basis_name, self._prefix) | ||
|
|
||
| def _repr_(self): | ||
| """ | ||
| Return a string representation of ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: w = SymmetricFunctions(ZZ).witt() | ||
| sage: w.dual_basis().construction() | ||
| (SymmetricFunctionsFunctor[dual Witt], Integer Ring) | ||
| """ | ||
| if self._basis_name is None: | ||
| name = "dual " + self._dual_basis.basis_name() | ||
| else: | ||
| name = self._basis_name | ||
| return "SymmetricFunctionsFunctor[" + name + "]" | ||
|
|
||
|
|
||
| # Backward compatibility for unpickling | ||
| from sage.misc.persist import register_unpickle_override | ||
| register_unpickle_override('sage.combinat.sf.dual', 'SymmetricFunctionAlgebraElement_dual', SymmetricFunctionAlgebra_dual.Element) | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -77,7 +77,14 @@ def __repr__(self): | |||||||||||
| """ | ||||||||||||
| return self._name + " over %s" % self._sym.base_ring() | ||||||||||||
|
|
||||||||||||
| def __init__(self, Sym, t='t'): | ||||||||||||
| @staticmethod | ||||||||||||
| def __classcall__(cls, Sym, t='t'): | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a doctest (such as testing uniqueness). |
||||||||||||
| """ | ||||||||||||
| Normalize the arguments. | ||||||||||||
| """ | ||||||||||||
| return super().__classcall__(cls, Sym, Sym.base_ring()(t)) | ||||||||||||
|
|
||||||||||||
| def __init__(self, Sym, t): | ||||||||||||
| """ | ||||||||||||
| Initialize ``self``. | ||||||||||||
|
|
||||||||||||
|
|
@@ -387,6 +394,24 @@ def __init__(self, hall_littlewood): | |||||||||||
| self .register_coercion(SetMorphism(Hom(self._s, self, category), self._s_to_self)) | ||||||||||||
| self._s.register_coercion(SetMorphism(Hom(self, self._s, category), self._self_to_s)) | ||||||||||||
|
|
||||||||||||
| def construction(self): | ||||||||||||
| """ | ||||||||||||
| Return a pair ``(F, R)``, where ``F`` is a | ||||||||||||
| :class:`SymmetricFunctionsFunctor` and `R` is a ring, such | ||||||||||||
| that ``F(R)`` returns ``self``. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: P = SymmetricFunctions(QQ).hall_littlewood(t=2).P() | ||||||||||||
| sage: P.construction() | ||||||||||||
| (SymmetricFunctionsFunctor[Hall-Littlewood P with t=2], Rational Field) | ||||||||||||
| """ | ||||||||||||
|
|
||||||||||||
| return (HallLittlewoodSymmetricFunctionsFunctor(self, | ||||||||||||
|
Comment on lines
+408
to
+410
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| self.basis_name(), | ||||||||||||
| self.t), | ||||||||||||
| self.base_ring()) | ||||||||||||
|
|
||||||||||||
| def _s_to_self(self, x): | ||||||||||||
| r""" | ||||||||||||
| Isomorphism from the Schur basis into ``self`` | ||||||||||||
|
|
@@ -673,6 +698,80 @@ def scalar_hl(self, x, t=None): | |||||||||||
| orthogonal=True) | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| from sage.combinat.sf.sfa import SymmetricFunctionsFunctor | ||||||||||||
| class HallLittlewoodSymmetricFunctionsFunctor(SymmetricFunctionsFunctor): | ||||||||||||
| def __init__(self, basis, name, t): | ||||||||||||
| r"""Initialise the functor. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| INPUT: | ||||||||||||
|
|
||||||||||||
| - ``basis`` -- the basis of the Hall-Littlewood symmetric function | ||||||||||||
| algebra | ||||||||||||
| - ``name`` -- the name of the basis | ||||||||||||
| - ``t`` -- the parameter `t` | ||||||||||||
|
|
||||||||||||
| .. WARNING:: | ||||||||||||
|
|
||||||||||||
| Strictly speaking, this is not a functor on | ||||||||||||
| :class:`CommutativeRings`, but rather a functor on | ||||||||||||
| commutative rings with a distinguished element. Apart | ||||||||||||
| from that, the codomain of this functor could actually be | ||||||||||||
| :class:`CommutativeAlgebras` over the given ring, but | ||||||||||||
| parameterized functors are currently not available. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: from sage.combinat.sf.hall_littlewood import HallLittlewoodSymmetricFunctionsFunctor | ||||||||||||
| sage: R.<t> = ZZ[] | ||||||||||||
| sage: P = SymmetricFunctions(R).hall_littlewood().P() | ||||||||||||
| sage: HallLittlewoodSymmetricFunctionsFunctor(P, P.basis_name(), t) | ||||||||||||
| SymmetricFunctionsFunctor[Hall-Littlewood P] | ||||||||||||
| """ | ||||||||||||
| super().__init__(basis, name) | ||||||||||||
| self._t = t | ||||||||||||
|
|
||||||||||||
| def _apply_functor(self, R): | ||||||||||||
| """ | ||||||||||||
| Apply the functor to an object of ``self``'s domain. | ||||||||||||
|
|
||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: Sym = SymmetricFunctions(QQ['t']) | ||||||||||||
| sage: P = Sym.hall_littlewood().P(); P | ||||||||||||
| Symmetric Functions over Univariate Polynomial Ring in t | ||||||||||||
| over Rational Field in the Hall-Littlewood P basis | ||||||||||||
| sage: F, R = P.construction() # indirect doctest | ||||||||||||
| sage: F(QQ['t']) | ||||||||||||
| Symmetric Functions over Univariate Polynomial Ring in t | ||||||||||||
| over Rational Field in the Hall-Littlewood P basis | ||||||||||||
|
|
||||||||||||
| TESTS:: | ||||||||||||
|
|
||||||||||||
| sage: F(QQ) | ||||||||||||
| Traceback (most recent call last): | ||||||||||||
| ... | ||||||||||||
| TypeError: not a constant polynomial | ||||||||||||
| """ | ||||||||||||
| from sage.combinat.sf.sf import SymmetricFunctions | ||||||||||||
| return self._basis(HallLittlewood(SymmetricFunctions(R), self._t)) | ||||||||||||
|
|
||||||||||||
| def __eq__(self, other): | ||||||||||||
| """ | ||||||||||||
| EXAMPLES:: | ||||||||||||
|
|
||||||||||||
| sage: R.<q, t> = ZZ[] | ||||||||||||
| sage: S.<q, t> = QQ[] | ||||||||||||
| sage: T.<q, s> = QQ[] | ||||||||||||
| sage: PR = SymmetricFunctions(R).hall_littlewood().P() | ||||||||||||
| sage: PS = SymmetricFunctions(S).hall_littlewood().P() | ||||||||||||
| sage: PT = SymmetricFunctions(T).hall_littlewood(t=s).P() | ||||||||||||
| sage: PR.construction()[0] == PS.construction()[0] | ||||||||||||
| True | ||||||||||||
| sage: PR.construction()[0] == PT.construction()[0] | ||||||||||||
| False | ||||||||||||
| """ | ||||||||||||
| return super().__eq__(other) and self._t == other._t | ||||||||||||
|
|
||||||||||||
| ########### | ||||||||||||
| # P basis # | ||||||||||||
| ########### | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.