2D-FFTLog: Efficient computation of real space covariance matrices for
  galaxy clustering and weak lensing
  Accurate covariance matrices for two-point functions are critical for
inferring cosmological parameters in likelihood analyses of large-scale
structure surveys. Among various approaches to obtaining the covariance,
analytic computation is much faster and less noisy than estimation from data or
simulations. However, the transform of covariances from Fourier space to real
space involves integrals with two Bessel integrals, which are numerically slow
and easily affected by numerical uncertainties. Inaccurate covariances may lead
to significant errors in the inference of the cosmological parameters. In this
paper, we introduce a 2D-FFTLog algorithm for efficient, accurate and
numerically stable computation of non-Gaussian real space covariances for both
3D and projected statistics. The 2D-FFTLog algorithm is easily extended to
perform real space bin-averaging. We apply the algorithm to the covariances for
galaxy clustering and weak lensing for a Dark Energy Survey Year 3-like and a
Rubin Observatory's Legacy Survey of Space and Time Year 1-like survey, and
demonstrate that for both surveys, our algorithm can produce numerically stable
angular bin-averaged covariances with the flat sky approximation, which are
sufficiently accurate for inferring cosmological parameters. The code CosmoCov
for computing the real space covariances with or without the flat sky
approximation is released along with this paper.
