  A genuine gauge theory for the Poincar\'e, de Sitter or anti-de Sitter
algebras can be constructed in (2n-1)-dimensional spacetime by means of the
Chern-Simons form, yielding a gravitational theory that differs from General
Relativity but shares many of its properties, such as second order field
equations for the metric. The particular form of the Lagrangian is determined
by a rank n, symmetric tensor invariant under the relevant algebra. In
practice, the calculation of this invariant tensor can be reduced to the
computation of the trace of the symmetrized product of n Dirac Gamma matrices
\Gamma_{ab} in 2n-dimensional spacetime. While straightforward in principle,
this calculation can become extremely cumbersome in practice. For large enough
n, existing computer algebra packages take an inordinate long time to produce
the answer or plainly fail having used up all available memory. In this talk we
show that the general formula for the trace of the symmetrized product of 2n
Gamma matrices \Gamma_{ab} can be written as a certain sum over the integer
partitions s of n, with every term being multiplied by a numerical coefficient
\alpha_{s}. We then give a general algorithm that computes the
\alpha-coefficients as the solution of a linear system of equations generated
by evaluating the general formula for different sets of tensors B^{ab} with
random numerical entries. A recurrence relation between different coefficients
is shown to hold and is used in a second, "minimal" algorithm to greatly speed
up the computations. Runtime of the minimal algorithm stays below 1 min on a
typical desktop computer for up to n=25, which easily covers all foreseeable
applications of the trace formula.
