Opened 2 years ago

Closed 2 years 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: sage-9.2
Component: linear algebra Keywords:
Cc: tscrim, egourgoulhon, gh-mjungmath Merged in:
Authors: Matthias Koeppe Reviewers: Eric Gourgoulhon
Report Upstream: N/A Work issues:
Branch: e2fc5d5 (Commits, GitHub, GitLab) Commit: e2fc5d54c00a65e852cd8cbd9598417f686b3436
Dependencies: Stopgaps:

Status badges


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,
            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


            - ``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: ````);
              can be used (with care) to define affine maps.
              Only meaningful with ``on_basis``.

            - ``position`` -- a non-negative 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
                of the image of the basis vector `x_i` is `i`, or

              * ``"lower"`` - if the
                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 2 years ago by mkoeppe

Providing this method would allow us to simplify #30094 a tiny bit.

comment:2 Changed 2 years ago by mkoeppe

  • Branch set to u/mkoeppe/category_modules_should_provide_a_parent_method_module_morphism_compatible_with_moduleswithbasis_module_morphism

comment:3 Changed 2 years ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Commit set to 3c8d08013740e2f406008f189792b53f3a2efa0f
  • Status changed from new to needs_review

New commits:

0afa01cModules: Add parent method module_morphism
3c8d080Fix docstring markup

comment:4 Changed 2 years ago by git

  • Commit changed from 3c8d08013740e2f406008f189792b53f3a2efa0f to e2fc5d54c00a65e852cd8cbd9598417f686b3436

Branch pushed to git repo; I updated commit sha1. New commits:

e2fc5d5Make sure that we only create a module morphism

comment:5 Changed 2 years ago by egourgoulhon

  • 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 2 years ago by tscrim

You can ignore the pyflakes errors since they are unrelated to this ticket.

comment:7 Changed 2 years ago by mkoeppe


comment:8 Changed 2 years ago by vbraun

  • 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.