Nitpicky fix for Wigner 3j sign convention #180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While playing with various implementations of the Wigner 3j recurrence, I noticed a small problem with the version used in Namaster: whenever the last coefficient is so small that it underflows to zero, the sign of the returned coefficients may be wrong. As far as I can see, this makes no difference in practice for NaMaster, since only the squares of the coefficients are used, so this is mostly relevant for people wanting to use Namaster's Wigner 3j implementation for other purposes.
Note that the original Fortran implementation also explicitly checks for the sign of the coefficient (see, e.g., https://github.com/fujiisoup/py3nj/blob/bfcd5f466dd88f2d40785999e5a1ed5299a66cef/fortran/drc3jj.f#L412), making use of the fact that IEEE arithmetics distinguishes between +0 and -0.