Skip to content

Commit

Permalink
apply guards to fix mathieu functions only for GSL 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ktns authored and boutil committed Mar 6, 2016
1 parent 8ee52b3 commit bae49b2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/gsl_native/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,11 @@ def gsl_gem_config(target, dir = 'ext')
end

have_struct_member('gsl_multifit_fdfsolver', 'J', 'gsl/gsl_multifit_nlin.h')
have_func('gsl_sf_mathieu_a_e', 'gsl/gsl_sf_mathieu.h');
have_func('gsl_sf_mathieu_b_e', 'gsl/gsl_sf_mathieu.h');
have_func('gsl_sf_mathieu_ce_e', 'gsl/gsl_sf_mathieu.h');
have_func('gsl_sf_mathieu_se_e', 'gsl/gsl_sf_mathieu.h');
have_func('gsl_sf_mathieu_Mc_e', 'gsl/gsl_sf_mathieu.h');
have_func('gsl_sf_mathieu_Ms_e', 'gsl/gsl_sf_mathieu.h');

create_makefile('gsl_native')
48 changes: 48 additions & 0 deletions ext/gsl_native/sf_mathieu.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,47 +133,79 @@ static VALUE sf_mathieu_eval_e_int2_double2(VALUE n1, VALUE n2, VALUE qq, VALUE
/**********/
static VALUE rb_gsl_sf_mathieu_a_e(VALUE module, VALUE order, VALUE qq)
{
#ifdef HAVE_GSL_SF_MATHIEU_A_E
return rb_gsl_sf_eval_e_int_double(gsl_sf_mathieu_a_e, order, qq);
#else
return rb_gsl_sf_eval_e_int_double(gsl_sf_mathieu_a, order, qq);
#endif
}
static VALUE rb_gsl_sf_mathieu_a(VALUE module, VALUE order, VALUE qq)
{
#ifdef HAVE_GSL_SF_MATHIEU_A_E
return sf_mathieu_eval(order, qq, gsl_sf_mathieu_a_e);
#else
return sf_mathieu_eval(order, qq, gsl_sf_mathieu_a);
#endif
}
static VALUE rb_gsl_sf_mathieu_a_array(VALUE module, int argc, VALUE *argv)
{
return sf_mathieu_array_eval(argc, argv, gsl_sf_mathieu_a_array);
}
static VALUE rb_gsl_sf_mathieu_b_e(VALUE module, VALUE order, VALUE qq)
{
#ifdef HAVE_GSL_SF_MATHIEU_B_E
return rb_gsl_sf_eval_e_int_double(gsl_sf_mathieu_b_e, order, qq);
#else
return rb_gsl_sf_eval_e_int_double(gsl_sf_mathieu_b, order, qq);
#endif
}
static VALUE rb_gsl_sf_mathieu_b(VALUE module, VALUE order, VALUE qq)
{
#ifdef HAVE_GSL_SF_MATHIEU_B_E
return sf_mathieu_eval(order, qq, gsl_sf_mathieu_b_e);
#else
return sf_mathieu_eval(order, qq, gsl_sf_mathieu_b);
#endif
}
static VALUE rb_gsl_sf_mathieu_b_array(VALUE module, int argc, VALUE *argv)
{
return sf_mathieu_array_eval(argc, argv, gsl_sf_mathieu_b_array);
}
static VALUE rb_gsl_sf_mathieu_ce_e(VALUE module, VALUE order, VALUE qq, VALUE zz)
{
#ifdef HAVE_GSL_SF_MATHIEU_CE_E
return sf_mathieu_eval_e_int_double2(order, qq, zz, gsl_sf_mathieu_ce_e);
#else
return sf_mathieu_eval_e_int_double2(order, qq, zz, gsl_sf_mathieu_ce);
#endif
}
static VALUE rb_gsl_sf_mathieu_ce(VALUE module, VALUE order, VALUE qq, VALUE zz)
{
#ifdef HAVE_GSL_SF_MATHIEU_CE_E
return sf_mathieu_eval_int_double2(order, qq, zz, gsl_sf_mathieu_ce_e);
#else
return sf_mathieu_eval_int_double2(order, qq, zz, gsl_sf_mathieu_ce);
#endif
}
static VALUE rb_gsl_sf_mathieu_ce_array(VALUE module, int argc, VALUE *argv)
{
return sf_mathieu_array_eval2(argc, argv, gsl_sf_mathieu_ce_array);
}
static VALUE rb_gsl_sf_mathieu_se_e(VALUE module, VALUE order, VALUE qq, VALUE zz)
{
#ifdef HAVE_GSL_SF_MATHIEU_SE_E
return sf_mathieu_eval_e_int_double2(order, qq, zz, gsl_sf_mathieu_se_e);
#else
return sf_mathieu_eval_e_int_double2(order, qq, zz, gsl_sf_mathieu_se);
#endif
}
static VALUE rb_gsl_sf_mathieu_se(VALUE module, VALUE order, VALUE qq, VALUE zz)
{
#ifdef HAVE_GSL_SF_MATHIEU_SE_E
return sf_mathieu_eval_int_double2(order, qq, zz, gsl_sf_mathieu_se_e);
#else
return sf_mathieu_eval_int_double2(order, qq, zz, gsl_sf_mathieu_se);
#endif
}
static VALUE rb_gsl_sf_mathieu_se_array(VALUE module, int argc, VALUE *argv)
{
Expand All @@ -183,23 +215,39 @@ static VALUE rb_gsl_sf_mathieu_se_array(VALUE module, int argc, VALUE *argv)
/*****/
static VALUE rb_gsl_sf_mathieu_Mc_e(VALUE module, VALUE n1, VALUE n2, VALUE q, VALUE x)
{
#ifdef HAVE_GSL_SF_MATHIEU_MC_E
return sf_mathieu_eval_e_int2_double2(n1, n2, q, x, gsl_sf_mathieu_Mc_e);
#else
return sf_mathieu_eval_e_int2_double2(n1, n2, q, x, gsl_sf_mathieu_Mc);
#endif
}
static VALUE rb_gsl_sf_mathieu_Mc(VALUE module, VALUE n1, VALUE n2, VALUE q, VALUE x)
{
#ifdef HAVE_GSL_SF_MATHIEU_MC_E
return sf_mathieu_eval2(n1, n2, q, x, gsl_sf_mathieu_Mc_e);
#else
return sf_mathieu_eval2(n1, n2, q, x, gsl_sf_mathieu_Mc);
#endif
}
static VALUE rb_gsl_sf_mathieu_Mc_array(VALUE module, int argc, VALUE *argv)
{
return sf_mathieu_array_eval3(argc, argv, gsl_sf_mathieu_Mc_array);
}
static VALUE rb_gsl_sf_mathieu_Ms_e(VALUE module, VALUE n1, VALUE n2, VALUE q, VALUE x)
{
#ifdef HAVE_GSL_SF_MATHIEU_MS_E
return sf_mathieu_eval_e_int2_double2(n1, n2, q, x, gsl_sf_mathieu_Ms_e);
#else
return sf_mathieu_eval_e_int2_double2(n1, n2, q, x, gsl_sf_mathieu_Ms);
#endif
}
static VALUE rb_gsl_sf_mathieu_Ms(VALUE module, VALUE n1, VALUE n2, VALUE q, VALUE x)
{
#ifdef HAVE_GSL_SF_MATHIEU_MS_E
return sf_mathieu_eval2(n1, n2, q, x, gsl_sf_mathieu_Ms_e);
#else
return sf_mathieu_eval2(n1, n2, q, x, gsl_sf_mathieu_Ms);
#endif
}
static VALUE rb_gsl_sf_mathieu_Ms_array(VALUE module, int argc, VALUE *argv)
{
Expand Down

0 comments on commit bae49b2

Please sign in to comment.