  Permutation tests are among the simplest and most widely used statistical
tools. Their p-values can be computed by a straightforward sampling of
permutations. However, this way of computing p-values is often so slow that it
is replaced by an approximation, which is accurate only for part of the
interesting range of parameters. Moreover, the accuracy of the approximation
can usually not be improved by increasing the computation time.
  We introduce a new sampling-based algorithm which uses the fast Fourier
transform to compute p-values for the permutation test based on Pearson's
correlation coefficient. The algorithm is practically and asymptotically faster
than straightforward sampling. Typically, its complexity is logarithmic in the
input size, while the complexity of straightforward sampling is linear. The
idea behind the algorithm can also be used to accelerate the computation of
p-values for many other common statistical tests. The algorithm is easy to
implement, but its analysis involves results from the representation theory of
the symmetric group.
