Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitpicky fix for Wigner 3j sign convention #180

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

mreineck
Copy link
Contributor

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.

@damonge
Copy link
Collaborator

damonge commented Oct 20, 2023

Thanks a lot @mreineck !

Copy link
Collaborator

@damonge damonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@damonge damonge merged commit d9af8b8 into LSSTDESC:master Oct 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants