bilby/gw/likelihood.py: speed up ROQ weight calculation with IFFT
The ROQ weight calculation currently implemented in bilby requires the multiplication of large matrices, which can take minutes for BNS events. It can also requires a lot of memories (O(10)GB) to save the large matrices. I and @rory-smith discussed it, and we found that this calculation can be reduced to IFFT, which speeds up the calculation significantly and requires fewer memories. This patch is to implement that fast ROQ weight calculation.
The detail of the method is described at https://git.ligo.org/soichiro.morisaki/utilities/-/blob/master/fast_roq_weight/note.pdf. The new method was tested at https://git.ligo.org/soichiro.morisaki/utilities/-/blob/master/fast_roq_weight/TestFastROQWeight.ipynb, which shows that the new method speeds up the calculation by a factor of ~20 while its results the same as those from the current implementation.
The fiducial runs with the previous and new implementations of ROQ weight calculation were performed, and the results are here. Plots labeled Matrix*
are from the previous weight calculation, those labeled NumpyIFFT
are from the IFFT implementation without pyfftw
being installed, and those labeled PyfftwIFFT
are with pyfftw
being installed. The three Matrix
runs are to check the convergence of the sampling. The results are almost identical for most of the parameters. There are small differences for psi
and a_2
, but they are in the same level of the differences among MatrixA
, MatrixB
and MatrixC
, which implies they are due to the incomplete convergence of the sampling.