]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_beta_hooks.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / test / test_beta_hooks.hpp
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 }
20 inline float beta(float a, float b)
21 { return betaf(a, 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 }
30 inline float ibeta(float a, float b, float x)
31 { return incbetf(a, b, x); }
32 inline double ibeta(double a, double b, double x)
33 { return incbet(a, b, 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{
52 inline float beta(float a, float b)
53 { return (float)gsl_sf_beta(a, b); }
54 inline double beta(double a, double b)
55 { return gsl_sf_beta(a, b); }
56 inline long double beta(long double a, long double b)
57 { return gsl_sf_beta(a, b); }
58
59 inline float ibeta(float a, float b, float x)
60 { return (float)gsl_sf_beta_inc(a, b, x); }
61 inline double ibeta(double a, double b, double x)
62 { return gsl_sf_beta_inc(a, b, 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
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 }
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 }
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{
114 boost::math::concepts::real_concept beta(boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }
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