2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Fixed most of the remaining Borland issues, and removed dependency to Boost.Lambda.

Added tentative fix for the Sunpro compilers.

[SVN r39971]
This commit is contained in:
John Maddock
2007-10-13 16:23:18 +00:00
parent f51e500eea
commit b6aa138a79
34 changed files with 327 additions and 405 deletions

View File

@@ -425,7 +425,7 @@ namespace tools
{
template<>
inline int digits<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline int digits<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
return ::NTL::RR::precision();
}
@@ -493,7 +493,7 @@ inline int real_cast<int, boost::math::ntl::RR>(boost::math::ntl::RR t)
}
template <>
inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -507,7 +507,7 @@ inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPL
}
template <>
inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -521,7 +521,7 @@ inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPL
}
template <>
inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -536,7 +536,7 @@ inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_T
}
template <>
inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
static bool has_init = false;
static NTL::RR val;
@@ -551,7 +551,7 @@ inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_T
}
template <>
inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
return ldexp(boost::math::ntl::RR(1), 1-boost::math::policies::digits<boost::math::ntl::RR, boost::math::policies::policy<> >());
}
@@ -564,13 +564,13 @@ inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLAT
//
namespace constants{
template<> inline boost::math::ntl::RR pi<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
template<> inline boost::math::ntl::RR pi<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
NTL::RR result;
ComputePi(result);
return result;
}
template<> inline boost::math::ntl::RR e<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
template<> inline boost::math::ntl::RR e<boost::math::ntl::RR>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
{
NTL::RR result;
result = 1;

View File

@@ -55,7 +55,7 @@ public:
real_concept(int c) : m_value(c){}
real_concept(unsigned long c) : m_value(c){}
real_concept(long c) : m_value(c){}
#if defined(BOOST_HAS_LONG_LONG) || defined(__DECCXX)
#if defined(BOOST_HAS_LONG_LONG) || defined(__DECCXX) || defined(__SUNPRO_CC)
real_concept(unsigned long long c) : m_value(static_cast<long double>(c)){}
real_concept(long long c) : m_value(static_cast<long double>(c)){}
#elif defined(BOOST_HAS_MS_INT64)
@@ -226,8 +226,13 @@ inline real_concept tan(real_concept a)
{ return std::tan(a.value()); }
inline real_concept pow(real_concept a, real_concept b)
{ return std::pow(a.value(), b.value()); }
#if !defined(__SUNPRO_CC)
inline real_concept pow(real_concept a, int b)
{ return std::pow(a.value(), b); }
#else
inline real_concept pow(real_concept a, int b)
{ return std::pow(a.value(), static_cast<long double>(b)); }
#endif
inline real_concept sin(real_concept a)
{ return std::sin(a.value()); }
inline real_concept sinh(real_concept a)
@@ -305,31 +310,31 @@ inline long double real_cast<long double, concepts::real_concept>(concepts::real
}
template <>
inline concepts::real_concept max_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline concepts::real_concept max_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return max_value<long double>();
}
template <>
inline concepts::real_concept min_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline concepts::real_concept min_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return min_value<long double>();
}
template <>
inline concepts::real_concept log_max_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline concepts::real_concept log_max_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return log_max_value<long double>();
}
template <>
inline concepts::real_concept log_min_value<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline concepts::real_concept log_min_value<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
return log_min_value<long double>();
}
template <>
inline concepts::real_concept epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline concepts::real_concept epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
#ifdef __SUNPRO_CC
return std::numeric_limits<long double>::epsilon();
@@ -339,7 +344,7 @@ inline concepts::real_concept epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts
}
template <>
inline int digits<concepts::real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
inline int digits<concepts::real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept))
{
// Assume number of significand bits is same as long double,
// unless std::numeric_limits<T>::is_specialized to provide digits.

View File

@@ -300,37 +300,37 @@ inline long double real_cast<long double, concepts::std_real_concept>(concepts::
}
template <>
inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return max_value<long double>();
}
template <>
inline concepts::std_real_concept min_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline concepts::std_real_concept min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return min_value<long double>();
}
template <>
inline concepts::std_real_concept log_max_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline concepts::std_real_concept log_max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return log_max_value<long double>();
}
template <>
inline concepts::std_real_concept log_min_value<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline concepts::std_real_concept log_min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return log_min_value<long double>();
}
template <>
inline concepts::std_real_concept epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline concepts::std_real_concept epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{
return tools::epsilon<long double>();
}
template <>
inline int digits<concepts::std_real_concept>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
inline int digits<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
{ // Assume number of significand bits is same as long double,
// unless std::numeric_limits<T>::is_specialized to provide digits.
return digits<long double>();

View File

@@ -7,7 +7,7 @@
#ifndef BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
#define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
#include <boost/config.hpp>
#include <boost/math/tools/config.hpp>
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4127 4701)
@@ -37,16 +37,16 @@ namespace boost{ namespace math
#define BOOST_DEFINE_MATH_CONSTANT(name, x, y, exp)\
template <class T> inline T name(BOOST_EXPLICIT_TEMPLATE_TYPE(T))\
template <class T> inline T name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))\
{\
static const T result = ::boost::lexical_cast<T>(BOOST_STRINGIZE(BOOST_JOIN(BOOST_JOIN(x, y), BOOST_JOIN(e, exp))));\
return result;\
}\
template <> inline float name<float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(float))\
template <> inline float name<float>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(float))\
{ return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), F); }\
template <> inline double name<double>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(double))\
template <> inline double name<double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(double))\
{ return BOOST_JOIN(x, BOOST_JOIN(e, exp)); }\
template <> inline long double name<long double>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))\
template <> inline long double name<long double>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))\
{ return BOOST_JOIN(BOOST_JOIN(x, BOOST_JOIN(e, exp)), L); }
BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884197169399375105820974944, 59230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196, 0)

View File

@@ -35,7 +35,7 @@ namespace boost{ namespace math{
namespace tools{
template <class T>
int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T));
int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T));
}

View File

@@ -913,14 +913,16 @@ template <class RT1, class RT2, class RT3>
inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q)
{
return ibetac_inv(a, b, q, static_cast<RT1*>(0), policies::policy<>());
typedef typename remove_cv<RT1>::type dummy;
return ibetac_inv(a, b, q, static_cast<dummy*>(0), policies::policy<>());
}
template <class RT1, class RT2, class RT3, class Policy>
inline typename tools::promote_args<RT1, RT2, RT3>::type
inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy& pol)
{
return ibetac_inv(a, b, q, static_cast<RT1*>(0), pol);
typedef typename remove_cv<RT1>::type dummy;
return ibetac_inv(a, b, q, static_cast<dummy*>(0), pol);
}
} // namespace math

View File

@@ -16,18 +16,17 @@
#pragma warning(pop)
#endif
#include <cmath>
#include <boost/math/special_functions/math_fwd.hpp>
namespace boost { namespace math
{
// Forward declarations:
template <class T>
T unchecked_factorial(unsigned i);
template <class T>
struct max_factorial;
// efinitions:
template <>
inline float unchecked_factorial<float>(unsigned i)
inline float unchecked_factorial<float>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float))
{
static const boost::array<float, 35> factorials = {{
1.0F,
@@ -78,7 +77,7 @@ struct max_factorial<float>
template <>
inline long double unchecked_factorial<long double>(unsigned i)
inline long double unchecked_factorial<long double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))
{
static const boost::array<long double, 171> factorials = {{
1L,
@@ -264,9 +263,9 @@ struct max_factorial<long double>
};
template <>
inline double unchecked_factorial(unsigned i)
inline double unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double))
{
return static_cast<double>(unchecked_factorial<long double>(i));
return static_cast<double>(boost::math::unchecked_factorial<long double>(i));
}
template <>
@@ -277,7 +276,7 @@ struct max_factorial<double>
};
template <class T>
inline T unchecked_factorial(unsigned i)
inline T unchecked_factorial(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
{
static const boost::array<T, 101> factorials = {{
boost::lexical_cast<T>("1"),

View File

@@ -16,7 +16,7 @@ namespace math{
// Recurrance relation for legendre P and Q polynomials:
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
inline typename tools::promote_args<T1, T2, T3>::type
legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
@@ -58,7 +58,7 @@ T legendre_imp(unsigned l, T x, const Policy& pol, bool second = false)
while(n < l)
{
std::swap(p0, p1);
p1 = legendre_next(n, x, p0, p1);
p1 = boost::math::legendre_next(n, x, p0, p1);
++n;
}
return p1;
@@ -127,16 +127,16 @@ T legendre_p_imp(int l, int m, T x, T sin_theta_power, const Policy& pol)
if(m < 0)
{
int sign = (m&1) ? -1 : 1;
return sign * tgamma_ratio(static_cast<T>(l+m+1), static_cast<T>(l+1-m), pol) * legendre_p_imp(l, -m, x, sin_theta_power, pol);
return sign * boost::math::tgamma_ratio(static_cast<T>(l+m+1), static_cast<T>(l+1-m), pol) * legendre_p_imp(l, -m, x, sin_theta_power, pol);
}
// Special cases:
if(m > l)
return 0;
if(m == 0)
return legendre_p(l, x, pol);
return boost::math::legendre_p(l, x, pol);
T p0 = boost::math::double_factorial<T>(2 * m - 1, pol) * sin_theta_power;
if(m&1)
p0 *= -1;
if(m == l)
@@ -149,7 +149,7 @@ T legendre_p_imp(int l, int m, T x, T sin_theta_power, const Policy& pol)
while(n < l)
{
std::swap(p0, p1);
p1 = legendre_next(n, m, x, p0, p1);
p1 = boost::math::legendre_next(n, m, x, p0, p1);
++n;
}
return p1;
@@ -166,7 +166,7 @@ inline T legendre_p_imp(int l, int m, T x, const Policy& pol)
}
template <class T, class Policy>
inline typename tools::promote_args<T>::type
inline typename tools::promote_args<T>::type
legendre_p(int l, int m, T x, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
@@ -175,7 +175,7 @@ inline typename tools::promote_args<T>::type
}
template <class T>
inline typename tools::promote_args<T>::type
inline typename tools::promote_args<T>::type
legendre_p(int l, int m, T x)
{
return boost::math::legendre_p(l, m, x, policies::policy<>());

View File

@@ -127,7 +127,7 @@ inline long double log1p(long double z)
#ifdef BOOST_HAS_LOG1P
# if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
|| defined(linux) || defined(__linux) || defined(__linux__) \
|| ((defined(linux) || defined(__linux) || defined(__linux__)) && !defined(__SUNPRO_CC)) \
|| (defined(__hpux) && !defined(_PA_RISC1_1))
template <class Policy>
inline float log1p(float x, const Policy& pol)

View File

@@ -329,7 +329,7 @@ namespace boost
template <class RT, class Policy>
RT factorial(unsigned int, const Policy& pol);
template <class RT>
RT unchecked_factorial(unsigned int);
RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT));
template <class RT>
RT double_factorial(unsigned i);
template <class RT, class Policy>

View File

@@ -40,6 +40,43 @@
# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#endif
#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
# include "boost/type.hpp"
# include "boost/non_type.hpp"
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
, BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
, BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
, BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
, BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
#else
// no workaround needed: expand to nothing
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
//
// Define if constants too large for a float cause "bad"

View File

@@ -37,7 +37,7 @@ namespace tools
// See Conceptual Requirements for Real Number Types.
template <class T>
inline int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -48,7 +48,7 @@ inline int digits(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
}
template <class T>
inline T max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -60,7 +60,7 @@ inline T max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
// -max_value<double> = -1.79769e+308, max_value<double> = 1.79769e+308.
template <class T>
inline T min_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -80,13 +80,13 @@ namespace detail{
// For type float first:
//
template <class T>
inline T log_max_value(const mpl::int_<128>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_max_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 88.0f;
}
template <class T>
inline T log_min_value(const mpl::int_<128>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_min_value(const mpl::int_<128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -87.0f;
}
@@ -94,13 +94,13 @@ inline T log_min_value(const mpl::int_<128>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE
// Now double:
//
template <class T>
inline T log_max_value(const mpl::int_<1024>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_max_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 709.0;
}
template <class T>
inline T log_min_value(const mpl::int_<1024>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_min_value(const mpl::int_<1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -708.0;
}
@@ -108,19 +108,19 @@ inline T log_min_value(const mpl::int_<1024>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYP
// 80 and 128-bit long doubles:
//
template <class T>
inline T log_max_value(const mpl::int_<16384>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_max_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return 11356.0L;
}
template <class T>
inline T log_min_value(const mpl::int_<16384>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_min_value(const mpl::int_<16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return -11355.0L;
}
template <class T>
inline T log_max_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_max_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -133,7 +133,7 @@ inline T log_max_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T
}
template <class T>
inline T log_min_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_min_value(const mpl::int_<0>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
@@ -146,14 +146,14 @@ inline T log_min_value(const mpl::int_<0>& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T
}
template <class T>
inline T epsilon(const mpl::true_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T epsilon(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
return std::numeric_limits<T>::epsilon();
}
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
template <>
inline long double epsilon<long double>(const mpl::true_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(long double))
inline long double epsilon<long double>(const mpl::true_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double))
{
// numeric_limits on Darwin tells lies here.
// This static assert fails for some unknown reason, so
@@ -164,7 +164,7 @@ inline long double epsilon<long double>(const mpl::true_& BOOST_APPEND_EXPLICIT_
#endif
template <class T>
inline T epsilon(const mpl::false_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
inline T epsilon(const mpl::false_& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
{
BOOST_MATH_STD_USING // for ADL of std names
static const T eps = ldexp(static_cast<T>(1), 1-policies::digits<T, policies::policy<> >());
@@ -174,7 +174,7 @@ inline T epsilon(const mpl::false_& BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T))
} // namespace detail
template <class T>
inline T log_max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
typedef typename mpl::if_c<
@@ -195,7 +195,7 @@ inline T log_max_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
}
template <class T>
inline T log_min_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
typedef typename mpl::if_c<
@@ -217,7 +217,7 @@ inline T log_min_value(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
}
template <class T>
inline T epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
inline T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
return detail::epsilon<T>(mpl::bool_< ::std::numeric_limits<T>::is_specialized>());

View File

@@ -130,6 +130,57 @@ inline row_binder2_i1<F> bind_func_int1(F f, unsigned i, unsigned j)
return row_binder2_i1<F>(f, i, j);
}
template <class F>
struct row_binder3_i2
{
row_binder3_i2(F _f, unsigned i, unsigned j, unsigned k) : f(_f), m_i(i), m_j(j), m_k(k) {}
template <class S>
typename S::value_type operator()(const S& row)
{
return f(
boost::math::tools::real_cast<int>(row[m_i]),
boost::math::tools::real_cast<int>(row[m_j]),
row[m_k]);
}
private:
F f;
unsigned m_i, m_j, m_k;
};
template<class F>
inline row_binder3_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k)
{
return row_binder3_i2<F>(f, i, j, k);
}
template <class F>
struct row_binder4_i2
{
row_binder4_i2(F _f, unsigned i, unsigned j, unsigned k, unsigned l) : f(_f), m_i(i), m_j(j), m_k(k), m_l(l) {}
template <class S>
typename S::value_type operator()(const S& row)
{
return f(
boost::math::tools::real_cast<int>(row[m_i]),
boost::math::tools::real_cast<int>(row[m_j]),
row[m_k],
row[m_l]);
}
private:
F f;
unsigned m_i, m_j, m_k, m_l;
};
template<class F>
inline row_binder4_i2<F> bind_func_int2(F f, unsigned i, unsigned j, unsigned k, unsigned l)
{
return row_binder4_i2<F>(f, i, j, k, l);
}
template <class F>
struct negate_type
{

View File

@@ -58,6 +58,17 @@ void expected_results()
".*", 10, 6); // test function
}
struct negative_cbrt
{
negative_cbrt(){}
template <class S>
typename S::value_type operator()(const S& row)
{
return boost::math::cbrt(-row[1]);
}
};
template <class T>
void do_test_cbrt(const T& data, const char* type_name, const char* test_name)
@@ -82,7 +93,7 @@ void do_test_cbrt(const T& data, const char* type_name, const char* test_name)
extract_result(0));
result += boost::math::tools::test(
data,
negate(bind_func(funcp, 1)),
negative_cbrt(),
negate(extract_result(0)));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cbrt", test_name);
std::cout << std::endl;

View File

@@ -523,6 +523,7 @@ void test_spots(RealType)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
// Check that can generate chi_squared distribution using the two convenience methods:
chi_squared_distribution<> mychisqr(8);
chi_squared mychisqr2(8);
@@ -532,9 +533,11 @@ int test_main(int, char* [])
// (Parameter value, arbitrarily zero, only communicates the floating point type).
test_spots(0.0F); // Test float.
test_spots(0.0); // Test double.
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_spots(0.0L); // Test long double.
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
#endif
#endif
return 0;
} // int test_main(int, char* [])

View File

@@ -114,6 +114,7 @@ void test_classify(T t, const char* type)
int test_main(int, char* [] )
{
BOOST_MATH_CONTROL_FP;
// start by printing some information:
#ifdef isnan
std::cout << "Platform has isnan macro." << std::endl;

View File

@@ -8,10 +8,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/digamma.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
@@ -69,7 +66,6 @@ void expected_results()
template <class T>
void do_test_digamma(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -86,12 +82,10 @@ void do_test_digamma(const T& data, const char* type_name, const char* test_name
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::digamma", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -155,6 +149,7 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_1.hpp>
#include <boost/array.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -103,11 +102,9 @@ void do_test_ellint_f(T& data, const char* type_name, const char* test)
result = boost::math::tools::test(
data,
boost::lambda::bind(fp2,
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
handle_test_result(result, data[result.worst()], result.worst(),
bind_func(fp2, 1, 0),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
std::cout << std::endl;
@@ -126,9 +123,8 @@ void do_test_ellint_k(T& data, const char* type_name, const char* test)
value_type (*fp1)(value_type) = boost::math::ellint_1;
result = boost::math::tools::test(
data,
boost::lambda::bind(fp1,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(fp1, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_1", test);
@@ -196,6 +192,7 @@ void test_spots(T, const char* type_name)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");

View File

@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_2.hpp>
#include <boost/array.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -103,10 +102,8 @@ void do_test_ellint_e2(const T& data, const char* type_name, const char* test)
result = boost::math::tools::test(
data,
boost::lambda::bind(fp2,
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(fp2, 1, 0),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
@@ -125,9 +122,8 @@ void do_test_ellint_e1(T& data, const char* type_name, const char* test)
value_type (*fp1)(value_type) = boost::math::ellint_2;
result = boost::math::tools::test(
data,
boost::lambda::bind(fp1,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(fp1, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_2", test);
@@ -187,6 +183,7 @@ void test_spots(T, const char* type_name)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif

View File

@@ -16,8 +16,7 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/math/special_functions/ellint_3.hpp>
#include <boost/array.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include "functor.hpp"
#include "handle_test_result.hpp"
//
@@ -116,11 +115,8 @@ void do_test_ellint_pi3(T& data, const char* type_name, const char* test)
result = boost::math::tools::test(
data,
boost::lambda::bind(fp2,
boost::lambda::ret<value_type>(boost::lambda::_1[2]),
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func(fp2, 2, 0, 1),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -141,10 +137,8 @@ void do_test_ellint_pi2(T& data, const char* type_name, const char* test)
result = boost::math::tools::test(
data,
boost::lambda::bind(fp2,
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(fp2, 1, 0),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(),
type_name, "boost::math::ellint_3", test);
@@ -226,6 +220,7 @@ void test_spots(T, const char* type_name)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -11,10 +11,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_erf_hooks.hpp"
#include "handle_test_result.hpp"
@@ -101,7 +98,6 @@ void expected_results()
template <class T>
void do_test_erf(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -118,18 +114,16 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name)
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erf;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erf");
}
#endif
@@ -139,29 +133,25 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::erfc;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(funcp, 0),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::erfc;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind(funcp, 0),
extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erfc");
}
#endif
std::cout << std::endl;
#endif
}
template <class T>
void do_test_erf_inv(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -177,18 +167,15 @@ void do_test_erf_inv(const T& data, const char* type_name, const char* test_name
funcp = boost::math::erf_inv;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf_inv", test_name);
std::cout << std::endl;
#endif
}
template <class T>
void do_test_erfc_inv(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -204,12 +191,10 @@ void do_test_erfc_inv(const T& data, const char* type_name, const char* test_nam
funcp = boost::math::erfc_inv;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc_inv", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -296,6 +281,7 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -286,6 +286,7 @@ void test_spots(T)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
test_spots(0.0F);
test_spots(0.0);
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -14,10 +14,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -288,7 +285,6 @@ void expected_results()
template <class T>
void do_test_gamma(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -305,16 +301,16 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name)
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::tgamma;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::tgamma");
}
#endif
@@ -324,28 +320,26 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::lgamma;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(funcp, 0),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::lgamma", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::lgamma;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(funcp, 0),
extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::lgamma");
}
#endif
std::cout << std::endl;
#endif
}
template <class T>
void do_test_gammap1m1(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -362,11 +356,10 @@ void do_test_gammap1m1(const T& data, const char* type_name, const char* test_na
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp, boost::lambda::ret<value_type>(boost::lambda::_1[0])),
boost::lambda::ret<value_type>(boost::lambda::_1[1]));
bind_func(funcp, 0),
extract_result(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma1pm1", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -447,6 +440,7 @@ void test_spots(T)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F);

View File

@@ -18,10 +18,7 @@
#include <boost/math/special_functions/hermite.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -98,7 +95,6 @@ void expected_results()
template <class T>
void do_test_hermite(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -106,7 +102,6 @@ void do_test_hermite(const T& data, const char* type_name, const char* test_name
pg funcp = boost::math::hermite;
typedef unsigned (*cast_t)(value_type);
cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
@@ -118,17 +113,11 @@ void do_test_hermite(const T& data, const char* type_name, const char* test_name
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func_int1(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::hermite", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -177,6 +166,10 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
boost::math::hermite(51, 915.0);
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif

View File

@@ -12,10 +12,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
@@ -269,7 +266,6 @@ void expected_results()
template <class T>
void do_test_beta(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -286,57 +282,41 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name)
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func(funcp, 0, 1, 2),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name);
funcp = boost::math::betac;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[4]));
bind_func(funcp, 0, 1, 2),
extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::betac", test_name);
funcp = boost::math::ibeta;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[5]));
bind_func(funcp, 0, 1, 2),
extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta", test_name);
funcp = boost::math::ibetac;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[6]));
bind_func(funcp, 0, 1, 2),
extract_result(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::ibeta;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1]),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[5]));
bind_func(funcp, 0, 1, 2),
extract_result(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::ibeta");
}
#endif
std::cout << std::endl;
#endif
}
template <class T>
@@ -516,6 +496,7 @@ void test_spots(T)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifdef TEST_GSL
gsl_set_error_handler_off();
#endif
@@ -534,17 +515,15 @@ int test_main(int, char* [])
#ifdef TEST_DOUBLE
test_beta(0.1, "double");
#endif
#ifdef TEST_LDOUBLE
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#ifdef TEST_LDOUBLE
test_beta(0.1L, "long double");
#endif
#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#ifdef TEST_REAL_CONCEPT
test_beta(boost::math::concepts::real_concept(0.1), "real_concept");
#endif
#endif
#endif
#else
std::cout << "<note>The long double tests have been disabled on this platform "
"either because the long double overloads of the usual math functions are "

View File

@@ -12,10 +12,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_beta_hooks.hpp"
#include "handle_test_result.hpp"
@@ -213,15 +210,12 @@ void test_inverses(const T& data)
template <class T>
void test_inverses2(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(value_type, value_type, value_type);
pg funcp = boost::math::ibeta_inv;
using namespace boost::lambda;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -232,8 +226,8 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
//
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1, 2),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inv", test_name);
//
// test ibetac_inv(T, T, T) against data:
@@ -241,10 +235,9 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::ibetac_inv;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[4]));
bind_func(funcp, 0, 1, 2),
extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inv", test_name);
#endif
}
@@ -309,6 +302,7 @@ void test_spots(T)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
expected_results();
#ifdef TEST_GSL
gsl_set_error_handler_off();

View File

@@ -12,10 +12,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#ifdef TEST_GSL
#include <gsl/gsl_errno.h>
@@ -176,15 +173,12 @@ void test_inverses(const T& data)
template <class T>
void test_inverses2(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(value_type, value_type, value_type);
pg funcp = boost::math::ibeta_inva;
using namespace boost::lambda;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -195,8 +189,8 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
//
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1, 2),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_inva", test_name);
//
// test ibetac_inva(T, T, T) against data:
@@ -204,8 +198,8 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::ibetac_inva;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[4]));
bind_func(funcp, 0, 1, 2),
extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inva", test_name);
//
// test ibeta_invb(T, T, T) against data:
@@ -213,8 +207,8 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::ibeta_invb;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[5]));
bind_func(funcp, 0, 1, 2),
extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta_invb", test_name);
//
// test ibetac_invb(T, T, T) against data:
@@ -222,10 +216,9 @@ void test_inverses2(const T& data, const char* type_name, const char* test_name)
funcp = boost::math::ibetac_invb;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1]), ret<value_type>(_1[2])),
ret<value_type>(_1[6]));
bind_func(funcp, 0, 1, 2),
extract_result(6));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_invb", test_name);
#endif
}
template <class T>

View File

@@ -14,10 +14,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -310,15 +307,12 @@ void expected_results()
template <class T>
void do_test_gamma_2(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::tgamma;
using namespace boost::lambda;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -331,8 +325,8 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
{
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[2]));
bind_func(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name);
//
// test tgamma_lower(T, T) against data:
@@ -340,8 +334,8 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
funcp = boost::math::tgamma_lower;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[4]));
bind_func(funcp, 0, 1),
extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_lower", test_name);
}
//
@@ -350,8 +344,8 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
funcp = boost::math::gamma_q;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q", test_name);
#if defined(TEST_CEPHES) || defined(TEST_GSL)
//
@@ -362,8 +356,8 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
funcp = other::gamma_q;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1),
extract_result(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_q");
}
#endif
@@ -373,8 +367,8 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
funcp = boost::math::gamma_p;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[5]));
bind_func(funcp, 0, 1),
extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p", test_name);
#if defined(TEST_CEPHES) || defined(TEST_GSL)
//
@@ -385,13 +379,12 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
funcp = other::gamma_p;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[5]));
bind_func(funcp, 0, 1),
extract_result(5));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_p");
}
#endif
std::cout << std::endl;
#endif
}
template <class T>
@@ -472,6 +465,7 @@ void test_spots(T)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F);

View File

@@ -12,10 +12,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "test_gamma_hooks.hpp"
#include "handle_test_result.hpp"
@@ -263,15 +260,12 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
template <class T>
void do_test_gamma_inv(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::gamma_p_inv;
using namespace boost::lambda;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -282,8 +276,8 @@ void do_test_gamma_inv(const T& data, const char* type_name, const char* test_na
//
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[2]));
bind_func(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inv", test_name);
//
// test gamma_q_inv(T, T) against data:
@@ -291,10 +285,9 @@ void do_test_gamma_inv(const T& data, const char* type_name, const char* test_na
funcp = boost::math::gamma_q_inv;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inv", test_name);
#endif
}
template <class T>
@@ -371,6 +364,7 @@ void test_spots(T, const char* type_name)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");

View File

@@ -12,10 +12,7 @@
#include <boost/math/constants/constants.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
@@ -189,15 +186,12 @@ void do_test_gamma_2(const T& data, const char* type_name, const char* test_name
template <class T>
void do_test_gamma_inva(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(value_type, value_type);
pg funcp = boost::math::gamma_p_inva;
using namespace boost::lambda;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -208,8 +202,8 @@ void do_test_gamma_inva(const T& data, const char* type_name, const char* test_n
//
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[2]));
bind_func(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_p_inva", test_name);
//
// test gamma_q_inva(T, T) against data:
@@ -217,10 +211,9 @@ void do_test_gamma_inva(const T& data, const char* type_name, const char* test_n
funcp = boost::math::gamma_q_inva;
result = boost::math::tools::test(
data,
bind(funcp, ret<value_type>(_1[0]), ret<value_type>(_1[1])),
ret<value_type>(_1[3]));
bind_func(funcp, 0, 1),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_q_inva", test_name);
#endif
}
template <class T>
@@ -255,6 +248,7 @@ void test_gamma(T, const char* name)
int test_main(int, char* [])
{
expected_results();
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
#ifdef TEST_FLOAT

View File

@@ -9,10 +9,7 @@
#include <boost/math/special_functions/laguerre.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -136,16 +133,12 @@ void expected_results()
template <class T>
void do_test_laguerre2(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(unsigned, value_type);
pg funcp = boost::math::laguerre;
typedef unsigned (*cast_t)(value_type);
cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -156,32 +149,22 @@ void do_test_laguerre2(const T& data, const char* type_name, const char* test_na
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<unsigned>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func_int1(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, x)", test_name);
std::cout << std::endl;
#endif
}
template <class T>
void do_test_laguerre3(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(unsigned, unsigned, value_type);
pg funcp = boost::math::laguerre;
typedef unsigned (*cast_t)(value_type);
cast_t rc = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -192,20 +175,10 @@ void do_test_laguerre3(const T& data, const char* type_name, const char* test_na
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<unsigned>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<unsigned>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func_int2(funcp, 0, 1, 2),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::laguerre(n, m, x)", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -262,6 +235,8 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
test_spots(0.0F, "float");
#endif

View File

@@ -9,10 +9,7 @@
#include <boost/math/special_functions/legendre.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
#include "test_legendre_hooks.hpp"
@@ -192,16 +189,12 @@ void expected_results()
template <class T>
void do_test_legendre_p(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(int, value_type);
pg funcp = boost::math::legendre_p;
typedef int (*cast_t)(value_type);
cast_t rc = &boost::math::tools::real_cast<int, value_type>;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -212,26 +205,16 @@ void do_test_legendre_p(const T& data, const char* type_name, const char* test_n
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func_int1(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_p;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func_int1(funcp, 0, 1),
extract_result(2));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_p");
}
#endif
@@ -244,48 +227,33 @@ void do_test_legendre_p(const T& data, const char* type_name, const char* test_n
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp2,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func_int1(funcp2, 0, 1),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_q", test_name);
#ifdef TEST_OTHER
if(::boost::is_floating_point<value_type>::value){
funcp = other::legendre_q;
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp2,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func_int1(funcp2, 0, 1),
extract_result(3));
print_test_result(result, data[result.worst()], result.worst(), type_name, "other::legendre_q");
}
#endif
std::cout << std::endl;
#endif
}
template <class T>
void do_test_assoc_legendre_p(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(int, int, value_type);
pg funcp = boost::math::legendre_p;
typedef int (*cast_t)(value_type);
cast_t rc = &boost::math::tools::real_cast<int, value_type>;
boost::math::tools::test_result<value_type> result;
std::cout << "Testing " << test_name << " with type " << type_name
@@ -296,20 +264,10 @@ void do_test_assoc_legendre_p(const T& data, const char* type_name, const char*
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<int>(
boost::lambda::bind(
rc,
boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
boost::lambda::ret<value_type>(boost::lambda::_1[2])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
bind_func_int2(funcp, 0, 1, 2),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::legendre_p", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -385,6 +343,7 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -9,10 +9,7 @@
#include <boost/math/special_functions/spherical_harmonic.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
@@ -100,14 +97,11 @@ void expected_results()
template <class T>
void do_test_spherical_harmonic(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
typedef value_type (*pg)(unsigned, int, value_type, value_type);
pg funcp = boost::math::spherical_harmonic_r;
typedef unsigned (*cast_t)(value_type);
cast_t cf = &boost::math::tools::real_cast<unsigned, value_type>;
boost::math::tools::test_result<value_type> result;
@@ -119,18 +113,8 @@ void do_test_spherical_harmonic(const T& data, const char* type_name, const char
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<unsigned>(
boost::lambda::bind(
cf,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<unsigned>(
boost::lambda::bind(
cf,
boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
boost::lambda::ret<value_type>(boost::lambda::_1[2]),
boost::lambda::ret<value_type>(boost::lambda::_1[3])),
boost::lambda::ret<value_type>(boost::lambda::_1[4]));
bind_func_int2(funcp, 0, 1, 2, 3),
extract_result(4));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_r", test_name);
funcp = boost::math::spherical_harmonic_i;
@@ -139,22 +123,11 @@ void do_test_spherical_harmonic(const T& data, const char* type_name, const char
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<unsigned>(
boost::lambda::bind(
cf,
boost::lambda::ret<value_type>(boost::lambda::_1[0]))),
boost::lambda::ret<unsigned>(
boost::lambda::bind(
cf,
boost::lambda::ret<value_type>(boost::lambda::_1[1]))),
boost::lambda::ret<value_type>(boost::lambda::_1[2]),
boost::lambda::ret<value_type>(boost::lambda::_1[3])),
boost::lambda::ret<value_type>(boost::lambda::_1[5]));
bind_func_int2(funcp, 0, 1, 2, 3),
extract_result(5));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::spherical_harmonic_i", test_name);
std::cout << std::endl;
#endif
}
template <class T>
@@ -303,6 +276,7 @@ void test_spots(T, const char* t)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
test_spots(0.0F, "float");
test_spots(0.0, "double");
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -12,10 +12,7 @@
#include <boost/math/tools/stats.hpp>
#include <boost/math/tools/test.hpp>
#include <boost/array.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include "functor.hpp"
#include "handle_test_result.hpp"
@@ -114,10 +111,18 @@ void expected_results()
<< BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
}
struct negative_tgamma_ratio
{
template <class Row>
typename Row::value_type operator()(const Row& row)
{
return boost::math::tgamma_delta_ratio(row[0], -row[1]);
}
};
template <class T>
void do_test_tgamma_delta_ratio(const T& data, const char* type_name, const char* test_name)
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
typedef typename T::value_type row_type;
typedef typename row_type::value_type value_type;
@@ -134,19 +139,14 @@ void do_test_tgamma_delta_ratio(const T& data, const char* type_name, const char
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a, delta)", test_name);
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
-boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[3]));
negative_tgamma_ratio(),
extract_result(3));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a -delta)", test_name);
#endif
}
template <class T>
@@ -168,10 +168,8 @@ void do_test_tgamma_ratio(const T& data, const char* type_name, const char* test
//
result = boost::math::tools::test(
data,
boost::lambda::bind(funcp,
boost::lambda::ret<value_type>(boost::lambda::_1[0]),
boost::lambda::ret<value_type>(boost::lambda::_1[1])),
boost::lambda::ret<value_type>(boost::lambda::_1[2]));
bind_func(funcp, 0, 1),
extract_result(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_ratio(a, b)", test_name);
}
@@ -201,6 +199,7 @@ void test_tgamma_ratio(T, const char* name)
int test_main(int, char* [])
{
BOOST_MATH_CONTROL_FP;
expected_results();
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS