Skip to content

Simplify spin transformation for NR waveforms

This commit eliminates the temporary "helper" timeseries and a corresponding loop over times by noting that each step in that loop is equivalent to multiplying the quantity (hplus - I * hcross) by exp(-2*I*alpha). This can be seen either by explicitly checking the math in the current code or just from the nature of spin-weighted functions. Specifically, this chunk of code is essentially setting

(hplus - I * hcross) = (hplus_corr - I * hcross_corr) * ((calpha*calpha - salpha*salpha) - I * (2.0*calpha*salpha))

where the second factor on the right-hand side is exp(-2*I*alpha). But since alpha is constant and known from the beginning, this multiplication can be done when the values of hplus_corr and hcross_corr are originally being constructed. That, in turn, is done in these lines, which are essentially

(hplus_corr - I * hcross_corr) += (curr_h_real + I * curr_h_imag) * curr_ylm

Therefore, by distributivity and associativity, the multiplication by exp(-2*I*alpha) can be done instead by multiplying curr_ylm when its value is being set. Since that requires just one complex multiplication per (l, m) pair, it is much more efficient — while still consistent with the more precise viewpoint that spin-weighted functions are actually functions on the rotation group, which in this notation means also a function of alpha.

Note that there appears to be some conflict between the code and the LIGO document to which it refers regarding the sign of alpha. This commit just maintains the choice made in the function being altered here, which relies on XLALSimInspiralNRWaveformGetRotationAnglesFromH5File.

Edited by LALSuite Bot

Merge request reports