> < ^ Date: Fri, 26 Nov 1999 09:14:33 GMT
> < ^ From: Willem de Graaf <degraaf@math.uu.nl >
< ^ Subject: Re: Semidirectproduct

Dear Jan,

Thank you for your comments.

You asked about the derivations which act on the right, and
adjoint matrices which act on the left. I agree with you that
this is rather confusing, so I wrote code for computing the
algebra of derivations, acting on the left. Below I append
the code for `LeftDerivations' (acting on the left), and
`RightDerivations' (the old code, acting on the right.
Both will be in the next release of GAP4.

I hope this helps. If you have further questions, please ask.

Best wishes,

Willem de Graaf

------------------------------------------------------------------------

DeclareAttribute( "RightDerivations", IsBasis );
DeclareAttribute( "LeftDerivations", IsBasis );

#############################################################################
##
#M  RightDerivations( <B> )
##
##  Let $n$ be the dimension of $A$.
##  We start with $n^2$ indeterminates $D = [ d_{i,j} ]_{i,j}$ which
##  means that $D$ maps $b_i$ to $\sum_{j=1}^n d_{ij} b_j$.
##
##  (Note that this is row convention.)
##
##  This leads to the following linear equation system in the $d_{ij}$.
##  $\sum_{k=1}^n ( c_{ijk} d_{km} - c_{kjm} d_{ik} - c_{ikm} d_{jk} ) = 0$
##  for all $1 \leq i, j, m \leq n$.
##  The solution of this system gives us a vector space basis of the
##  algebra of derivations.
##
InstallMethod( RightDerivations,
    "method for a basis of an algebra",
    true,
    [ IsBasis ], 0,
    function( B )
local T,           # structure constants table w.r. to 'B'
      L,           # underlying Lie algebra
      R,           # left acting domain of 'L'
      n,           # dimension of 'L'
      eqno,offset,
      A,
      i, j, k, m,
      M;             # the Lie algebra of derivations

if not IsAlgebra( UnderlyingLeftModule( B ) ) then
Error( "<B> must be a basis of an algebra" );
fi;

if IsLieAlgebra( UnderlyingLeftModule( B ) ) then
offset:= 1;
else
offset:= 0;
fi;

T:= StructureConstantsTable( B );
L:= UnderlyingLeftModule( B );
R:= LeftActingDomain( L );
n:= Dimension( L );

if n = 0 then
  return NullAlgebra( R );
fi;

# The rows in the matrix of the equation system are indexed
# by the $d_{ij}$; the $((i-1) n + j)$-th row belongs to $d_{ij}$.

# Construct the equation system.
if offset = 1 then
  A:= NullMat( n^2, (n-1)*n*n/2, R );
else
  A:= NullMat( n^2, n^3, R );
fi;
eqno:= 0;
for i in [ 1 .. n ] do
  for j in [ offset*i+1 .. n ] do
    for m in [ 1 .. n ] do
      eqno:= eqno+1;
      for k in [ 1 .. n ] do
        A[ (k-1)*n+m ][eqno]:= A[ (k-1)*n+m ][eqno] + 
                                    SCTableEntry( T,i,j,k );
        A[ (i-1)*n+k ][eqno]:= A[ (i-1)*n+k ][eqno] - 
                                    SCTableEntry( T,k,j,m );
        A[ (j-1)*n+k ][eqno]:= A[ (j-1)*n+k ][eqno] - 
                                    SCTableEntry( T,i,k,m );
      od;
    od;
  od;
od;

# Solve the equation system.
# Note that if `L' is a Lie algebra and $n = 1$ the matrix is empty.

if n = 1 and offset = 1 then
  A:= [ [ One( R ) ] ];
else
  A:= NullspaceMat( A );
fi;

# Construct the generating matrices from the vectors.
A:= List( A, v -> List( [ 1 .. n ],
                        i -> v{ [ (i-1)*n + 1 .. i*n ] } ) );

# Construct the Lie algebra.
if IsEmpty( A ) then
  M:= AlgebraByGenerators( R, [],
          LieObject( Immutable( NullMat( n, n, R ) ) ) );
else
  A:= List( A, LieObject );
  M:= AlgebraByGenerators( R, A );
  UseBasis( M, A );
fi;
    # Return the derivations.
    return M;
end );

        
#############################################################################
##
#M  LeftDerivations( <B> )
##
##  Let $n$ be the dimension of $A$.
##  We start with $n^2$ indeterminates $D = [ d_{i,j} ]_{i,j}$ which
##  means that $D$ maps $b_i$ to $\sum_{j=1}^n d_{ji} b_j$.
##
##  (Note that this is column convention.)
##
##
InstallMethod( LeftDerivations,
    "method for a basis of an algebra",
    true,
    [ IsBasis ], 0,
    function( B )
local T,           # structure constants table w.r. to 'B'
      L,           # underlying Lie algebra
      R,           # left acting domain of 'L'
      n,           # dimension of 'L'
      eqno,offset,
      A,
      i, j, k, m,
      M;             # the Lie algebra of derivations

if not IsAlgebra( UnderlyingLeftModule( B ) ) then
Error( "<B> must be a basis of an algebra" );
fi;

if IsLieAlgebra( UnderlyingLeftModule( B ) ) then
offset:= 1;
else
offset:= 0;
fi;

T:= StructureConstantsTable( B );
L:= UnderlyingLeftModule( B );
R:= LeftActingDomain( L );
n:= Dimension( L );

if n = 0 then
  return NullAlgebra( R );
fi;

# The rows in the matrix of the equation system are indexed
# by the $d_{ij}$; the $((i-1) n + j)$-th row belongs to $d_{ij}$.

# Construct the equation system.
if offset = 1 then
  A:= NullMat( n^2, (n-1)*n*n/2, R );
else
  A:= NullMat( n^2, n^3, R );
fi;
eqno:= 0;
for i in [ 1 .. n ] do
  for j in [ offset*i+1 .. n ] do
    for m in [ 1 .. n ] do
      eqno:= eqno+1;
      for k in [ 1 .. n ] do
        A[ (m-1)*n+k ][eqno]:= A[ (m-1)*n+k ][eqno] + 
                                    SCTableEntry( T,i,j,k );
        A[ (k-1)*n+i ][eqno]:= A[ (k-1)*n+i ][eqno] - 
                                    SCTableEntry( T,k,j,m );
        A[ (k-1)*n+j ][eqno]:= A[ (k-1)*n+j ][eqno] - 
                                    SCTableEntry( T,i,k,m );
      od;
    od;
  od;
od;

# Solve the equation system.
# Note that if `L' is a Lie algebra and $n = 1$ the matrix is empty.

if n = 1 and offset = 1 then
  A:= [ [ One( R ) ] ];
else
  A:= NullspaceMat( A );
fi;

# Construct the generating matrices from the vectors.
A:= List( A, v -> List( [ 1 .. n ],
                        i -> v{ [ (i-1)*n + 1 .. i*n ] } ) );

# Construct the Lie algebra.
if IsEmpty( A ) then
  M:= AlgebraByGenerators( R, [],
          LieObject( Immutable( NullMat( n, n, R ) ) ) );
else
  A:= List( A, LieObject );
  M:= AlgebraByGenerators( R, A );
  UseBasis( M, A );
fi;
    # Return the derivations.
    return M;
end );

> < [top]