]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright John Maddock 2015. |
2 | // Use, modification and distribution are subject to the | |
3 | // Boost Software License, Version 1.0. (See accompanying file | |
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #ifndef BOOST_MATH_BINDINGS | |
7 | #define BOOST_MATH_BINDINGS | |
8 | ||
9 | #define ERROR_REPORTING_MODE | |
92f5a8d4 | 10 | #include <stdexcept> |
7c673cae | 11 | |
92f5a8d4 | 12 | #if TEST_CXX17_CMATH |
7c673cae | 13 | |
92f5a8d4 | 14 | #include <cmath> |
7c673cae | 15 | |
92f5a8d4 | 16 | #define TEST_LIBRARY_NAME "<cmath>" |
7c673cae | 17 | |
92f5a8d4 TL |
18 | #define LOG1P_FUNCTION_TO_TEST std::log1p |
19 | #define EXPM1_FUNCTION_TO_TEST std::expm1 | |
7c673cae | 20 | |
92f5a8d4 TL |
21 | #define CBRT_FUNCTION_TO_TEST std::cbrt |
22 | #define ERF_FUNCTION_TO_TEST std::erf | |
23 | #define ERFC_FUNCTION_TO_TEST std::erfc | |
7c673cae | 24 | |
92f5a8d4 TL |
25 | #define LGAMMA_FUNCTION_TO_TEST std::lgamma |
26 | #define TGAMMA_FUNCTION_TO_TEST std::tgamma | |
7c673cae | 27 | |
92f5a8d4 TL |
28 | #define BESSEL_I_FUNCTION_TO_TEST std::cyl_bessel_i |
29 | #define BESSEL_IN_FUNCTION_TO_TEST std::cyl_bessel_i | |
30 | #define BESSEL_J_FUNCTION_TO_TEST std::cyl_bessel_j | |
31 | #define BESSEL_JN_FUNCTION_TO_TEST std::cyl_bessel_j | |
32 | #define BESSEL_JS_FUNCTION_TO_TEST std::sph_bessel | |
33 | #define BESSEL_K_FUNCTION_TO_TEST std::cyl_bessel_k | |
34 | #define BESSEL_KN_FUNCTION_TO_TEST std::cyl_bessel_k | |
35 | #define BESSEL_Y_FUNCTION_TO_TEST std::cyl_neumann | |
36 | #define BESSEL_YN_FUNCTION_TO_TEST std::cyl_neumann | |
37 | #define BESSEL_YS_FUNCTION_TO_TEST std::sph_neumann | |
7c673cae | 38 | |
92f5a8d4 | 39 | #define BETA_FUNCTION_TO_TEST std::beta |
7c673cae | 40 | |
92f5a8d4 TL |
41 | #define ELLINT_1_FUNCTION_TO_TEST std::ellint_1 |
42 | #define ELLINT_1C_FUNCTION_TO_TEST std::comp_ellint_1 | |
43 | #define ELLINT_2_FUNCTION_TO_TEST std::ellint_2 | |
44 | #define ELLINT_2C_FUNCTION_TO_TEST std::comp_ellint_2 | |
45 | #define ELLINT_3_FUNCTION_TO_TEST std::ellint_3 | |
46 | #define ELLINT_3C_FUNCTION_TO_TEST std::comp_ellint_3 | |
7c673cae | 47 | |
92f5a8d4 | 48 | #define EI_FUNCTION_TO_TEST std::expint |
7c673cae | 49 | |
92f5a8d4 TL |
50 | #define LAGUERRE_FUNCTION_TO_TEST std::laguerre |
51 | #define ASSOC_LAGUERRE_FUNCTION_TO_TEST std::assoc_laguerre | |
7c673cae FG |
52 | |
53 | inline long double legendre_p_binder(int i, long double d) | |
54 | { | |
55 | if(i < 0) | |
56 | throw std::domain_error("order parameters less than 0 not supported in TR1"); | |
92f5a8d4 | 57 | return std::legendre(i, d); |
7c673cae FG |
58 | } |
59 | inline long double assoc_legendre_p_binder(int i, int j, long double d) | |
60 | { | |
61 | if((i < 0) || (j < 0)) | |
62 | throw std::domain_error("order parameters less than 0 not supported in TR1"); | |
92f5a8d4 | 63 | return std::assoc_legendre(i, j, d); |
7c673cae FG |
64 | } |
65 | ||
66 | #define LEGENDRE_P_FUNCTION_TO_TEST legendre_p_binder | |
67 | #define LEGENDRE_PA_FUNCTION_TO_TEST assoc_legendre_p_binder | |
92f5a8d4 | 68 | #define ZETA_FUNCTION_TO_TEST std::riemann_zeta |
7c673cae FG |
69 | |
70 | #define TYPE_TO_TEST long double | |
71 | ||
72 | #elif defined(TEST_C99) | |
73 | ||
74 | #include <math.h> | |
75 | ||
76 | #define TEST_LIBRARY_NAME "<math.h>" | |
77 | ||
78 | #ifdef _MSC_VER | |
79 | ||
80 | #define LOG1P_FUNCTION_TO_TEST ::log1p | |
81 | #define EXPM1_FUNCTION_TO_TEST ::expm1 | |
82 | ||
83 | #define CBRT_FUNCTION_TO_TEST ::cbrt | |
84 | #define ERF_FUNCTION_TO_TEST ::erf | |
85 | #define ERFC_FUNCTION_TO_TEST ::erfc | |
86 | ||
87 | #define LGAMMA_FUNCTION_TO_TEST ::lgamma | |
88 | #define TGAMMA_FUNCTION_TO_TEST ::tgamma | |
89 | #define BESSEL_JN_FUNCTION_TO_TEST ::jn | |
90 | #define BESSEL_YN_FUNCTION_TO_TEST ::yn | |
91 | ||
92 | #define TYPE_TO_TEST double | |
93 | ||
94 | #else | |
95 | ||
96 | #define LOG1P_FUNCTION_TO_TEST ::log1pl | |
97 | #define EXPM1_FUNCTION_TO_TEST ::expm1l | |
98 | ||
99 | #define CBRT_FUNCTION_TO_TEST ::cbrtl | |
100 | #define ERF_FUNCTION_TO_TEST ::erfl | |
101 | #define ERFC_FUNCTION_TO_TEST ::erfcl | |
102 | ||
103 | #define LGAMMA_FUNCTION_TO_TEST ::lgammal | |
104 | #define TGAMMA_FUNCTION_TO_TEST ::tgammal | |
105 | //#define BESSEL_JN_FUNCTION_TO_TEST ::jnl | |
106 | //#define BESSEL_JN_FUNCTION_TO_TEST ::ynl | |
107 | ||
108 | #define TYPE_TO_TEST long double | |
109 | #endif | |
110 | ||
111 | #elif defined(TEST_GSL) | |
112 | ||
113 | #include <stdexcept> | |
114 | ||
115 | #include <gsl/gsl_sf.h> | |
116 | #include <gsl/gsl_errno.h> | |
117 | #include <gsl/gsl_version.h> | |
118 | ||
119 | #define TEST_LIBRARY_NAME "GSL " GSL_VERSION | |
120 | ||
121 | void gsl_handler(const char * reason, const char * file, int line, int gsl_errno) | |
122 | { | |
123 | if(gsl_errno == GSL_ERANGE) return; // handle zero or infinity in our test code. | |
124 | throw std::domain_error(reason); | |
125 | } | |
126 | ||
127 | struct gsl_error_handler_setter | |
128 | { | |
129 | gsl_error_handler_t * old_handler; | |
130 | gsl_error_handler_setter() | |
131 | { | |
132 | old_handler = gsl_set_error_handler(gsl_handler); | |
133 | } | |
134 | ~gsl_error_handler_setter() | |
135 | { | |
136 | gsl_set_error_handler(old_handler); | |
137 | } | |
138 | }; | |
139 | ||
140 | static const gsl_error_handler_setter handler; | |
141 | ||
142 | inline double gsl_bessel_ys(unsigned i, double d) | |
143 | { | |
144 | return gsl_sf_bessel_yl(i, d); | |
145 | } | |
146 | ||
147 | inline double gsl_bessel_js(unsigned i, double d) | |
148 | { | |
149 | return gsl_sf_bessel_jl(i, d); | |
150 | } | |
151 | ||
152 | //#define CBRT_FUNCTION_TO_TEST boost::cbrt | |
153 | #define ERF_FUNCTION_TO_TEST gsl_sf_erf | |
154 | #define ERFC_FUNCTION_TO_TEST gsl_sf_erfc | |
155 | //#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv | |
156 | //#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv | |
157 | ||
158 | #define LGAMMA_FUNCTION_TO_TEST gsl_sf_lngamma | |
159 | #define TGAMMA_FUNCTION_TO_TEST gsl_sf_gamma | |
160 | //#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 | |
161 | ||
162 | #define BESSEL_I_FUNCTION_TO_TEST gsl_sf_bessel_Inu | |
163 | #define BESSEL_IN_FUNCTION_TO_TEST gsl_sf_bessel_In | |
164 | //#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
165 | //#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
166 | #define BESSEL_J_FUNCTION_TO_TEST gsl_sf_bessel_Jnu | |
167 | #define BESSEL_JN_FUNCTION_TO_TEST gsl_sf_bessel_Jn | |
168 | #define BESSEL_JS_FUNCTION_TO_TEST gsl_bessel_js | |
169 | //#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
170 | //#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
171 | //#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime | |
172 | #define BESSEL_K_FUNCTION_TO_TEST gsl_sf_bessel_Knu | |
173 | #define BESSEL_KN_FUNCTION_TO_TEST gsl_sf_bessel_Kn | |
174 | //#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
175 | //#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
176 | #define BESSEL_Y_FUNCTION_TO_TEST gsl_sf_bessel_Ynu | |
177 | #define BESSEL_YN_FUNCTION_TO_TEST gsl_sf_bessel_Yn | |
178 | #define BESSEL_YS_FUNCTION_TO_TEST gsl_bessel_ys | |
179 | //#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
180 | //#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
181 | //#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime | |
182 | ||
183 | #define BETA_FUNCTION_TO_TEST gsl_sf_beta | |
184 | //#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient<T> | |
185 | ||
186 | inline double RC(double a, double b) | |
187 | { | |
188 | return gsl_sf_ellint_RC(a, b, GSL_PREC_DOUBLE); | |
189 | } | |
190 | inline double RD(double a, double b, double c) | |
191 | { | |
192 | return gsl_sf_ellint_RD(a, b, c, GSL_PREC_DOUBLE); | |
193 | } | |
194 | inline double RF(double a, double b, double c) | |
195 | { | |
196 | return gsl_sf_ellint_RF(a, b, c, GSL_PREC_DOUBLE); | |
197 | } | |
198 | inline double RJ(double a, double b, double c, double d) | |
199 | { | |
200 | return gsl_sf_ellint_RJ(a, b, c, d, GSL_PREC_DOUBLE); | |
201 | } | |
202 | ||
203 | ||
204 | #define ELLINT_RC_FUNCTION_TO_TEST RC | |
205 | #define ELLINT_RD_FUNCTION_TO_TEST RD | |
206 | #define ELLINT_RF_FUNCTION_TO_TEST RF | |
207 | //#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg | |
208 | #define ELLINT_RJ_FUNCTION_TO_TEST RJ | |
209 | ||
210 | #define DIGAMMA_FUNCTION_TO_TEST gsl_sf_psi | |
211 | ||
212 | inline double ellintK(double a) { return gsl_sf_ellint_Kcomp(a, GSL_PREC_DOUBLE); } | |
213 | inline double ellintE(double a) { return gsl_sf_ellint_Ecomp(a, GSL_PREC_DOUBLE); } | |
214 | inline double ellintP(double a, double b) { return gsl_sf_ellint_Pcomp(a, -b, GSL_PREC_DOUBLE); } | |
215 | ||
216 | inline double ellintF(double a, double b) { return gsl_sf_ellint_F(b, a, GSL_PREC_DOUBLE); } | |
217 | inline double ellintE2(double a, double b) { return gsl_sf_ellint_E(b, a, GSL_PREC_DOUBLE); } | |
218 | inline double ellintP3(double a, double b, double c) { return gsl_sf_ellint_P(c, a, -b, GSL_PREC_DOUBLE); } | |
92f5a8d4 | 219 | inline double ellintD2(double a, double b) { return gsl_sf_ellint_D(b, a, GSL_PREC_DOUBLE); } |
7c673cae FG |
220 | |
221 | #define ELLINT_1_FUNCTION_TO_TEST ellintF | |
222 | #define ELLINT_1C_FUNCTION_TO_TEST ellintK | |
223 | #define ELLINT_2_FUNCTION_TO_TEST ellintE2 | |
224 | #define ELLINT_2C_FUNCTION_TO_TEST ellintE | |
225 | #define ELLINT_3_FUNCTION_TO_TEST ellintP3 | |
226 | #define ELLINT_3C_FUNCTION_TO_TEST ellintP | |
227 | #define ELLINT_D2_FUNCTION_TO_TEST ellintD2 | |
228 | //#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d | |
229 | ||
230 | #define EI_FUNCTION_TO_TEST gsl_sf_expint_Ei | |
231 | #define EN_FUNCTION_TO_TEST gsl_sf_expint_En | |
232 | ||
233 | //#define HERMITE_FUNCTION_TO_TEST boost::math::hermite | |
234 | //#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda | |
235 | ||
236 | //#define BETA_INC_FUNCTION_TO_TEST boost::math::beta | |
237 | //#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac | |
238 | #define IBETA_FUNCTION_TO_TEST gsl_sf_beta_inc | |
239 | //#define IBETAC_FUNCTION_TO_TEST boost::math::ibetac | |
240 | //#define IBETA_INV_FUNCTION_TO_TEST boost::math::ibeta_inv | |
241 | //#define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv | |
242 | //#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva | |
243 | //#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva | |
244 | //#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb | |
245 | //#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb | |
246 | ||
247 | #define IGAMMA_FUNCTION_TO_TEST gsl_sf_gamma_inc | |
248 | //#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower | |
249 | #define GAMMAP_FUNCTION_TO_TEST gsl_sf_gamma_inc_P | |
250 | #define GAMMAQ_FUNCTION_TO_TEST gsl_sf_gamma_inc_Q | |
251 | //#define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv | |
252 | //#define GAMMAQ_INV_FUNCTION_TO_TEST boost::math::gamma_q_inv | |
253 | //#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva | |
254 | //#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva | |
255 | ||
256 | inline double sn(double k, double u) | |
257 | { | |
258 | double s, c, d; | |
259 | gsl_sf_elljac_e(u, k * k, &s, &c, &d); | |
260 | return s; | |
261 | } | |
262 | inline double cn(double k, double u) | |
263 | { | |
264 | double s, c, d; | |
265 | gsl_sf_elljac_e(u, k * k, &s, &c, &d); | |
266 | return c; | |
267 | } | |
268 | inline double dn(double k, double u) | |
269 | { | |
270 | double s, c, d; | |
271 | gsl_sf_elljac_e(u, k * k, &s, &c, &d); | |
272 | return d; | |
273 | } | |
274 | ||
275 | #define SN_FUNCTION_TO_TEST sn | |
276 | #define CN_FUNCTION_TO_TEST cn | |
277 | #define DN_FUNCTION_TO_TEST dn | |
278 | //#define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta | |
279 | ||
280 | inline double laguerre(unsigned n, unsigned m, double x){ return gsl_sf_laguerre_n(n, m, x); } | |
281 | inline double laguerre_0(unsigned n, double x){ return gsl_sf_laguerre_n(n, 0, x); } | |
282 | ||
283 | #define LAGUERRE_FUNCTION_TO_TEST laguerre_0 | |
284 | #define ASSOC_LAGUERRE_FUNCTION_TO_TEST laguerre | |
285 | ||
286 | inline double legendre_q(unsigned n, double x) { return gsl_sf_legendre_Ql(n, x); } | |
287 | ||
288 | #define LEGENDRE_P_FUNCTION_TO_TEST gsl_sf_legendre_Pl | |
289 | #define LEGENDRE_Q_FUNCTION_TO_TEST legendre_q | |
290 | #define LEGENDRE_PA_FUNCTION_TO_TEST gsl_sf_legendre_Plm | |
291 | ||
292 | #define POLYGAMMA_FUNCTION_TO_TEST gsl_sf_psi_n | |
293 | //#define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio | |
294 | //#define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio | |
295 | //#define SIN_PI_RATIO_FUNCTION_TO_TEST boost::math::sin_pi | |
296 | //#define COS_PI_RATIO_FUNCTION_TO_TEST boost::math::cos_pi | |
297 | #define TRIGAMMA_RATIO_FUNCTION_TO_TEST gsl_sf_psi_1 | |
298 | #define ZETA_FUNCTION_TO_TEST gsl_sf_zeta | |
299 | ||
300 | #define TYPE_TO_TEST double | |
301 | ||
302 | #elif defined(TEST_RMATH) | |
303 | ||
304 | #define MATHLIB_STANDALONE | |
305 | #include <Rmath.h> | |
306 | ||
307 | #undef trunc | |
308 | ||
309 | #define TEST_LIBRARY_NAME "Rmath " R_VERSION_STRING | |
310 | ||
311 | #define LOG1P_FUNCTION_TO_TEST log1p | |
312 | #define EXPM1_FUNCTION_TO_TEST expm1 | |
313 | ||
314 | //#define CBRT_FUNCTION_TO_TEST boost::math::cbrt | |
315 | //#define ERF_FUNCTION_TO_TEST boost::math::erf | |
316 | //#define ERFC_FUNCTION_TO_TEST boost::math::erfc | |
317 | //#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv | |
318 | //#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv | |
319 | ||
320 | #define LGAMMA_FUNCTION_TO_TEST lgammafn | |
321 | #define TGAMMA_FUNCTION_TO_TEST gammafn | |
322 | //#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 | |
323 | ||
92f5a8d4 TL |
324 | inline double I(double n, double x) |
325 | { | |
326 | if (x < 0) | |
327 | throw std::domain_error("Unsupported domain"); | |
328 | return bessel_i(x, n, 1); | |
329 | } | |
7c673cae | 330 | inline double K(double n, double x) { return bessel_k(x, n, 1); } |
92f5a8d4 TL |
331 | inline double J(double n, double x) |
332 | { | |
333 | if (x < 0) | |
334 | throw std::domain_error("Unsupported domain"); | |
335 | return bessel_j(x, n); | |
336 | } | |
7c673cae FG |
337 | inline double Y(double n, double x) { return bessel_y(x, n); } |
338 | ||
339 | #define BESSEL_I_FUNCTION_TO_TEST I | |
340 | #define BESSEL_IN_FUNCTION_TO_TEST I | |
341 | //#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
342 | //#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
343 | #define BESSEL_J_FUNCTION_TO_TEST J | |
344 | #define BESSEL_JN_FUNCTION_TO_TEST J | |
345 | //#define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel | |
346 | //#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
347 | //#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
348 | //#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime | |
349 | #define BESSEL_K_FUNCTION_TO_TEST K | |
350 | #define BESSEL_KN_FUNCTION_TO_TEST K | |
351 | //#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
352 | //#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
353 | #define BESSEL_Y_FUNCTION_TO_TEST Y | |
354 | #define BESSEL_YN_FUNCTION_TO_TEST Y | |
355 | //#define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann | |
356 | //#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
357 | //#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
358 | //#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime | |
359 | ||
360 | #define BETA_FUNCTION_TO_TEST beta | |
361 | //#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient<T> | |
362 | ||
363 | //#define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc | |
364 | //#define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd | |
365 | //#define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf | |
366 | //#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg | |
367 | //#define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj | |
368 | ||
369 | #define DIGAMMA_FUNCTION_TO_TEST digamma | |
370 | ||
371 | //#define ELLINT_1_FUNCTION_TO_TEST boost::math::ellint_1 | |
372 | //#define ELLINT_1C_FUNCTION_TO_TEST boost::math::ellint_1 | |
373 | //#define ELLINT_2_FUNCTION_TO_TEST boost::math::ellint_2 | |
374 | //#define ELLINT_2C_FUNCTION_TO_TEST boost::math::ellint_2 | |
375 | //#define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 | |
376 | //#define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 | |
377 | //#define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d | |
378 | //#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d | |
379 | ||
380 | //#define EI_FUNCTION_TO_TEST boost::math::expint | |
381 | //#define EN_FUNCTION_TO_TEST boost::math::expint | |
382 | ||
383 | //#define HERMITE_FUNCTION_TO_TEST boost::math::hermite | |
384 | //#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda | |
385 | ||
386 | inline double ibeta(double a, double b, double x) { return pbeta(x, a, b, 1, 0); } | |
387 | inline double ibetac(double a, double b, double x) { return pbeta(x, a, b, 0, 0); } | |
388 | inline double ibeta_inv(double a, double b, double x) { return qbeta(x, a, b, 1, 0); } | |
389 | inline double ibetac_inv(double a, double b, double x) { return qbeta(x, a, b, 0, 0); } | |
390 | ||
391 | //#define BETA_INC_FUNCTION_TO_TEST boost::math::beta | |
392 | //#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac | |
393 | #define IBETA_FUNCTION_TO_TEST ibeta | |
394 | #define IBETAC_FUNCTION_TO_TEST ibetac | |
395 | #define IBETA_INV_FUNCTION_TO_TEST ibeta_inv | |
396 | #define IBETAC_INV_FUNCTION_TO_TEST ibetac_inv | |
397 | //#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva | |
398 | //#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva | |
399 | //#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb | |
400 | //#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb | |
401 | ||
402 | inline double gamma_p(double a, double x) { return pgamma(x, a, 1.0, 1, 0); } | |
403 | inline double gamma_q(double a, double x) { return pgamma(x, a, 1.0, 0, 0); } | |
404 | inline double gamma_p_inv(double a, double x) { return qgamma(x, a, 1.0, 1, 0); } | |
405 | inline double gamma_q_inv(double a, double x) { return qgamma(x, a, 1.0, 0, 0); } | |
406 | ||
407 | //#define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma | |
408 | //#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower | |
409 | #define GAMMAP_FUNCTION_TO_TEST gamma_p | |
410 | #define GAMMAQ_FUNCTION_TO_TEST gamma_q | |
411 | #define GAMMAP_INV_FUNCTION_TO_TEST gamma_p_inv | |
412 | #define GAMMAQ_INV_FUNCTION_TO_TEST gamma_q_inv | |
413 | //#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva | |
414 | //#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva | |
415 | ||
416 | //#define SN_FUNCTION_TO_TEST boost::math::jacobi_sn | |
417 | //#define CN_FUNCTION_TO_TEST boost::math::jacobi_cn | |
418 | //#define DN_FUNCTION_TO_TEST boost::math::jacobi_dn | |
419 | //#define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta | |
420 | ||
421 | //#define LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre | |
422 | //#define ASSOC_LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre | |
423 | ||
424 | //#define LEGENDRE_P_FUNCTION_TO_TEST boost::math::legendre_p | |
425 | //#define LEGENDRE_Q_FUNCTION_TO_TEST boost::math::legendre_q | |
426 | //#define LEGENDRE_PA_FUNCTION_TO_TEST boost::math::legendre_p | |
427 | ||
92f5a8d4 TL |
428 | inline double polygamma(int n, double x) |
429 | { | |
430 | if (x < 0) | |
431 | throw std::domain_error("Outside supported domain"); | |
432 | return psigamma(x, n); | |
433 | } | |
7c673cae FG |
434 | |
435 | #define POLYGAMMA_FUNCTION_TO_TEST polygamma | |
436 | //#define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio | |
437 | //#define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio | |
438 | //#define SIN_PI_RATIO_FUNCTION_TO_TEST sinpi | |
439 | //#define COS_PI_RATIO_FUNCTION_TO_TEST cospi | |
440 | #define TRIGAMMA_RATIO_FUNCTION_TO_TEST trigamma | |
441 | //#define ZETA_FUNCTION_TO_TEST boost::math::zeta | |
442 | ||
443 | //#define SQRT1PM1_FUNCTION_TO_TEST boost::math::sqrt1pm1 | |
444 | //#define POWM1_FUNCTION_TO_TEST boost::math::powm1 | |
445 | //#define OWENS_T_FUNCTION_TO_TEST boost::math::owens_t | |
446 | //#define SPHERICAL_HARMONIC_R_FUNCTION_TO_TEST boost::math::spherical_harmonic_r | |
447 | //#define SPHERICAL_HARMONIC_I_FUNCTION_TO_TEST boost::math::spherical_harmonic_i | |
448 | ||
449 | template <class T> T do_nc_beta_cdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 1, 0); } | |
450 | template <class T> T do_nc_beta_ccdf(T a, T b, T nc, T x){ return pnbeta(x, a, b, nc, 0, 0); } | |
451 | template <class T> T do_nc_chi_squared_cdf(T df, T nc, T x){ return pnchisq(x, df, nc, 1, 0); } | |
452 | template <class T> T do_nc_chi_squared_ccdf(T df, T nc, T x){ return pnchisq(x, df, nc, 0, 0); } | |
453 | template <class T> T do_nc_t_cdf(T df, T nc, T x){ return pnt(x, df, nc, 1, 0); } | |
454 | template <class T> T do_nc_t_ccdf(T df, T nc, T x){ return pnt(x, df, nc, 0, 0); } | |
455 | ||
456 | #define NC_BETA_CDF_FUNCTION_TO_TEST do_nc_beta_cdf | |
457 | #define NC_BETA_CCDF_FUNCTION_TO_TEST do_nc_beta_ccdf | |
458 | #define NC_CHI_SQUARED_CDF_FUNCTION_TO_TEST do_nc_chi_squared_cdf | |
459 | #define NC_CHI_SQUARED_CCDF_FUNCTION_TO_TEST do_nc_chi_squared_ccdf | |
460 | #define NC_T_CDF_FUNCTION_TO_TEST do_nc_t_cdf | |
461 | #define NC_T_CCDF_FUNCTION_TO_TEST do_nc_t_ccdf | |
462 | ||
463 | #define TYPE_TO_TEST double | |
464 | ||
465 | #elif defined(TEST_CEPHES) | |
466 | ||
467 | #define TEST_LIBRARY_NAME "Cephes" | |
468 | #define TYPE_TO_TEST double | |
469 | ||
470 | extern "C" { | |
471 | ||
472 | double log1p(double) throw(); | |
473 | double expm1(double) throw(); | |
474 | double cbrt(double) throw(); | |
475 | double erf(double) throw(); | |
476 | double erfc(double) throw(); | |
477 | double gamma(double) throw(); | |
478 | double lgam(double) throw(); | |
479 | ||
480 | double iv(double, double) throw(); | |
481 | double jv(double, double) throw(); | |
482 | double jn(int, double) throw(); | |
483 | double kn(int, double) throw(); | |
484 | double yn(int, double) throw(); | |
485 | ||
486 | double beta(double, double)throw(); | |
487 | double psi(double); | |
488 | ||
489 | double ellik(double, double); | |
490 | double ellpk(double); | |
491 | double ellie(double, double); | |
492 | double ellpe(double); | |
493 | ||
494 | double ei(double); | |
495 | // Can't get any sensible values from Cephes expn??? | |
496 | //double expn(double, double); | |
497 | ||
498 | double incbet(double, double, double); | |
499 | double incbi(double, double, double); | |
500 | ||
501 | double igam(double, double); | |
502 | double igamc(double, double); | |
503 | double igami(double, double); | |
504 | ||
505 | double ellpj(double u, double m, double *sn, double *cn, double *dn, double *phi); | |
506 | ||
507 | double zetac(double); | |
508 | ||
509 | } | |
510 | ||
511 | inline double ellint_1(double k, double phi) { return ellik(phi, k * k); } | |
512 | inline double ellint_2(double k, double phi) { return ellie(phi, k * k); } | |
513 | inline double ellint_1(double k) { return ellpk(k * k); } | |
514 | inline double ellint_2(double k) { return ellpe(k * k); } | |
515 | ||
516 | inline double sn(double k, double u) | |
517 | { | |
518 | double sn, cn, dn, phi; | |
519 | ellpj(u, k * k, &sn, &cn, &dn, &phi); | |
520 | return sn; | |
521 | } | |
522 | inline double cn(double k, double u) | |
523 | { | |
524 | double sn, cn, dn, phi; | |
525 | ellpj(u, k * k, &sn, &cn, &dn, &phi); | |
526 | return cn; | |
527 | } | |
528 | ||
529 | inline double dn(double k, double u) | |
530 | { | |
531 | double sn, cn, dn, phi; | |
532 | ellpj(u, k * k, &sn, &cn, &dn, &phi); | |
533 | return dn; | |
534 | } | |
535 | ||
536 | #define LOG1P_FUNCTION_TO_TEST log1p | |
537 | #define EXPM1_FUNCTION_TO_TEST expm1 | |
538 | ||
539 | #define CBRT_FUNCTION_TO_TEST cbrt | |
540 | #define ERF_FUNCTION_TO_TEST erf | |
541 | #define ERFC_FUNCTION_TO_TEST erfc | |
542 | //#define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv | |
543 | //#define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv | |
544 | ||
545 | #define LGAMMA_FUNCTION_TO_TEST lgam | |
546 | #define TGAMMA_FUNCTION_TO_TEST gamma | |
547 | //#define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 | |
548 | ||
549 | #define BESSEL_I_FUNCTION_TO_TEST iv | |
550 | #define BESSEL_IN_FUNCTION_TO_TEST iv | |
551 | //#define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
552 | //#define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
553 | #define BESSEL_J_FUNCTION_TO_TEST jv | |
554 | #define BESSEL_JN_FUNCTION_TO_TEST jn | |
555 | //#define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel | |
556 | //#define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
557 | //#define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
558 | //#define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime | |
559 | //#define BESSEL_K_FUNCTION_TO_TEST boost::math::cyl_bessel_k | |
560 | #define BESSEL_KN_FUNCTION_TO_TEST kn | |
561 | //#define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
562 | //#define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
563 | //#define BESSEL_Y_FUNCTION_TO_TEST boost::math::cyl_neumann | |
564 | #define BESSEL_YN_FUNCTION_TO_TEST yn | |
565 | //#define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann | |
566 | //#define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
567 | //#define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
568 | //#define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime | |
569 | ||
570 | #define BETA_FUNCTION_TO_TEST beta | |
571 | //#define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient<T> | |
572 | ||
573 | //#define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc | |
574 | //#define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd | |
575 | //#define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf | |
576 | //#define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg | |
577 | //#define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj | |
578 | ||
579 | #define DIGAMMA_FUNCTION_TO_TEST psi | |
580 | ||
581 | #define ELLINT_1_FUNCTION_TO_TEST ellint_1 | |
582 | // Can't seem to get sensible answers from Cephes complete elliptic integrals??? | |
583 | //#define ELLINT_1C_FUNCTION_TO_TEST ellint_1 | |
584 | #define ELLINT_2_FUNCTION_TO_TEST ellint_2 | |
585 | //#define ELLINT_2C_FUNCTION_TO_TEST ellint_2 | |
586 | //#define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 | |
587 | //#define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 | |
588 | //#define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d | |
589 | //#define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d | |
590 | ||
591 | #define EI_FUNCTION_TO_TEST ei | |
592 | //#define EN_FUNCTION_TO_TEST expn | |
593 | ||
594 | //#define HERMITE_FUNCTION_TO_TEST boost::math::hermite | |
595 | //#define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda | |
596 | ||
597 | //#define BETA_INC_FUNCTION_TO_TEST incbet | |
598 | //#define BETAC_INC_FUNCTION_TO_TEST boost::math::betac | |
599 | #define IBETA_FUNCTION_TO_TEST incbet | |
600 | //#define IBETAC_FUNCTION_TO_TEST boost::math::ibetac | |
601 | #define IBETA_INV_FUNCTION_TO_TEST incbi | |
602 | //#define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv | |
603 | //#define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva | |
604 | //#define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva | |
605 | //#define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb | |
606 | //#define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb | |
607 | ||
608 | //#define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma | |
609 | //#define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower | |
610 | #define GAMMAP_FUNCTION_TO_TEST igam | |
611 | #define GAMMAQ_FUNCTION_TO_TEST igamc | |
612 | //#define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv | |
613 | #define GAMMAQ_INV_FUNCTION_TO_TEST igami | |
614 | //#define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva | |
615 | //#define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva | |
616 | ||
617 | #define SN_FUNCTION_TO_TEST sn | |
618 | #define CN_FUNCTION_TO_TEST cn | |
619 | #define DN_FUNCTION_TO_TEST dn | |
620 | ||
621 | #define ZETA_FUNCTION_TO_TEST zetac | |
622 | ||
623 | #else | |
624 | ||
625 | #include <boost/math/distributions/non_central_beta.hpp> | |
626 | #include <boost/math/distributions/non_central_chi_squared.hpp> | |
627 | #include <boost/math/distributions/non_central_t.hpp> | |
628 | ||
629 | #define TEST_LIBRARY_NAME "boost" | |
630 | ||
631 | #define LOG1P_FUNCTION_TO_TEST boost::math::log1p | |
632 | #define EXPM1_FUNCTION_TO_TEST boost::math::expm1 | |
633 | ||
634 | #define CBRT_FUNCTION_TO_TEST boost::math::cbrt | |
635 | #define ERF_FUNCTION_TO_TEST boost::math::erf | |
636 | #define ERFC_FUNCTION_TO_TEST boost::math::erfc | |
637 | #define ERF_INV_FUNCTION_TO_TEST boost::math::erf_inv | |
638 | #define ERFC_INV_FUNCTION_TO_TEST boost::math::erfc_inv | |
639 | ||
640 | #define LGAMMA_FUNCTION_TO_TEST boost::math::lgamma | |
641 | #define TGAMMA_FUNCTION_TO_TEST boost::math::tgamma | |
642 | #define TGAMMA1PM1_FUNCTION_TO_TEST boost::math::tgamma1pm1 | |
643 | ||
644 | #define BESSEL_I_FUNCTION_TO_TEST boost::math::cyl_bessel_i | |
645 | #define BESSEL_IN_FUNCTION_TO_TEST boost::math::cyl_bessel_i | |
646 | #define BESSEL_IP_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
647 | #define BESSEL_IPN_FUNCTION_TO_TEST boost::math::cyl_bessel_i_prime | |
648 | #define BESSEL_J_FUNCTION_TO_TEST boost::math::cyl_bessel_j | |
649 | #define BESSEL_JN_FUNCTION_TO_TEST boost::math::cyl_bessel_j | |
650 | #define BESSEL_JS_FUNCTION_TO_TEST boost::math::sph_bessel | |
651 | #define BESSEL_JP_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
652 | #define BESSEL_JPN_FUNCTION_TO_TEST boost::math::cyl_bessel_j_prime | |
653 | #define BESSEL_JPS_FUNCTION_TO_TEST boost::math::sph_bessel_prime | |
654 | #define BESSEL_K_FUNCTION_TO_TEST boost::math::cyl_bessel_k | |
655 | #define BESSEL_KN_FUNCTION_TO_TEST boost::math::cyl_bessel_k | |
656 | #define BESSEL_KP_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
657 | #define BESSEL_KPN_FUNCTION_TO_TEST boost::math::cyl_bessel_k_prime | |
658 | #define BESSEL_Y_FUNCTION_TO_TEST boost::math::cyl_neumann | |
659 | #define BESSEL_YN_FUNCTION_TO_TEST boost::math::cyl_neumann | |
660 | #define BESSEL_YS_FUNCTION_TO_TEST boost::math::sph_neumann | |
661 | #define BESSEL_YP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
662 | #define BESSEL_YNP_FUNCTION_TO_TEST boost::math::cyl_neumann_prime | |
663 | #define BESSEL_YSP_FUNCTION_TO_TEST boost::math::sph_neumann_prime | |
664 | ||
665 | #define BETA_FUNCTION_TO_TEST boost::math::beta | |
666 | #define BINOMIAL_FUNCTION_TO_TEST boost::math::binomial_coefficient<T> | |
667 | ||
668 | #define ELLINT_RC_FUNCTION_TO_TEST boost::math::ellint_rc | |
669 | #define ELLINT_RD_FUNCTION_TO_TEST boost::math::ellint_rd | |
670 | #define ELLINT_RF_FUNCTION_TO_TEST boost::math::ellint_rf | |
671 | #define ELLINT_RG_FUNCTION_TO_TEST boost::math::ellint_rg | |
672 | #define ELLINT_RJ_FUNCTION_TO_TEST boost::math::ellint_rj | |
673 | ||
674 | #define DIGAMMA_FUNCTION_TO_TEST boost::math::digamma | |
675 | ||
676 | #define ELLINT_1_FUNCTION_TO_TEST boost::math::ellint_1 | |
677 | #define ELLINT_1C_FUNCTION_TO_TEST boost::math::ellint_1 | |
678 | #define ELLINT_2_FUNCTION_TO_TEST boost::math::ellint_2 | |
679 | #define ELLINT_2C_FUNCTION_TO_TEST boost::math::ellint_2 | |
680 | #define ELLINT_3_FUNCTION_TO_TEST boost::math::ellint_3 | |
681 | #define ELLINT_3C_FUNCTION_TO_TEST boost::math::ellint_3 | |
682 | #define ELLINT_D2_FUNCTION_TO_TEST boost::math::ellint_d | |
683 | #define ELLINT_D1_FUNCTION_TO_TEST boost::math::ellint_d | |
684 | ||
685 | #define EI_FUNCTION_TO_TEST boost::math::expint | |
686 | #define EN_FUNCTION_TO_TEST boost::math::expint | |
687 | ||
688 | #define HERMITE_FUNCTION_TO_TEST boost::math::hermite | |
689 | #define HEUMAN_LAMBDA_FUNCTION_TO_TEST boost::math::heuman_lambda | |
690 | ||
691 | #define BETA_INC_FUNCTION_TO_TEST boost::math::beta | |
692 | #define BETAC_INC_FUNCTION_TO_TEST boost::math::betac | |
693 | #define IBETA_FUNCTION_TO_TEST boost::math::ibeta | |
694 | #define IBETAC_FUNCTION_TO_TEST boost::math::ibetac | |
695 | #define IBETA_INV_FUNCTION_TO_TEST boost::math::ibeta_inv | |
696 | #define IBETAC_INV_FUNCTION_TO_TEST boost::math::ibetac_inv | |
697 | #define IBETA_INVA_FUNCTION_TO_TEST boost::math::ibeta_inva | |
698 | #define IBETAC_INVA_FUNCTION_TO_TEST boost::math::ibetac_inva | |
699 | #define IBETA_INVB_FUNCTION_TO_TEST boost::math::ibeta_invb | |
700 | #define IBETAC_INVB_FUNCTION_TO_TEST boost::math::ibetac_invb | |
701 | ||
702 | #define IGAMMA_FUNCTION_TO_TEST boost::math::tgamma | |
703 | #define IGAMMAL_FUNCTION_TO_TEST boost::math::tgamma_lower | |
704 | #define GAMMAP_FUNCTION_TO_TEST boost::math::gamma_p | |
705 | #define GAMMAQ_FUNCTION_TO_TEST boost::math::gamma_q | |
706 | #define GAMMAP_INV_FUNCTION_TO_TEST boost::math::gamma_p_inv | |
707 | #define GAMMAQ_INV_FUNCTION_TO_TEST boost::math::gamma_q_inv | |
708 | #define GAMMAP_INVA_FUNCTION_TO_TEST boost::math::gamma_p_inva | |
709 | #define GAMMAQ_INVA_FUNCTION_TO_TEST boost::math::gamma_q_inva | |
710 | ||
711 | #define SN_FUNCTION_TO_TEST boost::math::jacobi_sn | |
712 | #define CN_FUNCTION_TO_TEST boost::math::jacobi_cn | |
713 | #define DN_FUNCTION_TO_TEST boost::math::jacobi_dn | |
714 | #define JACOBI_ZETA_FUNCTION_TO_TEST boost::math::jacobi_zeta | |
715 | ||
716 | #define LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre | |
717 | #define ASSOC_LAGUERRE_FUNCTION_TO_TEST boost::math::laguerre | |
718 | ||
719 | #define LEGENDRE_P_FUNCTION_TO_TEST boost::math::legendre_p | |
720 | #define LEGENDRE_Q_FUNCTION_TO_TEST boost::math::legendre_q | |
721 | #define LEGENDRE_PA_FUNCTION_TO_TEST boost::math::legendre_p | |
722 | ||
723 | #define POLYGAMMA_FUNCTION_TO_TEST boost::math::polygamma | |
724 | #define TGAMMA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_ratio | |
725 | #define TGAMMA_DELTA_RATIO_FUNCTION_TO_TEST boost::math::tgamma_delta_ratio | |
726 | #define SIN_PI_RATIO_FUNCTION_TO_TEST boost::math::sin_pi | |
727 | #define COS_PI_RATIO_FUNCTION_TO_TEST boost::math::cos_pi | |
728 | #define TRIGAMMA_RATIO_FUNCTION_TO_TEST boost::math::trigamma | |
729 | #define ZETA_FUNCTION_TO_TEST boost::math::zeta | |
730 | ||
731 | #define SQRT1PM1_FUNCTION_TO_TEST boost::math::sqrt1pm1 | |
732 | #define POWM1_FUNCTION_TO_TEST boost::math::powm1 | |
733 | #define OWENS_T_FUNCTION_TO_TEST boost::math::owens_t | |
734 | #define SPHERICAL_HARMONIC_R_FUNCTION_TO_TEST boost::math::spherical_harmonic_r | |
735 | #define SPHERICAL_HARMONIC_I_FUNCTION_TO_TEST boost::math::spherical_harmonic_i | |
736 | ||
737 | template <class T> T do_nc_beta_cdf(T a, T b, T nc, T x){ return cdf(boost::math::non_central_beta_distribution<T>(a, b, nc), x); } | |
738 | template <class T> T do_nc_beta_ccdf(T a, T b, T nc, T x){ return cdf(complement(boost::math::non_central_beta_distribution<T>(a, b, nc), x)); } | |
739 | template <class T> T do_nc_chi_squared_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_chi_squared_distribution<T>(df, nc), x); } | |
740 | template <class T> T do_nc_chi_squared_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_chi_squared_distribution<T>(df, nc), x)); } | |
741 | template <class T> T do_nc_t_cdf(T df, T nc, T x){ return cdf(boost::math::non_central_t_distribution<T>(df, nc), x); } | |
742 | template <class T> T do_nc_t_ccdf(T df, T nc, T x){ return cdf(complement(boost::math::non_central_t_distribution<T>(df, nc), x)); } | |
743 | ||
744 | #define NC_BETA_CDF_FUNCTION_TO_TEST do_nc_beta_cdf | |
745 | #define NC_BETA_CCDF_FUNCTION_TO_TEST do_nc_beta_ccdf | |
746 | #define NC_CHI_SQUARED_CDF_FUNCTION_TO_TEST do_nc_chi_squared_cdf | |
747 | #define NC_CHI_SQUARED_CCDF_FUNCTION_TO_TEST do_nc_chi_squared_ccdf | |
748 | #define NC_T_CDF_FUNCTION_TO_TEST do_nc_t_cdf | |
749 | #define NC_T_CCDF_FUNCTION_TO_TEST do_nc_t_ccdf | |
750 | ||
751 | ||
752 | #endif | |
753 | ||
754 | #if defined(TYPE_TO_TEST) && !defined(NAME_OF_TYPE_TO_TEST) | |
755 | #define NAME_OF_TYPE_TO_TEST BOOST_STRINGIZE(TYPE_TO_TEST) | |
756 | #endif | |
757 | ||
758 | // | |
759 | // This include has to come at the end after all the setup is done: | |
760 | // | |
761 | #include "handle_test_result.hpp" | |
762 | ||
763 | ||
764 | #endif | |
765 |