GNU Scientific Library - Bugs: bug #43256, gsl_sf_coupling_6j overflows
You are not allowed to post comments on this tracker with your current authentication level.
bug #43256: gsl_sf_coupling_6j overflows
Submitter: | Anders Søndergaard <andersas> | ||
Submitted: | Fri 19 Sep 2014 12:45:52 PM UTC | ||
Category: | Runtime error | Severity: | 3 - Normal |
Operating System: | Ubuntu linux | Status: | None |
Assigned to: | None | Open/Closed: | Open |
Release: | 1.16 (ubuntu latest) |
Mon 22 Sep 2014 11:54:15 AM UTC, comment #2: |
Anders Søndergaard <andersas> |
Mon 22 Sep 2014 11:52:56 AM UTC, comment #1: I implemented the suggested changes of working with the logarithm of the factorials instead of the factorials themselves.
This seems to work fine.
I still need to work out the error calculation and to verify that the changes actually work (by e.g. comparing with sympy).
Also, perhaps it is faster not to work with the logarithm for small j. Who knows? Maybe the sixj function should
You can have the code that works so far here:
In the specfunc/coupling.c file I changed the delta function to read:
static
And the gsl_sf_coupling_6j_e function:
int
if( two_ja < 0 || two_jb < 0 || two_jc < 0
tkmin = locMax3(0,
tkmax = locMin5(two_ja + two_jb + two_je + two_jd + 2,
phase = GSL_IS_ODD((two_ja + two_jb + two_je + two_jd + tkmin)/2)
for(tk=tkmin; tk<=tkmax; tk += 2) {
status += gsl_sf_lnfact_e((two_ja + two_jb + two_je + two_jd - tk)/2 + 1, &n1);
if(status != GSL_SUCCESS) {
d1.val = d1_a.val + d1_b.val;
den_1.val = d1.val+d2.val+d3.val;
den_2.val = d4.val+d5.val+d6.val;
term = n1.val - den_1.val - den_2.val;
if(phase >= 0.0) {
phase = -phase;
result->val = sum_pos - sum_neg;
return GSL_SUCCESS;
|
Anders Søndergaard <andersas> |
Fri 19 Sep 2014 12:45:52 PM UTC, original submission:
I need to calculate 6-j symbols for somewhat large J.
(14, 16, 16
but this fails because gsl_sf_fact overflows.
I have looked a bit at the code, and I think in these large
Other libraries I have tested also gets these symbols wrong (but silently returns the wrong value),
I would rather not interface my Fortran program with Python.
|
Anders Søndergaard <andersas> |
Depends on the following items: None found
Items that depend on this one: None found
Follows 1 latest change.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2014-09-22 | andersas | Attached File | - | ![]() |
Added sixjsymbols.c, #32162 |
Added a file containing the added and modified function because
the markup failed in my previous comment.
Anders
(file #32162)