  A very common problem in science is the numerical diagonalization of
symmetric or hermitian 3x3 matrices. Since standard "black box" packages may be
too inefficient if the number of matrices is large, we study several
alternatives. We consider optimized implementations of the Jacobi, QL, and
Cuppen algorithms and compare them with an analytical method relying on
Cardano's formula for the eigenvalues and on vector cross products for the
eigenvectors. Jacobi is the most accurate, but also the slowest method, while
QL and Cuppen are good general purpose algorithms. The analytical algorithm
outperforms the others by more than a factor of 2, but becomes inaccurate or
may even fail completely if the matrix entries differ greatly in magnitude.
This can mostly be circumvented by using a hybrid method, which falls back to
QL if conditions are such that the analytical calculation might become too
inaccurate. For all algorithms, we give an overview of the underlying
mathematical ideas, and present detailed benchmark results. C and Fortran
implementations of our code are available for download from
http://www.mpi-hd.mpg.de/~globes/3x3/ .
