summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/math/test/test_heuman_lambda.hpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/math/test/test_heuman_lambda.hpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/math/test/test_heuman_lambda.hpp')
-rw-r--r--src/boost/libs/math/test/test_heuman_lambda.hpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/boost/libs/math/test/test_heuman_lambda.hpp b/src/boost/libs/math/test/test_heuman_lambda.hpp
new file mode 100644
index 00000000..023b2e71
--- /dev/null
+++ b/src/boost/libs/math/test/test_heuman_lambda.hpp
@@ -0,0 +1,75 @@
+// Copyright John Maddock 2015.
+// 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)
+
+#ifdef _MSC_VER
+# pragma warning(disable : 4756) // overflow in constant arithmetic
+// Constants are too big for float case, but this doesn't matter for test.
+#endif
+
+#include <boost/math/concepts/real_concept.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/math/special_functions/math_fwd.hpp>
+#include <boost/math/constants/constants.hpp>
+#include <boost/array.hpp>
+#include "functor.hpp"
+
+#include "handle_test_result.hpp"
+#include "table_type.hpp"
+
+#ifndef SC_
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
+#endif
+
+template <class Real, typename T>
+void do_test_heuman_lambda(const T& data, const char* type_name, const char* test)
+{
+#if !(defined(ERROR_REPORTING_MODE) && !defined(HEUMAN_LAMBDA_FUNCTION_TO_TEST))
+ typedef Real value_type;
+
+ std::cout << "Testing: " << test << std::endl;
+
+#ifdef HEUMAN_LAMBDA_FUNCTION_TO_TEST
+ value_type(*fp2)(value_type, value_type) = HEUMAN_LAMBDA_FUNCTION_TO_TEST;
+#elif defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
+ value_type (*fp2)(value_type, value_type) = boost::math::ellint_d<value_type, value_type>;
+#else
+ value_type(*fp2)(value_type, value_type) = boost::math::heuman_lambda;
+#endif
+ boost::math::tools::test_result<value_type> result;
+
+ result = boost::math::tools::test_hetero<Real>(
+ data,
+ bind_func<Real>(fp2, 1, 0),
+ extract_result<Real>(2));
+ handle_test_result(result, data[result.worst()], result.worst(),
+ type_name, "heuman_lambda", test);
+
+ std::cout << std::endl;
+#endif
+}
+
+template <typename T>
+void test_spots(T, const char* type_name)
+{
+ BOOST_MATH_STD_USING
+ // Function values calculated on http://functions.wolfram.com/
+ // Note that Mathematica's EllipticE accepts k^2 as the second parameter.
+ static const boost::array<boost::array<T, 3>, 5> data1 = {{
+ { { SC_(0.25), SC_(0.5), SC_(0.231195544262270355901990821099667428154924832224446817213200) } },
+ { { SC_(-0.25), SC_(0.5), SC_(-0.231195544262270355901990821099667428154924832224446817213200) } },
+ { { SC_(0), SC_(0.5), SC_(0) } },
+ { { SC_(1), T(0.5), SC_(0.792745183008071035953588061452801838417979005666066982987549) } },
+ { { SC_(1), T(0), SC_(0.841470984807896506652502321630298999622563060798371065672751) } },
+ }};
+
+ do_test_heuman_lambda<T>(data1, type_name, "Elliptic Integral Jacobi Zeta: Mathworld Data");
+
+#include "heuman_lambda_data.ipp"
+
+ do_test_heuman_lambda<T>(heuman_lambda_data, type_name, "Elliptic Integral Heuman Lambda: Random Data");
+}
+