Computation of the trace