[GAP Forum] MatrixOfAction
quagroup
quagroup at hetnet.nl
Sat May 15 01:42:06 BST 2004
Dear Jan,
Thanks for your report.
What you reported was indeed a bug, which will be fixed in the
next bugfix. Temporarily you can fix it in your own copy of GAP
by loading the code below.
If you have any questions, please ask.
Best wishes,
Willem de Graaf
############################################################################
##
#M DirectSumOfAlgebraModules( <list> )
#M DirectSumOfAlgebraModules( <V>, <W> )
##
InstallMethod( DirectSumOfAlgebraModules,
"for a list of algebra modules",
true, [ IsDenseList ], 0,
function( list )
local left_action, right_action, F, fam, type, niceVF,
gens, zero, i, gV, v, be, A, B, V, W, niceMod,
BW;
# There are two types of action on a direct sum: left and right.
left_action:= function( x, tn )
return ObjByExtRep( FamilyObj( tn ),
List( ShallowCopy( ExtRepOfObj( tn ) ), u -> x^u ) );
end;
right_action:= function( tn, x )
return ObjByExtRep( FamilyObj( tn ),
List( ShallowCopy( ExtRepOfObj( tn ) ), u -> u^x ) );
end;
# We first make the family of the direct sum elements, and construct
# a basis of the direct sum. Note that if the arguments do not
# know how to compute bases, then the rewriting of direct sum elements
# to normal
# forms will fail. Hence we can assume that every module has a basis,
# and therefore we have a basis of the direct sum as well.
F:= LeftActingDomain( list[1] );
fam:= NewFamily( "DirectSumElementsFam", IsDirectSumElement );
type:= NewType( fam, IsPackedElementDefaultRep );
fam!.directSumElementDefaultType:= type;
fam!.zeroCoefficient:= Zero( F );
fam!.constituentModules:= list;
niceMod:= FullSparseRowSpace( F, Sum( List( list, Dimension ) ) );
niceVF:= ElementsFamily( FamilyObj( niceMod ) );
fam!.niceVectorFam:= niceVF;
gens:= [ ];
zero:= List( list, x -> Zero( x ) );
for i in [1..Length(list)] do
gV:= Basis( list[i] );
for v in gV do
be:= ShallowCopy( zero );
be[i]:= v;
Add( gens, be );
od;
od;
if gens = [ ] then
gens:= [ zero ];
fi;
gens:= List( gens, x -> ObjByExtRep( fam, x ) );
for i in [1..Length(gens)] do
gens[i]![2]:= true;
od;
# Now we make the direct sum, we need to consider a few cases...
if IsLeftAlgebraModuleElementCollection( list[1] ) then
if IsRightAlgebraModuleElementCollection( list[1] ) then
if not ForAll( list, V ->
IsLeftAlgebraModuleElementCollection(V) and
IsRightAlgebraModuleElementCollection(V)) then
Error("for all modules the algebra must act om the same side");
fi;
A:= LeftActingAlgebra( list[1] );
B:= RightActingAlgebra( list[1] );
if not ForAll( list, V ->
IsIdenticalObj( LeftActingAlgebra(V), A ) and
IsIdenticalObj( RightActingAlgebra(V), B ) )
then Error("all modules must have the same left acting algebra" );
fi;
V:= BiAlgebraModuleByGenerators( A, B, left_action, right_action,
gens );
fi;
if not ForAll( list, IsLeftAlgebraModuleElementCollection ) then
Error( "for all modules the algebra must act om the same side" );
fi;
A:= LeftActingAlgebra( list[1] );
if not ForAll( list, V -> IsIdenticalObj( LeftActingAlgebra(V), A ) )
then Error( "all modules must have the same left acting algebra" );
fi;
V:= LeftAlgebraModuleByGenerators( A, left_action, gens );
else
if not ForAll( list, IsRightAlgebraModuleElementCollection ) then
Error( "for all modules the algebra must act om the same side" );
fi;
A:= RightActingAlgebra( list[1] );
if not ForAll( list, V -> IsIdenticalObj( RightActingAlgebra(V), A ) )
then Error( "all modules must have the same left acting algebra" );
fi;
V:= RightAlgebraModuleByGenerators( A, right_action, gens );
fi;
if IsZero( gens[1] ) then
return V;
fi;
# We construct a basis `B' of the direct sum.
# This is a basis of an algebra module, so it works via a delegate
# basis, which is a basis of the module spanned by the elements `gens'.
# We call this module `W', and `BW' will be a basis of `W'.
# Now `W' works via a nice basis and we know the basis vectors of this
# nice basis (namely all unit vectors). So we set the attribute `NiceBasis'
# of `BW' to be the standard basis of the full row space.
W:= VectorSpace( F, gens, "basis" );
SetNiceFreeLeftModule( W, niceMod );
B:= Objectify( NewType( FamilyObj( V ), IsFiniteBasisDefault and
IsBasisOfAlgebraModuleElementSpace and
IsAttributeStoringRep ), rec() );
SetUnderlyingLeftModule( B, V );
SetBasisVectors( B, GeneratorsOfAlgebraModule(V) );
BW:= Objectify( NewType( FamilyObj( W ), IsBasisByNiceBasis and
IsAttributeStoringRep ), rec() );
SetUnderlyingLeftModule( BW, W );
SetBasisVectors( BW, gens );
SetNiceBasis( BW, Basis( niceMod ) );
B!.delegateBasis:= BW;
SetBasis( V, B );
SetDimension( V, Length( gens ) );
return V;
end );
More information about the Forum
mailing list