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

Fixed typo in test result message.

Added ibeta inverse tests.


[SVN r3153]
This commit is contained in:
John Maddock
2006-08-16 12:06:10 +00:00
parent ef43e16e47
commit a147f2aa58
3 changed files with 1287 additions and 5 deletions

View File

@@ -143,7 +143,7 @@ void handle_test_result(const boost::math::tools::test_result<T>& result,
}
if(bounds.second < mean_error_found)
{
std::cerr << "Peak error greater than expected value of " << bounds.second << std::endl;
std::cerr << "Mean error greater than expected value of " << bounds.second << std::endl;
BOOST_CHECK(bounds.second >= mean_error_found);
}
}

1215
test/ibeta_inv_data.ipp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -51,18 +51,45 @@ void expected_results()
// Define the max and mean errors expected for
// various compilers and platforms.
//
// Note that permitted max errors are really pretty high
// at around 10000eps. The reason for this is that even
// if the forward function is off by 1eps, it's enough to
// throw out the inverse by ~7000eps. In other words the
// forward function may flatline, so that many x-values
// all map to about the same p. Trying to invert in this
// region is almost futile.
//
const char* largest_type;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
if(boost::math::tools::digits<double>() == boost::math::tools::digits<long double>())
{
largest_type = "(long\\s+)?double";
}
else
{
largest_type = "long double";
}
#else
largest_type = "(long\\s+)?double";
#endif
//
// Catch all cases come last:
//
// TODO!!!!
add_expected_result(
".*", // compiler
".*", // stdlib
".*", // platform
".*", // test type(s)
"Inverse Erf.*", // test data group
"boost::math::erfc?_inv", 14, 4); // test function
largest_type, // test type(s)
".*", // test data group
".*", 10000, 1000); // test function
add_expected_result(
".*", // compiler
".*", // stdlib
".*", // platform
"real_concept", // test type(s)
".*", // test data group
".*", 500000, 500000); // test function
//
// Finish off by printing out the compiler/stdlib/platform names,
@@ -113,6 +140,42 @@ void test_inverses(const T& data)
}
}
template <class T>
void test_inverses2(const T& data, const char* type_name, const char* test_name)
{
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
<< "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
//
// test ibeta_inv(T, T, T) against data:
//
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]));
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:
//
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]));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac_inv", test_name);
}
template <class T>
void test_beta(T, const char* name)
{
@@ -133,6 +196,10 @@ void test_beta(T, const char* name)
# include "ibeta_large_data.ipp"
test_inverses(ibeta_large_data);
# include "ibeta_inv_data.ipp"
test_inverses2(ibeta_inv_data, name, "Inverse incomplete beta");
}
template <class T>