• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  (C) Copyright John Maddock 2006.
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_TEST_BETA_OTHER_HOOKS_HPP
7 #define BOOST_MATH_TEST_BETA_OTHER_HOOKS_HPP
8 
9 #ifdef TEST_CEPHES
10 namespace other{
11 extern "C" {
12    double beta(double, double);
13    float betaf(float, float);
14    long double betal(long double, long double);
15 
16    double incbet(double, double, double);
17    float incbetf(float, float, float);
18    long double incbetl(long double, long double, long double);
19 }
beta(float a,float b)20 inline float beta(float a, float b)
21 { return betaf(a, b); }
beta(long double a,long double b)22 inline long double beta(long double a, long double b)
23 {
24 #ifdef BOOST_MSVC
25    return beta((double)a, (double)b);
26 #else
27    return betal(a, b);
28 #endif
29 }
ibeta(float a,float b,float x)30 inline float ibeta(float a, float b, float x)
31 { return incbetf(a, b, x); }
ibeta(double a,double b,double x)32 inline double ibeta(double a, double b, double x)
33 { return incbet(a, b, x); }
ibeta(long double a,long double b,long double x)34 inline long double ibeta(long double a, long double b, long double x)
35 {
36 #ifdef BOOST_MSVC
37    return incbet((double)a, (double)b, (double)x);
38 #else
39    return incbetl(a, b);
40 #endif
41 }
42 }
43 #define TEST_OTHER
44 #endif
45 
46 #ifdef TEST_GSL
47 #include <gsl/gsl_sf_gamma.h>
48 #include <gsl/gsl_errno.h>
49 #include <gsl/gsl_message.h>
50 
51 namespace other{
beta(float a,float b)52 inline float beta(float a, float b)
53 { return (float)gsl_sf_beta(a, b); }
beta(double a,double b)54 inline double beta(double a, double b)
55 { return gsl_sf_beta(a, b); }
beta(long double a,long double b)56 inline long double beta(long double a, long double b)
57 { return gsl_sf_beta(a, b); }
58 
ibeta(float a,float b,float x)59 inline float ibeta(float a, float b, float x)
60 { return (float)gsl_sf_beta_inc(a, b, x); }
ibeta(double a,double b,double x)61 inline double ibeta(double a, double b, double x)
62 { return gsl_sf_beta_inc(a, b, x); }
ibeta(long double a,long double b,long double x)63 inline long double ibeta(long double a, long double b, long double x)
64 {
65    return gsl_sf_beta_inc((double)a, (double)b, (double)x);
66 }
67 }
68 #define TEST_OTHER
69 #endif
70 
71 #ifdef TEST_BRATIO
72 namespace other{
73 extern "C" int bratio_(double*a, double*b, double*x, double*y, double*w, double*w1, int*ierr);
74 
ibeta(float a,float b,float x)75 inline float ibeta(float a, float b, float x)
76 {
77    double a_ = a;
78    double b_ = b;
79    double x_ = x;
80    double y_ = 1-x_;
81    double w, w1;
82    int ierr = 0;
83    bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
84    return w;
85 }
ibeta(double a,double b,double x)86 inline double ibeta(double a, double b, double x)
87 {
88    double a_ = a;
89    double b_ = b;
90    double x_ = x;
91    double y_ = 1-x_;
92    double w, w1;
93    int ierr = 0;
94    bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
95    return w;
96 }
ibeta(long double a,long double b,long double x)97 inline long double ibeta(long double a, long double b, long double x)
98 {
99    double a_ = a;
100    double b_ = b;
101    double x_ = x;
102    double y_ = 1-x_;
103    double w, w1;
104    int ierr = 0;
105    bratio_(&a_, &b_, &x_, &y_, &w, &w1, &ierr);
106    return w;
107 }
108 }
109 #define TEST_OTHER
110 #endif
111 
112 #ifdef TEST_OTHER
113 namespace other{
beta(boost::math::concepts::real_concept,boost::math::concepts::real_concept)114    boost::math::concepts::real_concept beta(boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }
ibeta(boost::math::concepts::real_concept,boost::math::concepts::real_concept,boost::math::concepts::real_concept)115    boost::math::concepts::real_concept ibeta(boost::math::concepts::real_concept, boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }
116 }
117 #endif
118 
119 
120 #endif
121 
122 
123