[GAP Forum] addition of linear mappings
Pasha Zusmanovich
justpasha at gmail.com
Fri Feb 18 08:44:13 GMT 2005
Dear people,
I am trying to add two linear mappings.
gap> GAPInfo.Version;
"4.4.4"
gap> V := VectorSpace (Rationals, [[1,0],[0,1]]);
<vector space over Rationals, with 2 generators>
gap> A := LeftModuleHomomorphismByImagesNC (V, V, Basis(V),
[[1,0],[0,0]]);
SemiEchelonBasis( <vector space over Rationals, with 2 generators>,
[ [ 1, 0 ], [ 0, 1 ] ] ) -> [ [ 1, 0 ], [ 0, 0 ] ]
gap> B := LeftModuleHomomorphismByImagesNC (V, V, Basis(V),
[[0,0],[0,1]]);
SemiEchelonBasis( <vector space over Rationals, with 2 generators>,
[ [ 1, 0 ], [ 0, 1 ] ] ) -> [ [ 0, 0 ], [ 0, 1 ] ]
So far, so good.
gap> A + B;
Error, <map1> and <map2> must have same (pre)image called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>
Indeed, Image(A) does not coincide with Image(B), but is it needed to be
able to add two mappings? Image(A) and Image(B) are guaranteed to be
subspaces of V, so their elements can be added safely. If one removes
the corresponding checks from lib/vspchom.gi (lines with
ImagesSource( map1 ) <> ImagesSource( map2 )
in two places), everything works like a charm:
gap> A + B;
SemiEchelonBasis( <vector space over Rationals, with 2 generators>,
[ [ 1, 0 ], [ 0, 1 ] ] ) -> [ [ 1, 0 ], [ 0, 1 ] ]
Am I missing something?
Thanks, Pasha.
More information about the Forum
mailing list