sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.42k stars 478 forks source link

Allow addition and scalar multiples of ModuleMorphism #25337

Open tscrim opened 6 years ago

tscrim commented 6 years ago

These are natural operations, but currently they are not implemented, resulting in the following:

sage: C = CombinatorialFreeModule(QQ, 'abc')
sage: phi = C.module_morphism(diagonal=lambda x: 2, codomain=C)
sage: phi + phi
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: 'NotImplementedType' object is not callable
sage: 3*phi
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for *: 'Integer Ring' and 'Set of Morphisms from Free module generated by {'a', 'b', 'c'} over Rational Field to Free module generated by {'a', 'b', 'c'} over Rational Field in Category of vector spaces with basis over Rational Field'

We will have to be a little careful with the resulting homset when these are algebra morphisms. My thought is to play it safe and have the result just be in the homset as (finite-dimensional) R-modules with basis.

CC: @sagetrac-sage-combinat @nthiery @darijgr @tscrim

Component: linear algebra

Issue created by migration from https://trac.sagemath.org/ticket/25337

videlec commented 6 years ago
comment:1

update milestone 8.3 -> 8.4

mkoeppe commented 3 years ago
comment:3

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.