############################################################################# ## ## Read this file into GAP 4.4.9 ## in order to fix problems with linear mappings ## whose (pre)image is trivial. ## if CompareVersionNumbers( GAPInfo.Version, "4.4.10" ) then Print( "#I Reading the file with corrections for linear mappings\n", "#I whose (pre)image is trivial is no longer necessary in GAP ", GAPInfo.Version, ".\n" ); else MakeReadWriteGlobal( "MakeImagesInfoLinearGeneralMappingByImages" ); UnbindGlobal( "MakeImagesInfoLinearGeneralMappingByImages" ); BindGlobal( "MakeImagesInfoLinearGeneralMappingByImages", function( map ) local preimage, ech, mapi, B; preimage:= PreImagesRange( map ); mapi:= MappingGeneratorsImages( map ); if Dimension( preimage ) = 0 then # Set the entries explicitly. map!.basispreimage := Basis( preimage ); map!.corelations := IdentityMat( Length( mapi[2] ), LeftActingDomain( preimage ) ); map!.imagesbasispreimage := Immutable( [] ); elif IsGaussianRowSpace( Source( map ) ) then # The images of the basis vectors are obtained on # forming the linear combinations of images of generators # given by `ech.coeffs'. ech:= SemiEchelonMatTransformation( mapi[1] ); map!.basispreimage := SemiEchelonBasisNC( preimage, ech.vectors ); map!.corelations := Immutable( ech.relations ); map!.imagesbasispreimage := Immutable( ech.coeffs * mapi[2] ); else # Delegate the work to the associated row space. B:= Basis( preimage ); ech:= SemiEchelonMatTransformation( List( mapi[1], x -> Coefficients( B, x ) ) ); map!.basispreimage := BasisNC( preimage, List( ech.vectors, x -> LinearCombination( B, x ) ) ); map!.corelations := Immutable( ech.relations ); map!.imagesbasispreimage := Immutable( List( ech.coeffs, x -> LinearCombination( x, mapi[2] ) ) ); fi; end ); MakeReadWriteGlobal( "MakePreImagesInfoLinearGeneralMappingByImages" ); UnbindGlobal( "MakePreImagesInfoLinearGeneralMappingByImages" ); BindGlobal( "MakePreImagesInfoLinearGeneralMappingByImages", function( map ) local image, ech, mapi, B; mapi:= MappingGeneratorsImages( map ); image:= ImagesSource( map ); if Dimension( image ) = 0 then # Set the entries explicitly. map!.basisimage := Basis( image ); map!.relations := IdentityMat( Length( mapi[1] ), LeftActingDomain( image ) ); map!.preimagesbasisimage := Immutable( [] ); elif IsGaussianRowSpace( Range( map ) ) then # The preimages of the basis vectors are obtained on # forming the linear combinations of preimages of genimages # given by `ech.coeffs'. ech:= SemiEchelonMatTransformation( mapi[2] ); map!.basisimage := SemiEchelonBasisNC( image, ech.vectors ); map!.relations := Immutable( ech.relations ); map!.preimagesbasisimage := Immutable( ech.coeffs * mapi[1]); else # Delegate the work to the associated row space. B:= Basis( image ); ech:= SemiEchelonMatTransformation( List( mapi[2], x -> Coefficients( B, x ) ) ); map!.basisimage := BasisNC( image, List( ech.vectors, x -> LinearCombination( B, x ) ) ); map!.relations := Immutable( ech.relations ); map!.preimagesbasisimage := Immutable( List( ech.coeffs, row -> LinearCombination( row, mapi[1] ) ) ); fi; end ); InstallMethod( ImagesRepresentative, "for left module g.m.b.i., and element", FamSourceEqFamElm, [ IsGeneralMapping and IsLinearGeneralMappingByImagesDefaultRep, IsObject ], function( map, elm ) if not IsBound( map!.basispreimage ) then MakeImagesInfoLinearGeneralMappingByImages( map ); fi; elm:= Coefficients( map!.basispreimage, elm ); if elm = fail then return fail; elif IsEmpty( elm ) then return Zero( Range( map ) ); fi; return LinearCombination( map!.imagesbasispreimage, elm ); end ); fi; ############################################################################# ## #E