Yes, this is a duplicate of #29606. Sorry for not finding that.
Attached is a new patch (based on Alexey's suggestion) that now should
apply cleanly to bzr trunk. The previous was against v1.15. It also
includes the tested case in #29606 in test_sf.c.
For completeness, while the case in #29606 is correct (6j to be 0 as
half-integer with integer cannot couple to integer), I think there were
a typo in the report: jc=21 should be jd=22, giving
abs(1-21.5)=20.5 <= 22 <= 22.5.
instead of
abs(1-21.5)=20.5 <= 21 <= 22.5.
Cheers,
Håkan
On Thu, 11 Jul 2013, Patrick Alken wrote:
Follow-up Comment #3, bug #39466 (project gsl):
This may be a repeat of bug #29606
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39466>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
--- trunk/specfunc/coupling.c 2013-07-11 13:52:32.000000000 +0200
+++ gsl-1.15/specfunc/coupling.c 2013-07-12 11:06:35.000000000 +0200
@@ -81,9 +81,11 @@
int
triangle_selection_fails(int two_ja, int two_jb, int two_jc)
{
- return ((two_jb < abs(two_ja - two_jc)) || (two_jb > two_ja + two_jc))
- || ((two_jc < abs(two_jb - two_ja)) || (two_jc > two_jb + two_ja))
- || ((two_ja < abs(two_jc - two_jb)) || (two_ja > two_jc + two_jb));
+ /* Enough to check the triangle condition for one spin vs. the other two. */
+ return (
+ (two_jb < abs(two_ja - two_jc)) || (two_jb > two_ja + two_jc)
+ || GSL_IS_ODD(two_ja + two_jb + two_jc)
+ );
}
--- trunk/specfunc/test_sf.c 2013-07-11 13:52:32.000000000 +0200
+++ gsl-1.15/specfunc/test_sf.c 2013-07-12 10:42:50.000000000 +0200
@@ -424,6 +424,8 @@
TEST_SF(s, gsl_sf_coupling_6j_e, (4, 4, 4, 2, 2, 2, &r), sqrt(7.0/3.0)/10.0, TEST_TOL0, GSL_SUCCESS);
TEST_SF(s, gsl_sf_coupling_6j_e, (6, 6, 6, 4, 4, 4, &r), -sqrt(3.0/5.0)/14.0, TEST_TOL0, GSL_SUCCESS);
TEST_SF(s, gsl_sf_coupling_6j_e, (6, 6, 6, 4, 4, 2, &r), -sqrt(3.0/5.0)/7.0, TEST_TOL0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_6j_e, (1, 0, 1, 0, 1, 0, &r), -sqrt(1.0/2.0), TEST_TOL0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_6j_e, (1, 0, 1, 1, 0, 1, &r), -1.0/2.0, TEST_TOL0, GSL_SUCCESS);
/* Test 6j error checking */
@@ -443,6 +445,13 @@
TEST_SF(s, gsl_sf_coupling_6j_e, (2, 7, 4, 2, 2, 2, &r), 0, 0, GSL_SUCCESS);
TEST_SF(s, gsl_sf_coupling_6j_e, (7, 2, 4, 2, 2, 2, &r), 0, 0, GSL_SUCCESS);
+ /* Test 6j half-integer/integer coupling conditions */
+
+ TEST_SF(s, gsl_sf_coupling_6j_e, (0, 2, 2, 44, 43, 43, &r), 0, 0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_6j_e, (1, 1, 1, 0, 1, 1, &r), 0, 0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_6j_e, (1, 1, 1, 1, 0, 1, &r), 0, 0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_6j_e, (1, 1, 1, 1, 1, 0, &r), 0, 0, GSL_SUCCESS);
+
/* Test 9j */
TEST_SF(s, gsl_sf_coupling_9j_e, (4, 2, 4, 3, 3, 2, 1, 1, 2, &r), -sqrt(1.0/6.0)/10.0, TEST_TOL2, GSL_SUCCESS);
@@ -469,6 +478,11 @@
TEST_SF(s, gsl_sf_coupling_9j_e, (4, 2, 4, 3, 3, 2, 10, 1, 2, &r), 0, 0, GSL_SUCCESS);
TEST_SF(s, gsl_sf_coupling_9j_e, (4, 2, 4, 3, 3, 2, 1, 10, 2, &r), 0, 0, GSL_SUCCESS);
TEST_SF(s, gsl_sf_coupling_9j_e, (4, 2, 4, 3, 3, 2, 1, 1, 10, &r), 0, 0, GSL_SUCCESS);
+
+ /* Test 9j half-integer/integer coupling conditions */
+
+ TEST_SF(s, gsl_sf_coupling_9j_e, (1, 1, 1, 1, 1, 1, 0, 0, 0, &r), 0, 0, GSL_SUCCESS);
+ TEST_SF(s, gsl_sf_coupling_9j_e, (1, 1, 0, 1, 1, 0, 1, 1, 0, &r), 0, 0, GSL_SUCCESS);
return s;
}