Function: algtrace
Section: algebras
C-Name: algtrace
Prototype: DGGD0,L,
Help: algtrace({al},x,{abs=0}): (reduced) trace of x.
Doc: Given an element \var{x} in \var{al} (Hamilton quaternions if omitted),
 computes its trace. If \var{al} is a table algebra output by \tet{algtableinit}
 or if $abs=1$, returns the absolute trace of \var{x}, which is an element of
 $\F_{p}$, $\Q$ or~$\R$; if \var{al} is omitted or the output of \tet{alginit} and
 $abs=0$ (default), returns the reduced trace of \var{x}, which is an element of
 the center of \var{al}.
 \bprog
 ? A = alginit(nfinit(y), [-1,-1]);
 ? algtrace(A,[5,0,0,1]~)
 %2 = 11
 ? algtrace(A,[5,0,0,1]~,1)
 %3 = 22
 ? nf = nfinit(y^2-5);
 ? A = alginit(nf,[-1,y]);
 ? a = [1+x+y,2*y]~*Mod(1,y^2-5)*Mod(1,x^2+1);
 ? t = algtrace(A,a)
 %7 = Mod(2*y + 2, y^2 - 5)
 ? algtrace(A,a,1)
 %8 = 8
 ? algdegree(A)*nfelttrace(nf,t)
 %9 = 8
 ? algtrace(,[1.,2,3,4]~) \\ Hamilton quaternions
 %10 = 2.0000000000
 ? algtrace(,[1.,2,3,4]~,0)
 %11 = 4.0000000000
 @eprog

 Also accepts a square matrix with coefficients in \var{al}.
