]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_laguerre.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / math / test / test_laguerre.cpp
CommitLineData
7c673cae
FG
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#include <pch_light.hpp>
7#include "test_laguerre.hpp"
8
9//
10// DESCRIPTION:
11// ~~~~~~~~~~~~
12//
13// This file tests the Laguerre polynomials.
14// There are two sets of tests, spot
15// tests which compare our results with selected values computed
16// using the online special function calculator at
17// functions.wolfram.com, while the bulk of the accuracy tests
18// use values generated with NTL::RR at 1000-bit precision
19// and our generic versions of these functions.
20//
21// Note that when this file is first run on a new platform many of
22// these tests will fail: the default accuracy is 1 epsilon which
23// is too tight for most platforms. In this situation you will
24// need to cast a human eye over the error rates reported and make
25// a judgement as to whether they are acceptable. Either way please
26// report the results to the Boost mailing list. Acceptable rates of
27// error are marked up below as a series of regular expressions that
28// identify the compiler/stdlib/platform/data-type/test-data/test-function
29// along with the maximum expected peek and RMS mean errors for that
30// test.
31//
32
33void expected_results()
34{
35 //
36 // Define the max and mean errors expected for
37 // various compilers and platforms.
38 //
39 const char* largest_type;
40#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
41 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
42 {
43 largest_type = "(long\\s+)?double";
44 }
45 else
46 {
47 largest_type = "long double";
48 }
49#else
50 largest_type = "(long\\s+)?double";
51#endif
52 //
f67539c2 53 // Linux special cases, error rates seem to be much higher here
7c673cae
FG
54 // even though the implementation contains nothing but basic
55 // arithmetic?
56 //
57 if((std::numeric_limits<long double>::digits <= 64)
58 && (std::numeric_limits<long double>::digits != std::numeric_limits<double>::digits))
59 {
60#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
61 add_expected_result(
62 ".*", // compiler
63 ".*", // stdlib
64 ".*", // platform
65 "double", // test type(s)
66 ".*", // test data group
67 ".*", 10, 5); // test function
68#endif
69 }
70 add_expected_result(
71 ".*", // compiler
72 ".*", // stdlib
73 "linux.*|Mac OS|Sun.*", // platform
74 largest_type, // test type(s)
75 ".*", // test data group
76 ".*", 40000, 1000); // test function
77 add_expected_result(
78 ".*", // compiler
79 ".*", // stdlib
80 "linux.*|Mac OS|Sun.*", // platform
81 "real_concept", // test type(s)
82 ".*", // test data group
83 ".*", 40000, 1000); // test function
84 add_expected_result(
85 "GNU.*", // compiler
86 ".*", // stdlib
87 "Win32.*", // platform
88 largest_type, // test type(s)
89 ".*", // test data group
90 ".*", 40000, 1000); // test function
91 add_expected_result(
92 "GNU.*", // compiler
93 ".*", // stdlib
94 "Win32.*", // platform
95 "real_concept", // test type(s)
96 ".*", // test data group
97 ".*", 40000, 1000); // test function
98 add_expected_result(
99 ".*", // compiler
100 ".*", // stdlib
101 "IBM Aix", // platform
102 largest_type, // test type(s)
103 ".*", // test data group
104 ".*", 5000, 500); // test function
105 add_expected_result(
106 ".*", // compiler
107 ".*", // stdlib
108 "IBM Aix", // platform
109 "real_concept", // test type(s)
110 ".*", // test data group
111 ".*", 5000, 500); // test function
112
113 //
114 // Catch all cases come last:
115 //
116 add_expected_result(
117 ".*", // compiler
118 ".*", // stdlib
119 ".*", // platform
120 largest_type, // test type(s)
121 ".*", // test data group
122 ".*", 4000, 500); // test function
123 add_expected_result(
124 ".*", // compiler
125 ".*", // stdlib
126 ".*", // platform
127 "real_concept", // test type(s)
128 ".*", // test data group
129 ".*", 4000, 500); // test function
130
131 //
132 // Finish off by printing out the compiler/stdlib/platform names,
133 // we do this to make it easier to mark up expected error rates.
134 //
135 std::cout << "Tests run with " << BOOST_COMPILER << ", "
136 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
137}
138
139BOOST_AUTO_TEST_CASE( test_main )
140{
141 BOOST_MATH_CONTROL_FP;
142
143#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
144 test_spots(0.0F, "float");
145#endif
146 test_spots(0.0, "double");
147#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
148 test_spots(0.0L, "long double");
149 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
150#endif
151
152 expected_results();
153
154#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
155 test_laguerre(0.1F, "float");
156#endif
157 test_laguerre(0.1, "double");
158#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
159 test_laguerre(0.1L, "long double");
160#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
161 test_laguerre(boost::math::concepts::real_concept(0.1), "real_concept");
162#endif
163#else
164 std::cout << "<note>The long double tests have been disabled on this platform "
165 "either because the long double overloads of the usual math functions are "
166 "not available at all, or because they are too inaccurate for these tests "
167 "to pass.</note>" << std::endl;
168#endif
169
170}
171
172
173