]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_carlson.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / test_carlson.cpp
CommitLineData
7c673cae
FG
1// Copyright 2006 John Maddock
2// Copyright Paul A. Bristow 2007.
3
4// Use, modification and distribution are subject to the
5// Boost Software License, Version 1.0. (See accompanying file
6// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1e59de90
TL
7#ifndef NOMINMAX
8#define NOMINMAX
9#endif
7c673cae
FG
10#include <pch_light.hpp>
11#include "test_carlson.hpp"
12
13//
14// DESCRIPTION:
15// ~~~~~~~~~~~~
16//
17// This file tests the Carlson Elliptic Integrals.
18// There are two sets of tests, spot
19// tests which compare our results with the published test values,
20// in Numerical Computation of Real or Complex Elliptic Integrals,
21// B. C. Carlson: http://arxiv.org/abs/math.CA/9409227
22// However, the bulk of the accuracy tests
23// use values generated with NTL::RR at 1000-bit precision
24// and our generic versions of these functions.
25//
26// Note that when this file is first run on a new platform many of
27// these tests will fail: the default accuracy is 1 epsilon which
28// is too tight for most platforms. In this situation you will
29// need to cast a human eye over the error rates reported and make
30// a judgement as to whether they are acceptable. Either way please
31// report the results to the Boost mailing list. Acceptable rates of
32// error are marked up below as a series of regular expressions that
33// identify the compiler/stdlib/platform/data-type/test-data/test-function
34// along with the maximum expected peek and RMS mean errors for that
35// test.
36//
37
38void expected_results()
39{
40 //
41 // Define the max and mean errors expected for
42 // various compilers and platforms.
43 //
44 const char* largest_type;
45#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
46 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
47 {
48 largest_type = "(long\\s+)?double";
49 }
50 else
51 {
52 largest_type = "long double";
53 }
54#else
55 largest_type = "(long\\s+)?double";
56#endif
57 //
58 // real long doubles:
59 //
60 if(boost::math::policies::digits<long double, boost::math::policies::policy<> >() > 53)
61 {
62 add_expected_result(
63 ".*", // compiler
64 ".*", // stdlib
65 BOOST_PLATFORM, // platform
66 largest_type, // test type(s)
67 ".*RJ.*", // test data group
68 ".*", 1000, 50); // test function
69 add_expected_result(
70 ".*", // compiler
71 ".*", // stdlib
72 BOOST_PLATFORM, // platform
73 "real_concept", // test type(s)
74 ".*RJ.*", // test data group
75 ".*", 1000, 50); // test function
76 }
77 //
78 // Catch all cases come last:
79 //
80 add_expected_result(
81 ".*", // compiler
82 ".*", // stdlib
83 ".*", // platform
84 largest_type, // test type(s)
85 ".*RJ.*", // test data group
86 ".*", 250, 50); // test function
87 add_expected_result(
88 ".*", // compiler
89 ".*", // stdlib
90 ".*", // platform
91 "real_concept", // test type(s)
92 ".*RJ.*", // test data group
93 ".*", 250, 50); // test function
94 add_expected_result(
95 ".*", // compiler
96 ".*", // stdlib
97 ".*", // platform
98 largest_type, // test type(s)
99 ".*", // test data group
100 ".*", 25, 8); // test function
101 add_expected_result(
102 ".*", // compiler
103 ".*", // stdlib
104 ".*", // platform
105 "real_concept", // test type(s)
106 ".*", // test data group
107 ".*", 25, 8); // test function
108 //
109 // Finish off by printing out the compiler/stdlib/platform names,
110 // we do this to make it easier to mark up expected error rates.
111 //
112 std::cout << "Tests run with " << BOOST_COMPILER << ", "
113 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
114}
115
116
117BOOST_AUTO_TEST_CASE( test_main )
118{
119 expected_results();
120 BOOST_MATH_CONTROL_FP;
121
122 boost::math::ellint_rj(1.778e-31, 1.407e+18, 10.05, -4.83e-10);
123
124 test_spots(0.0F, "float");
125 test_spots(0.0, "double");
126#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
127 test_spots(0.0L, "long double");
128#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
129 test_spots(boost::math::concepts::real_concept(0), "real_concept");
130#endif
131#else
132 std::cout << "<note>The long double tests have been disabled on this platform "
133 "either because the long double overloads of the usual math functions are "
134 "not available at all, or because they are too inaccurate for these tests "
135 "to pass.</note>" << std::endl;
136#endif
137}
138
139/*
140
141test_carlson.cpp
142Linking...
143Embedding manifest...
144Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_carlson.exe"
145Running 1 test case...
146Tests run with Microsoft Visual C++ version 8.0, Dinkumware standard library version 405, Win32
147Testing: RF: Random data
148boost::math::ellint_rf<float> Max = 0 RMS Mean=0
149Testing: RC: Random data
150boost::math::ellint_rc<float> Max = 0 RMS Mean=0
151Testing: RJ: Random data
152boost::math::ellint_rf<float> Max = 0 RMS Mean=0
153Testing: RD: Random data
154boost::math::ellint_rd<float> Max = 0 RMS Mean=0
155Testing: RF: Random data
156boost::math::ellint_rf<double> Max = 2.949 RMS Mean=0.7498
157 worst case at row: 377
158 { 3.418e+025, 2.594e-005, 3.264e-012, 6.169e-012 }
159Testing: RC: Random data
160boost::math::ellint_rc<double> Max = 2.396 RMS Mean=0.6283
161 worst case at row: 10
162 { 1.97e-029, 3.224e-025, 2.753e+012 }
163Testing: RJ: Random data
164boost::math::ellint_rf<double> Max = 152.9 RMS Mean=11.15
165 worst case at row: 633
166 { 1.876e+016, 0.000278, 3.796e-006, -4.412e-005, -1.656e-005 }
167Testing: RD: Random data
168boost::math::ellint_rd<double> Max = 2.586 RMS Mean=0.8614
169 worst case at row: 45
170 { 2.111e-020, 8.757e-026, 1.923e-023, 1.004e+033 }
171Testing: RF: Random data
172boost::math::ellint_rf<long double> Max = 2.949 RMS Mean=0.7498
173 worst case at row: 377
174 { 3.418e+025, 2.594e-005, 3.264e-012, 6.169e-012 }
175Testing: RC: Random data
176boost::math::ellint_rc<long double> Max = 2.396 RMS Mean=0.6283
177 worst case at row: 10
178 { 1.97e-029, 3.224e-025, 2.753e+012 }
179Testing: RJ: Random data
180boost::math::ellint_rf<long double> Max = 152.9 RMS Mean=11.15
181 worst case at row: 633
182 { 1.876e+016, 0.000278, 3.796e-006, -4.412e-005, -1.656e-005 }
183Testing: RD: Random data
184boost::math::ellint_rd<long double> Max = 2.586 RMS Mean=0.8614
185 worst case at row: 45
186 { 2.111e-020, 8.757e-026, 1.923e-023, 1.004e+033 }
187Testing: RF: Random data
188boost::math::ellint_rf<real_concept> Max = 2.949 RMS Mean=0.7498
189 worst case at row: 377
190 { 3.418e+025, 2.594e-005, 3.264e-012, 6.169e-012 }
191Testing: RC: Random data
192boost::math::ellint_rc<real_concept> Max = 2.396 RMS Mean=0.6283
193 worst case at row: 10
194 { 1.97e-029, 3.224e-025, 2.753e+012 }
195Testing: RJ: Random data
196boost::math::ellint_rf<real_concept> Max = 152.9 RMS Mean=11.15
197 worst case at row: 633
198 { 1.876e+016, 0.000278, 3.796e-006, -4.412e-005, -1.656e-005 }
199Testing: RD: Random data
200boost::math::ellint_rd<real_concept> Max = 2.586 RMS Mean=0.8614
201 worst case at row: 45
202 { 2.111e-020, 8.757e-026, 1.923e-023, 1.004e+033 }
203*** No errors detected
204
205*/