# Guide to contributing: Code

The code in this section computes the Cartan matrix, the decomposition matrix and the Loewy structure of the projective indecomposable modules. The output is formatted in LaTeX, so it can be copied and pasted easily on the relevant block page.

## Magma code

The following code, written by Claudio Marchi and Cesare G. Ardito, can usually be run on the free Magma online calculator , as long as the involved group is small.

Magma code
```
/* Input data: a group, a prime and an exponent such that GF(p^n) contains all the necessary roots of unity */
G:=SmallGroup(2,1);
p:=2;
splittingexponent:=1;
/* End of input data*/

LoewyStructure:= function(W,p,k,S,irrs)
Z:=W;
t:=0;
maxlength:=100;
M:=ZeroMatrix(Integers(),maxlength,maxlength);
repeat
t:=t+1;
V:=W/J;
V:=ChangeRing(V,GF(p^k));
if IsDecomposable(V) then
indsum:=IndecomposableSummands(V);
for i in [1..#indsum] do
for j in S do
V7:=indsum[i];
U:=irrs[j];
U:=ChangeRing(U,GF(p^k));
V:=ChangeRing(V7,GF(p^k));
if IsIsomorphic(V,U) then
M[t][i]:=j;
continue i;
end if;
end for;
end for;
else
for j in S do
U:=irrs[j];
U:=ChangeRing(U,GF(p^k));
V:=ChangeRing(V,GF(p^k));
if IsIsomorphic(V,U) then
M[t]:=j;
break j;
end if;
end for;
end if;
W:=J;
if IsIrreducible(W) then
t:=t+1;
for j in S do
U:=irrs[j];
U:=ChangeRing(U,GF(p^k));
V:=ChangeRing(W,GF(p^k));
if IsIsomorphic(V,U) then
M[t]:=j;
break j;
end if;
end for;
end if;
until IsIrreducible(W);
printf("\n");
for i in [1..maxlength] do
flag:=0;
for j in [1..maxlength] do
if(not (M[i][j] eq 0)) then
flag:=1;
printf "S_\{%o\} ", M[i][j];
end if;
end for;
if(flag eq 1) then
printf("\\\\ \n");
end if;
end for;
print "The structure above is the Loewy structure of";
return Z;
end function;

PrintLatex:= function(M)
for i in [1..NumberOfRows(M)-1] do
for j in [1..NumberOfColumns(M)-1] do
printf "%o & ", M[i,j];
end for;
printf "%o \\\\ \n", M[i,NumberOfColumns(M)];
end for;
for j in [1..NumberOfColumns(M)-1] do
printf "%o & ", M[NumberOfRows(M),j];
end for;
printf "%o \n", M[NumberOfRows(M),NumberOfColumns(M)];
return " ";
end function;

PrintLatex(AbsoluteCartanMatrix(G,GF(p^splittingexponent)));
printf("\n");
PrintLatex(DecompositionMatrix(G,GF(p^splittingexponent)));
irrs:=AbsolutelyIrreducibleModules(G, GF(p^splittingexponent));
P:=ProjectiveIndecomposableModules(G, GF(p^splittingexponent));
for i in [1..#P] do
LoewyStructure(P[i],p,splittingexponent,[1..#irrs],irrs);
end for;
```

Note that, if [math]G[/math] has more than one block, some manual work on the output is needed to isolate the relevant submatrices and indecomposable projective modules that belong to the block that is being investigated.