blob: efd42e1235304b22dce4646f5ec94ed1cb8a4356 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright John Maddock 2009.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "required_defines.hpp"
#include "performance_measure.hpp"
#include <boost/math/special_functions/beta.hpp>
#include <boost/array.hpp>
#define T double
# include "../test/beta_small_data.ipp"
# include "../test/beta_med_data.ipp"
# include "../test/beta_exp_data.ipp"
template <std::size_t N>
double beta_evaluate2(const boost::array<boost::array<T, 3>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += boost::math::beta(data[i][0], data[i][1]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(beta_test, "beta")
{
double result = beta_evaluate2(beta_small_data);
result += beta_evaluate2(beta_med_data);
result += beta_evaluate2(beta_exp_data);
consume_result(result);
set_call_count(
(sizeof(beta_small_data)
+ sizeof(beta_med_data)
+ sizeof(beta_exp_data)) / sizeof(beta_exp_data[0]));
}
#ifdef TEST_DCDFLIB
#include <dcdflib.h>
template <std::size_t N>
double beta_evaluate2_dcd(const boost::array<boost::array<T, 3>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += ::beta(data[i][0], data[i][1]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(beta_test_dcd, "beta-dcd")
{
double result = beta_evaluate2_dcd(beta_small_data);
result += beta_evaluate2_dcd(beta_med_data);
result += beta_evaluate2_dcd(beta_exp_data);
consume_result(result);
set_call_count(
(sizeof(beta_small_data)
+ sizeof(beta_med_data)
+ sizeof(beta_exp_data)) / sizeof(beta_exp_data[0]));
}
#endif
|