bug-gsl
[Top][All Lists]

## [Bug-gsl] gsl_sf_coupling_6j still missing triad sum check

 From: Jason Detwiler Subject: [Bug-gsl] gsl_sf_coupling_6j still missing triad sum check Date: Tue, 21 Aug 2012 01:07:47 -0700

```Dear GNU developers,

I just re-encountered a two-year old bug in the calculation of
Wigner's 6-j (and, hence, 9-J) symbols. The original bug report is
here, from v1.13:

https://savannah.gnu.org/bugs/?29606

It is still unfixed in 1.15. The problem is that the routine fails to
check whether the each triad that passes the triangle selection also
have an even sum.I suggest fixing this by changing this block starting
at line 205 of specfunc/coupling.c from:

else if(   triangle_selection_fails(two_ja, two_jb, two_jc)
|| triangle_selection_fails(two_ja, two_je, two_jf)
|| triangle_selection_fails(two_jb, two_jd, two_jf)
|| triangle_selection_fails(two_je, two_jd, two_jc)
) {
result->val = 0.0;
result->err = 0.0;
return GSL_SUCCESS;
}

to:

else if(   triangle_selection_fails(two_ja, two_jb, two_jc)
|| ((two_ja + two_jb + two_jc) % 2)
|| triangle_selection_fails(two_ja, two_je, two_jf)
|| ((two_ja + two_je + two_jf) % 2)
|| triangle_selection_fails(two_jb, two_jd, two_jf)
|| ((two_jb + two_jd + two_jf) % 2)
|| triangle_selection_fails(two_je, two_jd, two_jc)
|| ((two_je + two_jd + two_jc) % 2)
) {
result->val = 0.0;
result->err = 0.0;
return GSL_SUCCESS;
}

Thank you,
Jason Detwiler

```