Skip to content

Commit

Permalink
updated config files so can read gsl version 1.xx/2.xx
Browse files Browse the repository at this point in the history
  • Loading branch information
hmb1 committed Nov 8, 2015
1 parent 08559da commit 4d2ef53
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 33 deletions.
6 changes: 6 additions & 0 deletions config.h.in
Expand Up @@ -421,6 +421,12 @@
/* GSL minor version number */
#undef NCO_GSL_MINOR_VERSION

/* GSL MAJOR version number */
#undef NCO_GSL_MAJOR_VERSION

/* this is -100*GSL_MAJOR+ GSL_MINOR */
#undef NCO_GSL_VERSION

/* POSIX extended regular expressions available */
#undef NCO_HAVE_REGEX_FUNCTIONALITY

Expand Down
12 changes: 9 additions & 3 deletions configure.ac
Expand Up @@ -651,13 +651,19 @@ if test "${enable_gsl}" != 'no'; then
elif test "${enable_gsl}" = 'yes'; then
# Assumes GSL version in form 1.[0-9]+ extract minor version only
GSL_VER="`${GSL_CONFIG} --version`"
GSL_VER=`echo "${GSL_VER}" | sed -e 's/^1\.//'`
GSL_MAJOR="`echo "${GSL_VER}" | cut -d '.' -f 1`"
GSL_MINOR="`echo "${GSL_VER}" | cut -d '.' -f 2`"
GSL_VER=`expr $GSL_MAJOR \* 100 + $GSL_MINOR`
if test "x${GSL_VER}" = 'x'; then
# 20100115: Fix for machines like bluefire that lack gsl-config
GSL_VER='4'
GSL_VER='104'
GSL_MAJOR='1'
GSL_MINOR='4'
fi
AC_DEFINE(ENABLE_GSL,1,Compile operators with GSL support)
AC_DEFINE_UNQUOTED(NCO_GSL_MINOR_VERSION,${GSL_VER},GSL minor version number)
AC_DEFINE_UNQUOTED(NCO_GSL_MINOR_VERSION,${GSL_MINOR},GSL minor version number)
AC_DEFINE_UNQUOTED(NCO_GSL_MAJOR_VERSION,${GSL_MAJOR},GSL major version number)
AC_DEFINE_UNQUOTED(NCO_GSL_VERSION,${GSL_VER},GSL version number)
AC_MSG_NOTICE([GSL support enabled])
fi
fi
Expand Down
18 changes: 11 additions & 7 deletions data/gsl_sf.in
Expand Up @@ -200,28 +200,32 @@ nbr_err_ttl=0;

// d2,d3 identical
d2=gsl_sf_legendre_Plm(time.int()-1,0,0.7);
d3=time;
gsl_sf_legendre_Plm_array(9,0,0.7,&d3);


// not in gsl 2.0
//gsl_sf_legendre_Plm_array(9,0,0.7,&d3);

// d4,d5 identical
d4=gsl_sf_legendre_sphPlm(leg,0,0.7);
d5=leg.double();
gsl_sf_legendre_sphPlm_array(3,0,0.7,&d5);


// not in gsl 2.0
// gsl_sf_legendre_sphPlm_array(3,0,0.7,&d5);


if( fabs(d0.total()-d1.total() ) >0.01){
print("ERROR: d0:Legendre functions\n");
nbr_err++;
}


if( fabs(d2.total()-d3.total() ) >0.01){
if( fabs(d2.total()- 1.56887 ) >0.01){
print("ERROR: d2:Legendre functions\n");
nbr_err++;
}


if( fabs(d4.avg()-d5.avg() ) >0.01){
if( fabs(d4.ttl()- 0.628677 ) >0.01){
print("ERROR: d4:Legendre functions\n");
nbr_err++;
}
Expand Down
8 changes: 8 additions & 0 deletions doc/ChangeLog
@@ -1,3 +1,11 @@
2015-11-08 Henry Butowsky <henryb@hush.com>

* Added config support for gsl library 2.xx
mods to configure.ac, config.h.in
#deined NCO_GSL_VERSION = 100 * NCO_GSL_MAJOR_VERSION + NCO_GSL_MINOR_VERSION

* downstream mods to fmc_gsl_cls.cc, fmc_gsl_cls.hh

2015-10-30 Charlie Zender <zender@uci.edu>

* Add stdin infrastructure for passing regridding file list
Expand Down
51 changes: 31 additions & 20 deletions src/nco++/fmc_gsl_cls.cc
Expand Up @@ -117,10 +117,10 @@ void gsl_cls::gsl_ini_sf(void) {
gpr_vtr.push_back(gpr_cls("gsl_sf_debye_3",f_unn(gsl_sf_debye_3_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_debye_4",f_unn(gsl_sf_debye_4_e),hnd_fnc_x,NC_DOUBLE));

# if NCO_GSL_MINOR_VERSION >= 8
# if NCO_GSL_VERSION >= 108
gpr_vtr.push_back(gpr_cls("gsl_sf_debye_5",f_unn(gsl_sf_debye_5_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_debye_6",f_unn(gsl_sf_debye_6_e),hnd_fnc_x,NC_DOUBLE));
# endif // NCO_GSL_MINOR_VERSION < 8
# endif // NCO_GSL_VERSION < 8

// Dilogarithm
// not implemented as all involve complex numbers
Expand All @@ -131,10 +131,10 @@ void gsl_cls::gsl_ini_sf(void) {
gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_Kcomp",f_unn(gsl_sf_ellint_Kcomp_e),hnd_fnc_nd,P1DBLMD));
gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_Ecomp",f_unn(gsl_sf_ellint_Ecomp_e),hnd_fnc_nd,P1DBLMD));

# if NCO_GSL_MINOR_VERSION >= 9
# if NCO_GSL_VERSION >= 109
gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_Pcomp",f_unn(gsl_sf_ellint_Pcomp_e),hnd_fnc_nd,P2DBLMD));
gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_Dcomp",f_unn(gsl_sf_ellint_Dcomp_e),hnd_fnc_nd,P1DBLMD));
# endif // NCO_GSL_MINOR_VERSION < 9
# endif // NCO_GSL_VERSION < 9

gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_F",f_unn(gsl_sf_ellint_F_e),hnd_fnc_nd,P2DBLMD));
gpr_vtr.push_back(gpr_cls("gsl_sf_ellint_E",f_unn(gsl_sf_ellint_E_e),hnd_fnc_nd,P2DBLMD));
Expand Down Expand Up @@ -178,10 +178,10 @@ void gsl_cls::gsl_ini_sf(void) {
gpr_vtr.push_back(gpr_cls("gsl_sf_expint_E1_scaled",f_unn(gsl_sf_expint_E1_scaled_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_expint_E2_scaled",f_unn(gsl_sf_expint_E2_scaled_e),hnd_fnc_x,NC_DOUBLE));

# if NCO_GSL_MINOR_VERSION >= 10
# if NCO_GSL_VERSION >= 110
gpr_vtr.push_back(gpr_cls("gsl_sf_expint_En",f_unn(gsl_sf_expint_En_e),hnd_fnc_xd,NC_INT));
gpr_vtr.push_back(gpr_cls("gsl_sf_expint_En_scaled",f_unn(gsl_sf_expint_En_scaled_e),hnd_fnc_xd,NC_INT));
# endif // NCO_GSL_MINOR_VERSION < 10
# endif // NCO_GSL_VERSION < 10

gpr_vtr.push_back(gpr_cls("gsl_sf_expint_Ei",f_unn(gsl_sf_expint_Ei_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_expint_Ei_scaled",f_unn(gsl_sf_expint_Ei_scaled_e),hnd_fnc_x,NC_DOUBLE));
Expand Down Expand Up @@ -271,10 +271,17 @@ void gsl_cls::gsl_ini_sf(void) {
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_Q1",f_unn(gsl_sf_legendre_Q1_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_Ql",f_unn(gsl_sf_legendre_Ql_e),hnd_fnc_xd,NC_INT));
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_Plm",f_unn(gsl_sf_legendre_Plm_e),hnd_fnc_iid));

#if NCO_GSL_VERSION < 200
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_Plm_array",f_unn(gsl_sf_legendre_Plm_array),hnd_fnc_iidpd,PLEGEND));
#endif
// gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_Plm_deriv_array",f_unn(gsl_sf_legendre_Plm_deriv_array),));
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_sphPlm",f_unn(gsl_sf_legendre_sphPlm_e),hnd_fnc_iid));

#if NCO_GSL_VERSION < 200
gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_sphPlm_array",f_unn(gsl_sf_legendre_sphPlm_array),hnd_fnc_iidpd,PLEGEND));
#endif

// gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_sphPlm_deriv_array",f_unn(gsl_sf_legendre_sphPlm_deriv_array),));
// gpr_vtr.push_back(gpr_cls("gsl_sf_legendre_array_size",f_unn(gsl_sf_legendre_array_size),));
gpr_vtr.push_back(gpr_cls("gsl_sf_conicalP_half",f_unn(gsl_sf_conicalP_half_e),hnd_fnc_nd,P2DBL));
Expand Down Expand Up @@ -309,9 +316,9 @@ void gsl_cls::gsl_ini_sf(void) {
// gpr_vtr.push_back(gpr_cls("gsl_sf_complex_psi",f_unn(gsl_sf_complex_psi_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_psi_1_int",f_unn(gsl_sf_psi_1_int_e),hnd_fnc_x,NC_INT));

# if NCO_GSL_MINOR_VERSION >= 5
# if NCO_GSL_VERSION >= 105
gpr_vtr.push_back(gpr_cls("gsl_sf_psi_1",f_unn(gsl_sf_psi_1_e),hnd_fnc_x,NC_DOUBLE));
# endif // NCO_GSL_MINOR_VERSION < 5
# endif // NCO_GSL_VERSION < 105

gpr_vtr.push_back(gpr_cls("gsl_sf_psi_n",f_unn(gsl_sf_psi_n_e),hnd_fnc_xd,NC_INT));

Expand All @@ -332,10 +339,10 @@ void gsl_cls::gsl_ini_sf(void) {
gpr_vtr.push_back(gpr_cls("gsl_sf_zeta_int",f_unn(gsl_sf_zeta_int_e),hnd_fnc_x,NC_INT));
gpr_vtr.push_back(gpr_cls("gsl_sf_zeta",f_unn(gsl_sf_zeta_e),hnd_fnc_x,NC_DOUBLE));

# if NCO_GSL_MINOR_VERSION >= 5
# if NCO_GSL_VERSION >= 105
gpr_vtr.push_back(gpr_cls("gsl_sf_zetam1",f_unn(gsl_sf_zetam1_e),hnd_fnc_x,NC_DOUBLE));
gpr_vtr.push_back(gpr_cls("gsl_sf_zetam1_int",f_unn(gsl_sf_zetam1_int_e),hnd_fnc_x,NC_INT));
# endif // NCO_GSL_MINOR_VERSION < 5
# endif // NCO_GSL_VERSION < 105

gpr_vtr.push_back(gpr_cls("gsl_sf_hzeta",f_unn(gsl_sf_hzeta_e),hnd_fnc_nd,P2DBL));
gpr_vtr.push_back(gpr_cls("gsl_sf_eta_int",f_unn(gsl_sf_eta_int_e),hnd_fnc_x,NC_INT));
Expand Down Expand Up @@ -386,7 +393,7 @@ void gsl_cls::gsl_ini_cdf(void){
gpr_vtr.push_back(gpr_cls("gsl_cdf_exponential_Q",f_unn(gsl_cdf_exponential_Q),hnd_fnc_nd,P2DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_exponential_Pinv",f_unn(gsl_cdf_exponential_Pinv),hnd_fnc_nd,P2DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_exponential_Qinv",f_unn(gsl_cdf_exponential_Qinv),hnd_fnc_nd,P2DBLX));
# if NCO_GSL_MINOR_VERSION >= 6
# if NCO_GSL_VERSION >= 106
gpr_vtr.push_back(gpr_cls("gsl_cdf_exppow_P",f_unn(gsl_cdf_exppow_P),hnd_fnc_nd,P3DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_exppow_Q",f_unn(gsl_cdf_exppow_Q),hnd_fnc_nd,P3DBLX));
# endif
Expand All @@ -397,10 +404,10 @@ void gsl_cls::gsl_ini_cdf(void){

gpr_vtr.push_back(gpr_cls("gsl_cdf_fdist_P",f_unn(gsl_cdf_fdist_P),hnd_fnc_nd,P3DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_fdist_Q",f_unn(gsl_cdf_fdist_Q),hnd_fnc_nd,P3DBLX));
# if NCO_GSL_MINOR_VERSION >= 8
# if NCO_GSL_VERSION >= 108
gpr_vtr.push_back(gpr_cls("gsl_cdf_fdist_Pinv",f_unn(gsl_cdf_fdist_Pinv),hnd_fnc_nd,P3DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_fdist_Qinv",f_unn(gsl_cdf_fdist_Qinv),hnd_fnc_nd,P3DBLX));
# endif // NCO_GSL_MINOR_VERSION < 8
# endif // NCO_GSL_VERSION < 8

gpr_vtr.push_back(gpr_cls("gsl_cdf_beta_P",f_unn(gsl_cdf_beta_P),hnd_fnc_nd,P3DBLX));
gpr_vtr.push_back(gpr_cls("gsl_cdf_beta_Q",f_unn(gsl_cdf_beta_Q),hnd_fnc_nd,P3DBLX));
Expand Down Expand Up @@ -474,7 +481,7 @@ void gsl_cls::gsl_ini_ran(void){
gpr_vtr.push_back(gpr_cls("gsl_ran_beta_pdf",f_unn(gsl_ran_beta_pdf),hnd_fnc_nd,P3DBLX));

gpr_vtr.push_back(gpr_cls("gsl_ran_binomial",f_unn(gsl_ran_binomial),hnd_fnc_udrdu));
# if NCO_GSL_MINOR_VERSION >= 7
# if NCO_GSL_VERSION >= 107
gpr_vtr.push_back(gpr_cls("gsl_ran_binomial_knuth",f_unn(gsl_ran_binomial_knuth),hnd_fnc_udrdu));
# endif
gpr_vtr.push_back(gpr_cls("gsl_ran_binomial_tpe",f_unn(gsl_ran_binomial_tpe),hnd_fnc_udrdu));
Expand Down Expand Up @@ -508,16 +515,18 @@ void gsl_cls::gsl_ini_ran(void){
gpr_vtr.push_back(gpr_cls("gsl_ran_gamma",f_unn(gsl_ran_gamma),hnd_fnc_rnd,P2DBLX));
gpr_vtr.push_back(gpr_cls("gsl_ran_gamma_int",f_unn(gsl_ran_gamma_int),hnd_fnc_ru));
gpr_vtr.push_back(gpr_cls("gsl_ran_gamma_pdf",f_unn(gsl_ran_gamma_pdf),hnd_fnc_nd,P3DBLX));
# if NCO_GSL_MINOR_VERSION >= 8
# if NCO_GSL_VERSION >= 108
gpr_vtr.push_back(gpr_cls("gsl_ran_gamma_mt",f_unn(gsl_ran_gamma_mt),hnd_fnc_rnd,P2DBLX));
gpr_vtr.push_back(gpr_cls("gsl_ran_gamma_knuth",f_unn(gsl_ran_gamma_knuth),hnd_fnc_rnd,P2DBLX));
# endif // NCO_GSL_MINOR_VERSION < 8
# endif // NCO_GSL_VERSION < 108

gpr_vtr.push_back(gpr_cls("gsl_ran_gaussian",f_unn(gsl_ran_gaussian),hnd_fnc_rnd,P1DBLX));
gpr_vtr.push_back(gpr_cls("gsl_ran_gaussian_ratio_method",f_unn(gsl_ran_gaussian_ratio_method),hnd_fnc_rnd,P1DBLX));
# if NCO_GSL_MINOR_VERSION >= 8

# if NCO_GSL_VERSION >= 108
gpr_vtr.push_back(gpr_cls("gsl_ran_gaussian_ziggurat",f_unn(gsl_ran_gaussian_ziggurat),hnd_fnc_rnd,P1DBLX));
# endif // NCO_GSL_MINOR_VERSION < 8

gpr_vtr.push_back(gpr_cls("gsl_ran_gaussian_pdf",f_unn(gsl_ran_gaussian_pdf),hnd_fnc_nd,P2DBLX));

gpr_vtr.push_back(gpr_cls("gsl_ran_ugaussian",f_unn(gsl_ran_ugaussian),hnd_fnc_rnd,P0DBLX));
Expand Down Expand Up @@ -747,9 +756,11 @@ void gsl_cls::gsl_ini_stats(void){
}

gpr_vtr.push_back(gpr_cls("gsl_stats_covariance",f_unn(ncap_void),hnd_fnc_stat4,PS_COV));
# if NCO_GSL_MINOR_VERSION >= 10

# if NCO_GSLVERSION >= 110
gpr_vtr.push_back(gpr_cls("gsl_stats_correlation",f_unn(ncap_void),hnd_fnc_stat4,PS_COR));
# endif // NCO_GSL_MINOR_VERSION < 10
# endif // NCO_GSL_VERSION < 110

gpr_vtr.push_back(gpr_cls("gsl_stats_pvariance",f_unn(ncap_void),hnd_fnc_stat4,PS_PVAR));
gpr_vtr.push_back(gpr_cls("gsl_stats_ttest",f_unn(ncap_void),hnd_fnc_stat4,PS_TTST));

Expand Down Expand Up @@ -3620,7 +3631,7 @@ var_sct *gsl_cls::hnd_fnc_stat4(bool& is_mtd,std::vector<RefAST>&args_vtr,gpr_cl
default: nco_dfl_case_nc_type_err(); break;
} break;

# if NCO_GSL_MINOR_VERSION >= 10
# if NCO_GSL_VERSION >= 110
case PS_COR:
switch(var_arr[0]->type){
case NC_FLOAT: r_val=gsl_stats_float_correlation( var_arr[0]->val.fp,d1_srd,var_arr[3]->val.fp,d2_srd,sz1 );break;
Expand Down
6 changes: 3 additions & 3 deletions src/nco++/fmc_gsl_cls.hh
Expand Up @@ -40,11 +40,11 @@
#include "ncap2_utl.hh"
#include "vtl_cls.hh"

#ifndef NCO_GSL_MINOR_VERSION
#ifndef NCO_GSL_VERSION
#ifdef _MSC_VER
# define NCO_GSL_MINOR_VERSION 7
# define NCO_GSL_VERSION 107
#else
# define NCO_GSL_MINOR_VERSION 12
# define NCO_GSL_VERSION 112
#endif // _MSC_VER
#endif // NCO_GSL_MINOR_VERSION

Expand Down

0 comments on commit 4d2ef53

Please sign in to comment.