mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Hook up a full set of tests for ellint_d.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rd.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
// that the code continues to work no matter how many digits
|
||||
// type T has.
|
||||
|
||||
#ifndef BOOST_MATH_ELLINT_2_HPP
|
||||
#define BOOST_MATH_ELLINT_2_HPP
|
||||
#ifndef BOOST_MATH_ELLINT_D_HPP
|
||||
#define BOOST_MATH_ELLINT_D_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
@@ -122,6 +122,8 @@ T ellint_d_imp(T k, const Policy& pol)
|
||||
{
|
||||
return static_cast<T>(1);
|
||||
}
|
||||
if(fabs(k) <= tools::root_epsilon<T>())
|
||||
return constants::pi<T>() / 4;
|
||||
|
||||
T x = 0;
|
||||
T t = k * k;
|
||||
@@ -174,5 +176,5 @@ inline typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const P
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif // BOOST_MATH_ELLINT_2_HPP
|
||||
#endif // BOOST_MATH_ELLINT_D_HPP
|
||||
|
||||
|
||||
@@ -330,6 +330,15 @@ namespace boost
|
||||
template <class T1, class T2, class Policy>
|
||||
typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi, const Policy& pol);
|
||||
|
||||
template <typename T>
|
||||
typename tools::promote_args<T>::type ellint_d(T k);
|
||||
|
||||
template <class T1, class T2>
|
||||
typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi);
|
||||
|
||||
template <class T1, class T2, class Policy>
|
||||
typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const Policy& pol);
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T, class U, class V>
|
||||
@@ -1167,6 +1176,12 @@ namespace boost
|
||||
\
|
||||
template <class T1, class T2>\
|
||||
inline typename boost::math::tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\
|
||||
\
|
||||
template <typename T>\
|
||||
inline typename boost::math::tools::promote_args<T>::type ellint_d(T k){ return boost::math::ellint_d(k, Policy()); }\
|
||||
\
|
||||
template <class T1, class T2>\
|
||||
inline typename boost::math::tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi){ return boost::math::ellint_d(k, phi, Policy()); }\
|
||||
\
|
||||
template <typename T>\
|
||||
inline typename boost::math::tools::promote_args<T>::type ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\
|
||||
|
||||
@@ -239,6 +239,7 @@ void instantiate(RealType)
|
||||
boost::math::ellint_2(v1, v2);
|
||||
boost::math::ellint_3(v1, v2);
|
||||
boost::math::ellint_3(v1, v2, v3);
|
||||
boost::math::ellint_d(v1);
|
||||
boost::math::ellint_rc(v1, v2);
|
||||
boost::math::ellint_rd(v1, v2, v3);
|
||||
boost::math::ellint_rf(v1, v2, v3);
|
||||
@@ -432,6 +433,8 @@ void instantiate(RealType)
|
||||
boost::math::ellint_rf(v1 * 1, v2 + 0, v3 / 1);
|
||||
boost::math::ellint_rg(v1 * 1, v2 + 0, v3 / 1);
|
||||
boost::math::ellint_rj(v1 * 1, v2 + 0, v3 / 1, v1 * 1);
|
||||
boost::math::ellint_d(v1 * 1);
|
||||
boost::math::ellint_d(v1 * 1, v2 + 0);
|
||||
boost::math::jacobi_elliptic(v1 * 1, v2 + 0, &v1, &v2);
|
||||
boost::math::jacobi_cd(v1 * 1, v2 + 0);
|
||||
boost::math::jacobi_cn(v1 * 1, v2 + 0);
|
||||
@@ -595,6 +598,8 @@ void instantiate(RealType)
|
||||
boost::math::ellint_2(v1, v2, pol);
|
||||
boost::math::ellint_3(v1, v2, pol);
|
||||
boost::math::ellint_3(v1, v2, v3, pol);
|
||||
boost::math::ellint_d(v1, pol);
|
||||
boost::math::ellint_d(v1, v2, pol);
|
||||
boost::math::ellint_rc(v1, v2, pol);
|
||||
boost::math::ellint_rd(v1, v2, v3, pol);
|
||||
boost::math::ellint_rf(v1, v2, v3, pol);
|
||||
@@ -785,6 +790,8 @@ void instantiate(RealType)
|
||||
test::ellint_2(v1, v2);
|
||||
test::ellint_3(v1, v2);
|
||||
test::ellint_3(v1, v2, v3);
|
||||
test::ellint_d(v1);
|
||||
test::ellint_d(v1, v2);
|
||||
test::ellint_rc(v1, v2);
|
||||
test::ellint_rd(v1, v2, v3);
|
||||
test::ellint_rf(v1, v2, v3);
|
||||
@@ -991,6 +998,9 @@ void instantiate_mixed(RealType)
|
||||
boost::math::ellint_3(fr, lr);
|
||||
boost::math::ellint_3(s, l, i);
|
||||
boost::math::ellint_3(fr, dr, lr);
|
||||
boost::math::ellint_d(i);
|
||||
boost::math::ellint_d(i, l);
|
||||
boost::math::ellint_d(fr, lr);
|
||||
boost::math::ellint_rc(i, s);
|
||||
boost::math::ellint_rc(fr, lr);
|
||||
boost::math::ellint_rd(s, i, l);
|
||||
@@ -1132,6 +1142,9 @@ void instantiate_mixed(RealType)
|
||||
boost::math::ellint_3(fr, lr, pol);
|
||||
boost::math::ellint_3(s, l, i, pol);
|
||||
boost::math::ellint_3(fr, dr, lr, pol);
|
||||
boost::math::ellint_d(i, pol);
|
||||
boost::math::ellint_d(i, l, pol);
|
||||
boost::math::ellint_d(fr, lr, pol);
|
||||
boost::math::ellint_rc(i, s, pol);
|
||||
boost::math::ellint_rc(fr, lr, pol);
|
||||
boost::math::ellint_rd(s, i, l, pol);
|
||||
@@ -1276,6 +1289,9 @@ void instantiate_mixed(RealType)
|
||||
test::ellint_3(fr, lr);
|
||||
test::ellint_3(s, l, i);
|
||||
test::ellint_3(fr, dr, lr);
|
||||
test::ellint_d(i);
|
||||
test::ellint_d(i, l);
|
||||
test::ellint_d(fr, lr);
|
||||
test::ellint_rc(i, s);
|
||||
test::ellint_rc(fr, lr);
|
||||
test::ellint_rd(s, i, l);
|
||||
|
||||
29
test/compile_test/sf_ellint_d_incl_test.cpp
Normal file
29
test/compile_test/sf_ellint_d_incl_test.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright John Maddock 2006.
|
||||
// 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)
|
||||
//
|
||||
// Basic sanity check that header <boost/math/special_functions/ellint_d.hpp>
|
||||
// #includes all the files that it needs to.
|
||||
//
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
//
|
||||
// Note this header includes no other headers, this is
|
||||
// important if this test is to be meaningful:
|
||||
//
|
||||
#include "test_compile_result.hpp"
|
||||
|
||||
void compile_and_link_test()
|
||||
{
|
||||
check_result<float>(boost::math::ellint_d<float>(f, f));
|
||||
check_result<double>(boost::math::ellint_d<double>(d, d));
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
check_result<long double>(boost::math::ellint_d<long double>(l, l));
|
||||
#endif
|
||||
|
||||
check_result<float>(boost::math::ellint_d<float>(f));
|
||||
check_result<double>(boost::math::ellint_d<double>(d));
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
check_result<long double>(boost::math::ellint_d<long double>(l));
|
||||
#endif
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "functor.hpp"
|
||||
|
||||
@@ -96,9 +95,10 @@ void test_spots(T, const char* type_name)
|
||||
|
||||
// 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, 2>, 2> data2 = {{
|
||||
static const boost::array<boost::array<T, 2>, 3> data2 = {{
|
||||
{ { SC_(0.5), SC_(0.87315258189267554964563356323264341) } },
|
||||
{ { SC_(1.0) / 1024, SC_(0.78539844427788694671464428063604776) } },
|
||||
{ { boost::math::tools::root_epsilon<T>(), SC_(0.78539816339744830961566084581987572) } }
|
||||
}};
|
||||
|
||||
do_test_ellint_d1<T>(data2, type_name, "Elliptic Integral E: Mathworld Data");
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rj.hpp>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rj.hpp>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rj.hpp>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/ellint_3.hpp>
|
||||
#include <boost/math/special_functions/ellint_d.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rj.hpp>
|
||||
|
||||
@@ -218,6 +218,12 @@ namespace boost{ namespace math{
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE, BOOST_MATH_TEST_TYPE>::type ellint_2(BOOST_MATH_TEST_TYPE k, BOOST_MATH_TEST_TYPE phi, const policies::policy<>& pol);
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE>::type ellint_d(BOOST_MATH_TEST_TYPE k);
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE, BOOST_MATH_TEST_TYPE>::type ellint_d(BOOST_MATH_TEST_TYPE k, BOOST_MATH_TEST_TYPE phi);
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE, BOOST_MATH_TEST_TYPE>::type ellint_d(BOOST_MATH_TEST_TYPE k, BOOST_MATH_TEST_TYPE phi, const policies::policy<>& pol);
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE>::type ellint_1(BOOST_MATH_TEST_TYPE k);
|
||||
|
||||
template tools::promote_args<BOOST_MATH_TEST_TYPE, BOOST_MATH_TEST_TYPE>::type ellint_1(BOOST_MATH_TEST_TYPE k, BOOST_MATH_TEST_TYPE phi);
|
||||
|
||||
Reference in New Issue
Block a user