#
# file: SemidirectProductOfAlgebras.gap
#
# purpose: Semidirect product of Lie algebras
#
# created: Pasha Zusmanovich Jan 6 2005
#
# latest revision history:
# Feb 11 2021 comments
#
# constructs a semidrect product of Lie algebras L and D with action
# f:D -> End(L) (actually, f:D->Der(L), but we formally don't using concept of
# derivations);
# this is a cosmetically modified code by Willem de Graaf,
# message to GAP forum of 24 Nov 1999,
# http://www.gap-system.org/ForumArchive/Graaf.1/Willem.1/Re__Semi.5/1.html
SemidirectProductOfAlgebras := function (L, D, f)
local dlist, d, n, K, T, B, i, j, cf, c, k, td, S;
dlist := List (Basis(D), x -> Image(f,x));
d := Length (dlist);
n := Length (dlist) + Dimension(L);
K := LeftActingDomain (L);
T := EmptySCTable (n, Zero(K), "antisymmetric");
S := StructureConstantsTable (Basis(D));
for i in [1..d] do
for j in [1..d] do
T[i][j] := S[i][j];
od;
od;
td := List (dlist, TransposedMat);
for i in [1..d] do
for j in [1..Dimension(L)] do
cf := td[i][j];
c :=[];
for k in [1..Length(cf)] do
if cf[k] <> 0 then
Add (c, cf[k]);
Add (c, k+d);
fi;
od;
SetEntrySCTable (T, i, j+d, c);
od;
od;
B := Basis(L);
for i in [1..Dimension(L)] do
for j in [i+1..Dimension(L)] do
cf := Coefficients (B, B[i]*B[j]);
c := [];
for k in [1..Length(cf)] do
if cf[k] <> 0 then
Add (c, cf[k]);
Add (c, k+d);
fi;
od;
SetEntrySCTable (T, i+d, j+d, c);
od;
od;
return (LieAlgebraByStructureConstants (K, T));
end;
# eof