Opened 4 months ago
Closed 4 months ago
#30180 closed enhancement (fixed)
Category Modules should provide a parent method module_morphism compatible with ModulesWithBasis.module_morphism
Reported by:  mkoeppe  Owned by:  

Priority:  major  Milestone:  sage9.2 
Component:  linear algebra  Keywords:  
Cc:  tscrim, egourgoulhon, ghmjungmath  Merged in:  
Authors:  Matthias Koeppe  Reviewers:  Eric Gourgoulhon 
Report Upstream:  N/A  Work issues:  
Branch:  e2fc5d5 (Commits)  Commit:  e2fc5d54c00a65e852cd8cbd9598417f686b3436 
Dependencies:  Stopgaps: 
Description
Because there is no distinguished basis, it would only support the option function
of ModulesWithBasis.module_morphism
:
def module_morphism(self, on_basis=None, matrix=None, function=None, diagonal=None, triangular=None, unitriangular=False, **keywords): r""" Construct a module morphism from ``self`` to ``codomain``. Let ``self`` be a module `X` with a basis indexed by `I`. This constructs a morphism `f: X \to Y` by linearity from a map `I \to Y` which is to be its restriction to the basis `(x_i)_{i \in I}` of `X`. Some variants are possible too. INPUT:  ``self``  a parent `X` in ``ModulesWithBasis(R)`` with basis `x=(x_i)_{i\in I}`. Exactly one of the four following options must be specified in order to define the morphism:  ``on_basis``  a function `f` from `I` to `Y`  ``diagonal``  a function `d` from `I` to `R` *KEEP*  ``function``  a function `f` from `X` to `Y`  ``matrix``  a matrix of size `\dim Y \times \dim X` (if the keyword ``side`` is set to ``'left'``) or `\dim Y \times \dim X` (if this keyword is ``'right'``) Further options include: *KEEP*  ``codomain``  the codomain `Y` of the morphism (default: ``f.codomain()`` if it's defined; otherwise it must be specified) *KEEP*  ``category``  a category or ``None`` (default: `None``)  ``zero``  the zero of the codomain (default: ``codomain.zero()``); can be used (with care) to define affine maps. Only meaningful with ``on_basis``.  ``position``  a nonnegative integer specifying which positional argument is used as the input of the function `f` (default: 0); this is currently only used with ``on_basis``.  ``triangular``  (default: ``None``) ``"upper"`` or ``"lower"`` or ``None``: * ``"upper"``  if the :meth:`~ModulesWithBasis.ElementMethods.leading_support` of the image of the basis vector `x_i` is `i`, or * ``"lower"``  if the :meth:`~ModulesWithBasis.ElementMethods.trailing_support` of the image of the basis vector `x_i` is `i`.  ``unitriangular``  (default: ``False``) a boolean. Only meaningful for a triangular morphism. As a shorthand, one may use ``unitriangular="lower"`` for ``triangular="lower", unitriangular=True``.  ``side``  "left" or "right" (default: "left") Only meaningful for a morphism built from a matrix.
Change History (8)
comment:1 Changed 4 months ago by
comment:2 Changed 4 months ago by
 Branch set to u/mkoeppe/category_modules_should_provide_a_parent_method_module_morphism_compatible_with_moduleswithbasis_module_morphism
comment:3 Changed 4 months ago by
 Commit set to 3c8d08013740e2f406008f189792b53f3a2efa0f
 Status changed from new to needs_review
comment:4 Changed 4 months ago by
 Commit changed from 3c8d08013740e2f406008f189792b53f3a2efa0f to e2fc5d54c00a65e852cd8cbd9598417f686b3436
Branch pushed to git repo; I updated commit sha1. New commits:
e2fc5d5  Make sure that we only create a module morphism

comment:5 Changed 4 months ago by
 Reviewers set to Eric Gourgoulhon
 Status changed from needs_review to positive_review
LGTM, except maybe for some pyflakes error reported by the patchbot, which are not clear to me.
comment:6 Changed 4 months ago by
You can ignore the pyflakes errors since they are unrelated to this ticket.
comment:7 Changed 4 months ago by
Thanks!
comment:8 Changed 4 months ago by
 Branch changed from u/mkoeppe/category_modules_should_provide_a_parent_method_module_morphism_compatible_with_moduleswithbasis_module_morphism to e2fc5d54c00a65e852cd8cbd9598417f686b3436
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Providing this method would allow us to simplify #30094 a tiny bit.