double gsl_sf_coupling_6j(int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf) { EVAL_RESULT(gsl_sf_coupling_6j_e(two_ja, two_jb, two_jc, two_jd, two_je, two_jf, &result)); }
int gsl_sf_coupling_6j_INCORRECT_e(int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf, gsl_sf_result * result) { return gsl_sf_coupling_6j_e(two_ja, two_jb, two_je, two_jd, two_jc, two_jf, result); }
int gsl_sf_coupling_RacahW_e(int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf, gsl_sf_result * result) { int status = gsl_sf_coupling_6j_e(two_ja, two_jb, two_je, two_jd, two_jc, two_jf, result); int phase_sum = (two_ja + two_jb + two_jc + two_jd)/2; result->val *= ( GSL_IS_ODD(phase_sum) ? -1.0 : 1.0 ); return status; }
static VALUE rb_gsl_sf_coupling_6j_e(VALUE obj, VALUE two_ja, VALUE two_jb, VALUE two_jc, VALUE two_jd, VALUE two_je, VALUE two_jf) { gsl_sf_result *rslt = NULL; VALUE v; // local variable "status" declared and set, but never used //int status; CHECK_FIXNUM(two_ja); CHECK_FIXNUM(two_jb); CHECK_FIXNUM(two_jc); CHECK_FIXNUM(two_jd); CHECK_FIXNUM(two_je); CHECK_FIXNUM(two_jf); v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt); /*status =*/ gsl_sf_coupling_6j_e(FIX2INT(two_ja), FIX2INT(two_jb), FIX2INT(two_jc), FIX2INT(two_jd), FIX2INT(two_je), FIX2INT(two_jf), rslt); return v; }
int gsl_sf_coupling_9j_e(int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf, int two_jg, int two_jh, int two_ji, gsl_sf_result * result) { /* CHECK_POINTER(result) */ if( two_ja < 0 || two_jb < 0 || two_jc < 0 || two_jd < 0 || two_je < 0 || two_jf < 0 || two_jg < 0 || two_jh < 0 || two_ji < 0 ) { DOMAIN_ERROR(result); } else if( triangle_selection_fails(two_ja, two_jb, two_jc) || triangle_selection_fails(two_jd, two_je, two_jf) || triangle_selection_fails(two_jg, two_jh, two_ji) || triangle_selection_fails(two_ja, two_jd, two_jg) || triangle_selection_fails(two_jb, two_je, two_jh) || triangle_selection_fails(two_jc, two_jf, two_ji) ) { result->val = 0.0; result->err = 0.0; return GSL_SUCCESS; } else { int tk; int tkmin = locMax3(abs(two_ja-two_ji), abs(two_jh-two_jd), abs(two_jb-two_jf)); int tkmax = locMin3(two_ja + two_ji, two_jh + two_jd, two_jb + two_jf); double sum_pos = 0.0; double sum_neg = 0.0; double sumsq_err = 0.0; double phase; for(tk=tkmin; tk<=tkmax; tk += 2) { gsl_sf_result s1, s2, s3; double term; double term_err; int status = 0; status += gsl_sf_coupling_6j_e(two_ja, two_ji, tk, two_jh, two_jd, two_jg, &s1); status += gsl_sf_coupling_6j_e(two_jb, two_jf, tk, two_jd, two_jh, two_je, &s2); status += gsl_sf_coupling_6j_e(two_ja, two_ji, tk, two_jf, two_jb, two_jc, &s3); if(status != GSL_SUCCESS) { OVERFLOW_ERROR(result); } term = s1.val * s2.val * s3.val; term_err = s1.err * fabs(s2.val*s3.val); term_err += s2.err * fabs(s1.val*s3.val); term_err += s3.err * fabs(s1.val*s2.val); if(term >= 0.0) { sum_pos += (tk + 1) * term; } else { sum_neg -= (tk + 1) * term; } sumsq_err += ((tk+1) * term_err) * ((tk+1) * term_err); } phase = GSL_IS_ODD(tkmin) ? -1.0 : 1.0; result->val = phase * (sum_pos - sum_neg); result->err = 2.0 * GSL_DBL_EPSILON * (sum_pos + sum_neg); result->err += sqrt(sumsq_err / (0.5*(tkmax-tkmin)+1.0)); result->err += 2.0 * GSL_DBL_EPSILON * (tkmax-tkmin + 2.0) * fabs(result->val); return GSL_SUCCESS; } }
/** * C++ version of gsl_sf_coupling_6j_e(). * @param two_ja Coupling coefficient in half-integer units * @param two_jb Coupling coefficient in half-integer units * @param two_jc Coupling coefficient in half-integer units * @param two_jd Coupling coefficient in half-integer units * @param two_je Coupling coefficient in half-integer units * @param two_jf Coupling coefficient in half-integer units * @param result Coupling coefficient in half-integer units * @return GSL_SUCCESS or GSL_EDOM or GSL_EOVERFLW */ inline int coupling_6j_e( int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf, result& result ){ return gsl_sf_coupling_6j_e( two_ja, two_jb, two_jc, two_jd, two_je, two_jf, &result ); }