|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64888 - trunk/boost/math/distributions
From: pbristow_at_[hidden]
Date: 2010-08-18 11:23:57
Author: pbristow
Date: 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
New Revision: 64888
URL: http://svn.boost.org/trac/boost/changeset/64888
Log:
warning C4244 suppressed by using static_cast<realType>(0)
Text files modified:
trunk/boost/math/distributions/bernoulli.hpp | 4
trunk/boost/math/distributions/beta.hpp | 4
trunk/boost/math/distributions/binomial.hpp | 2
trunk/boost/math/distributions/chi_squared.hpp | 4
trunk/boost/math/distributions/fisher_f.hpp | 6
trunk/boost/math/distributions/fwd.hpp | 4
trunk/boost/math/distributions/gamma.hpp | 2
trunk/boost/math/distributions/negative_binomial.hpp | 4
trunk/boost/math/distributions/non_central_beta.hpp | 116 +++++++++++++++---------------
trunk/boost/math/distributions/non_central_chi_squared.hpp | 148 ++++++++++++++++++++--------------------
trunk/boost/math/distributions/non_central_f.hpp | 58 +++++++-------
trunk/boost/math/distributions/pareto.hpp | 2
trunk/boost/math/distributions/poisson.hpp | 16 ++--
trunk/boost/math/distributions/rayleigh.hpp | 4
trunk/boost/math/distributions/weibull.hpp | 4
15 files changed, 190 insertions(+), 188 deletions(-)
Modified: trunk/boost/math/distributions/bernoulli.hpp
==============================================================================
--- trunk/boost/math/distributions/bernoulli.hpp (original)
+++ trunk/boost/math/distributions/bernoulli.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -119,14 +119,14 @@
inline const std::pair<RealType, RealType> range(const bernoulli_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k = {0, 1}.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const bernoulli_distribution<RealType, Policy>& /* dist */)
{ // Range of supported values for random variable k = {0, 1}.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/beta.hpp
==============================================================================
--- trunk/boost/math/distributions/beta.hpp (original)
+++ trunk/boost/math/distributions/beta.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -279,14 +279,14 @@
inline const std::pair<RealType, RealType> range(const beta_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const beta_distribution<RealType, Policy>& /* dist */)
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/binomial.hpp
==============================================================================
--- trunk/boost/math/distributions/binomial.hpp (original)
+++ trunk/boost/math/distributions/binomial.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -421,7 +421,7 @@
const std::pair<RealType, RealType> support(const binomial_distribution<RealType, Policy>& dist)
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
- return std::pair<RealType, RealType>(0, dist.trials());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), dist.trials());
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/chi_squared.hpp
==============================================================================
--- trunk/boost/math/distributions/chi_squared.hpp (original)
+++ trunk/boost/math/distributions/chi_squared.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -59,14 +59,14 @@
inline const std::pair<RealType, RealType> range(const chi_squared_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // 0 to + infinity.
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // 0 to + infinity.
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const chi_squared_distribution<RealType, Policy>& /*dist*/)
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
- return std::pair<RealType, RealType>(0, tools::max_value<RealType>()); // 0 to + infinity.
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), tools::max_value<RealType>()); // 0 to + infinity.
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/fisher_f.hpp
==============================================================================
--- trunk/boost/math/distributions/fisher_f.hpp (original)
+++ trunk/boost/math/distributions/fisher_f.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -58,7 +58,7 @@
inline const std::pair<RealType, RealType> range(const fisher_f_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -66,7 +66,7 @@
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -177,7 +177,7 @@
function, p, &error_result, Policy()))
return error_result;
- // With optimizations turned on, gcc wrongly warns about y being used
+ // With optimizations turned on, gcc wrongly warns about y being used
// uninitializated unless we initialize it to something:
RealType x, y(0);
Modified: trunk/boost/math/distributions/fwd.hpp
==============================================================================
--- trunk/boost/math/distributions/fwd.hpp (original)
+++ trunk/boost/math/distributions/fwd.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -1,4 +1,6 @@
-// Copyright Paul A. Bristow 2007.
+// fwd.hpp Forward declarations of Boost.Math distributions.
+
+// Copyright Paul A. Bristow 2007, 2010.
// Copyright John Maddock 2007.
// Use, modification and distribution are subject to the
Modified: trunk/boost/math/distributions/gamma.hpp
==============================================================================
--- trunk/boost/math/distributions/gamma.hpp (original)
+++ trunk/boost/math/distributions/gamma.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -103,7 +103,7 @@
inline const std::pair<RealType, RealType> range(const gamma_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/negative_binomial.hpp
==============================================================================
--- trunk/boost/math/distributions/negative_binomial.hpp (original)
+++ trunk/boost/math/distributions/negative_binomial.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -260,7 +260,7 @@
inline const std::pair<RealType, RealType> range(const negative_binomial_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // max_integer?
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // max_integer?
}
template <class RealType, class Policy>
@@ -268,7 +268,7 @@
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // max_integer?
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // max_integer?
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/non_central_beta.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_beta.hpp (original)
+++ trunk/boost/math/distributions/non_central_beta.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -54,7 +54,7 @@
// recurance term:
T xterm;
// Starting beta term:
- T beta = x < y
+ T beta = x < y
? detail::ibeta_imp(T(a + k), b, x, pol, false, true, &xterm)
: detail::ibeta_imp(b, T(a + k), y, pol, true, true, &xterm);
@@ -100,7 +100,7 @@
if(static_cast<boost::uintmax_t>(count + i - k) > max_iter)
{
return policies::raise_evaluation_error(
- "cdf(non_central_beta_distribution<%1%>, %1%)",
+ "cdf(non_central_beta_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
}
}
@@ -164,7 +164,7 @@
if(static_cast<boost::uintmax_t>(i - k) > max_iter)
{
return policies::raise_evaluation_error(
- "cdf(non_central_beta_distribution<%1%>, %1%)",
+ "cdf(non_central_beta_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
}
last_term = term;
@@ -180,7 +180,7 @@
if(static_cast<boost::uintmax_t>(count + k - i) > max_iter)
{
return policies::raise_evaluation_error(
- "cdf(non_central_beta_distribution<%1%>, %1%)",
+ "cdf(non_central_beta_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
}
pois *= i / l2;
@@ -195,9 +195,9 @@
{
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -216,30 +216,30 @@
{
// Complement is the smaller of the two:
result = detail::non_central_beta_q(
- static_cast<value_type>(a),
- static_cast<value_type>(b),
- static_cast<value_type>(l),
- static_cast<value_type>(x),
- static_cast<value_type>(y),
- forwarding_policy(),
+ static_cast<value_type>(a),
+ static_cast<value_type>(b),
+ static_cast<value_type>(l),
+ static_cast<value_type>(x),
+ static_cast<value_type>(y),
+ forwarding_policy(),
static_cast<value_type>(invert ? 0 : -1));
invert = !invert;
}
else
{
result = detail::non_central_beta_p(
- static_cast<value_type>(a),
- static_cast<value_type>(b),
- static_cast<value_type>(l),
- static_cast<value_type>(x),
- static_cast<value_type>(y),
+ static_cast<value_type>(a),
+ static_cast<value_type>(b),
+ static_cast<value_type>(l),
+ static_cast<value_type>(x),
+ static_cast<value_type>(y),
forwarding_policy(),
static_cast<value_type>(invert ? -1 : 0));
}
if(invert)
result = -result;
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
"boost::math::non_central_beta_cdf<%1%>(%1%, %1%, %1%)");
}
@@ -328,7 +328,7 @@
// Escape route just in case the answer is zero!
max_iter -= count;
max_iter += 1;
- return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0));
+ return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0));
}
if(count == 0)
{
@@ -355,13 +355,13 @@
max_iter -= count;
max_iter += 1;
std::pair<T, T> r = toms748_solve(
- f,
- (a < 0 ? b : a),
- (a < 0 ? a : b),
- (a < 0 ? fb : fa),
- (a < 0 ? fa : fb),
- tol,
- count,
+ f,
+ (a < 0 ? b : a),
+ (a < 0 ? a : b),
+ (a < 0 ? fb : fa),
+ (a < 0 ? fa : fb),
+ tol,
+ count,
pol);
max_iter += count;
BOOST_MATH_INSTRUMENT_CODE("max_iter = " << max_iter << " count = " << count);
@@ -374,9 +374,9 @@
static const char* function = "quantile(non_central_beta_distribution<%1%>, %1%)";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -391,7 +391,7 @@
!beta_detail::check_beta(
function,
b, &r, Policy())
- ||
+ ||
!detail::check_non_centrality(
function,
l,
@@ -420,9 +420,9 @@
value_type mean = 1 - (b / c) * (1 + l / (2 * c * c));
/*
//
- // Calculate a normal approximation to the quantile,
+ // Calculate a normal approximation to the quantile,
// uses mean and variance approximations from:
- // Algorithm AS 310:
+ // Algorithm AS 310:
// Computing the Non-Central Beta Distribution Function
// R. Chattamvelli; R. Shanmugam
// Applied Statistics, Vol. 46, No. 1. (1997), pp. 146-156.
@@ -442,20 +442,20 @@
value_type alpha2 = alpha * alpha;
value_type eta = (2 * alpha + 1) * (2 * alpha + 1) + 1;
value_type H = 3 * alpha2 + 5 * alpha + 2;
- value_type F = alpha2 * (alpha + 1) + H * delta
+ value_type F = alpha2 * (alpha + 1) + H * delta
+ (2 * alpha + 4) * delta2 + delta3;
value_type P = (3 * alpha + 1) * (9 * alpha + 17)
+ 2 * alpha * (3 * alpha + 2) * (3 * alpha + 4) + 15;
value_type Q = 54 * alpha2 + 162 * alpha + 130;
value_type R = 6 * (6 * alpha + 11);
- value_type D = delta
+ value_type D = delta
* (H * H + 2 * P * delta + Q * delta2 + R * delta3 + 9 * delta4);
value_type variance = (b / G)
* (1 + delta * (l * l + 3 * l + eta) / (G * G))
- (b * b / F) * (1 + D / (F * F));
value_type sd = sqrt(variance);
- value_type guess = comp
+ value_type guess = comp
? quantile(complement(normal_distribution<RealType, Policy>(static_cast<RealType>(mean), static_cast<RealType>(sd)), p))
: quantile(normal_distribution<RealType, Policy>(static_cast<RealType>(mean), static_cast<RealType>(sd)), p);
@@ -470,9 +470,9 @@
tools::eps_tolerance<value_type> tol(policies::digits<RealType, Policy>());
boost::uintmax_t max_iter = policies::get_max_root_iterations<Policy>();
- std::pair<value_type, value_type> ir
+ std::pair<value_type, value_type> ir
= bracket_and_solve_root_01(
- f, guess, value_type(2.5), true, tol,
+ f, guess, value_type(2.5), true, tol,
max_iter, Policy());
value_type result = ir.first + (ir.second - ir.first) / 2;
@@ -480,13 +480,13 @@
{
return policies::raise_evaluation_error<RealType>(function, "Unable to locate solution in a reasonable time:"
" either there is no answer to quantile of the non central beta distribution"
- " or the answer is infinite. Current best guess is %1%",
+ " or the answer is infinite. Current best guess is %1%",
policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function), Policy());
}
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
@@ -509,7 +509,7 @@
// Starting Poisson weight:
T pois = gamma_p_derivative(T(k+1), l2, pol);
// Starting beta term:
- T beta = x < y ?
+ T beta = x < y ?
ibeta_derivative(a + k, b, x, pol)
: ibeta_derivative(b, a + k, y, pol);
T sum = 0;
@@ -546,7 +546,7 @@
if(static_cast<boost::uintmax_t>(count + i - k) > max_iter)
{
return policies::raise_evaluation_error(
- "pdf(non_central_beta_distribution<%1%>, %1%)",
+ "pdf(non_central_beta_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
}
}
@@ -560,9 +560,9 @@
static const char* function = "pdf(non_central_beta_distribution<%1%>, %1%)";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -577,7 +577,7 @@
!beta_detail::check_beta(
function,
b, &r, Policy())
- ||
+ ||
!detail::check_non_centrality(
function,
l,
@@ -608,7 +608,7 @@
typedef Policy policy_type;
non_central_beta_distribution(RealType a_, RealType b_, RealType lambda) : a(a_), b(b_), ncp(lambda)
- {
+ {
const char* function = "boost::math::non_central_beta_distribution<%1%>::non_central_beta_distribution(%1%,%1%)";
RealType r;
beta_detail::check_alpha(
@@ -651,7 +651,7 @@
inline const std::pair<RealType, RealType> range(const non_central_beta_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
@@ -659,7 +659,7 @@
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, 1);
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), static_cast<RealType>(1));
}
template <class RealType, class Policy>
@@ -678,7 +678,7 @@
!beta_detail::check_beta(
function,
b, &r, Policy())
- ||
+ ||
!detail::check_non_centrality(
function,
l,
@@ -688,8 +688,8 @@
RealType c = a + b + l / 2;
RealType mean = 1 - (b / c) * (1 + l / (2 * c * c));
return detail::generic_find_mode_01(
- dist,
- mean,
+ dist,
+ mean,
function);
}
@@ -702,7 +702,7 @@
//
template <class RealType, class Policy>
inline RealType mean(const non_central_beta_distribution<RealType, Policy>& dist)
- {
+ {
// TODO
return 0;
} // mean
@@ -728,7 +728,7 @@
template <class RealType, class Policy>
inline RealType kurtosis_excess(const non_central_beta_distribution<RealType, Policy>& dist)
- {
+ {
const char* function = "boost::math::non_central_beta_distribution<%1%>::kurtosis_excess()";
// TODO
return 0;
@@ -748,7 +748,7 @@
template <class RealType, class Policy>
RealType cdf(const non_central_beta_distribution<RealType, Policy>& dist, const RealType& x)
- {
+ {
const char* function = "boost::math::non_central_beta_distribution<%1%>::cdf(%1%)";
RealType a = dist.alpha();
RealType b = dist.beta();
@@ -761,7 +761,7 @@
!beta_detail::check_beta(
function,
b, &r, Policy())
- ||
+ ||
!detail::check_non_centrality(
function,
l,
@@ -798,7 +798,7 @@
!beta_detail::check_beta(
function,
b, &r, Policy())
- ||
+ ||
!detail::check_non_centrality(
function,
l,
Modified: trunk/boost/math/distributions/non_central_chi_squared.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_chi_squared.hpp (original)
+++ trunk/boost/math/distributions/non_central_chi_squared.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -102,13 +102,13 @@
//Error check:
if(static_cast<boost::uintmax_t>(i-k) >= max_iter)
policies::raise_evaluation_error(
- "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
+ "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
//
// Now backwards iteration: the gamma
// function recurrences are unstable in this
// direction, we rely on the terms deminishing in size
- // faster than we introduce cancellation errors.
+ // faster than we introduce cancellation errors.
// For this reason it's very important that we start
// *before* the largest term so that backwards iteration
// is strictly converging.
@@ -133,7 +133,7 @@
//
// This is an implementation of:
//
- // Algorithm AS 275:
+ // Algorithm AS 275:
// Computing the Non-Central #2 Distribution Function
// Cherng G. Ding
// Applied Statistics, Vol. 41, No. 2. (1992), pp. 478-482.
@@ -176,7 +176,7 @@
//Error check:
if(static_cast<boost::uintmax_t>(i) >= max_iter)
policies::raise_evaluation_error(
- "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
+ "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
return sum;
}
@@ -240,7 +240,7 @@
// Backwards recursion first, this is the stable
// direction for gamma function recurrences:
//
- while(i <= k)
+ while(i <= k)
{
xtermb *= (a - i + 1) / x;
gamkb += xtermb;
@@ -275,7 +275,7 @@
//Error check:
if(static_cast<boost::uintmax_t>(i) >= max_iter)
policies::raise_evaluation_error(
- "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
+ "cdf(non_central_chi_squared_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
return sum;
@@ -306,7 +306,7 @@
break;
if(static_cast<boost::uintmax_t>(i - k) >= max_iter)
return policies::raise_evaluation_error(
- "pdf(non_central_chi_squared_distribution<%1%>, %1%)",
+ "pdf(non_central_chi_squared_distribution<%1%>, %1%)",
"Series did not converge, closest value was %1%", sum, pol);
pois *= l2 * x2 / ((i + 1) * (n2 + i));
}
@@ -325,9 +325,9 @@
{
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -339,10 +339,10 @@
{
// Complement is the smaller of the two:
result = detail::non_central_chi_square_q(
- static_cast<value_type>(x),
- static_cast<value_type>(k),
- static_cast<value_type>(l),
- forwarding_policy(),
+ static_cast<value_type>(x),
+ static_cast<value_type>(k),
+ static_cast<value_type>(l),
+ forwarding_policy(),
static_cast<value_type>(invert ? 0 : -1));
invert = !invert;
}
@@ -351,9 +351,9 @@
// For small values of the non-centrality parameter
// we can use Ding's method:
result = detail::non_central_chi_square_p_ding(
- static_cast<value_type>(x),
- static_cast<value_type>(k),
- static_cast<value_type>(l),
+ static_cast<value_type>(x),
+ static_cast<value_type>(k),
+ static_cast<value_type>(l),
forwarding_policy(),
static_cast<value_type>(invert ? -1 : 0));
}
@@ -365,16 +365,16 @@
// may return zero when the result is in fact
// finite, use Krishnamoorthy's method instead:
result = detail::non_central_chi_square_p(
- static_cast<value_type>(x),
- static_cast<value_type>(k),
- static_cast<value_type>(l),
+ static_cast<value_type>(x),
+ static_cast<value_type>(k),
+ static_cast<value_type>(l),
forwarding_policy(),
static_cast<value_type>(invert ? -1 : 0));
}
if(invert)
result = -result;
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
"boost::math::non_central_chi_squared_cdf<%1%>(%1%, %1%, %1%)");
}
@@ -403,9 +403,9 @@
static const char* function = "quantile(non_central_chi_squared_distribution<%1%>, %1%)";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -442,13 +442,13 @@
guess = tools::min_value<value_type>();
value_type result = detail::generic_quantile(
- non_central_chi_squared_distribution<value_type, forwarding_policy>(k, l),
- p,
- guess,
- comp,
+ non_central_chi_squared_distribution<value_type, forwarding_policy>(k, l),
+ p,
+ guess,
+ comp,
function);
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
@@ -459,9 +459,9 @@
static const char* function = "pdf(non_central_chi_squared_distribution<%1%>, %1%)";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -510,7 +510,7 @@
}
}
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- r,
+ r,
function);
}
@@ -545,8 +545,8 @@
//
// Can't a thing if one of p and q is zero:
//
- return policies::raise_evaluation_error<RealType>(function,
- "Can't find degrees of freedom when the probability is 0 or 1, only possible answer is %1%",
+ return policies::raise_evaluation_error<RealType>(function,
+ "Can't find degrees of freedom when the probability is 0 or 1, only possible answer is %1%",
RealType(std::numeric_limits<RealType>::quiet_NaN()), Policy());
}
degrees_of_freedom_finder<RealType, Policy> f(lam, x, p < q ? p : q, p < q ? false : true);
@@ -601,8 +601,8 @@
//
// Can't do a thing if one of p and q is zero:
//
- return policies::raise_evaluation_error<RealType>(function,
- "Can't find non centrality parameter when the probability is 0 or 1, only possible answer is %1%",
+ return policies::raise_evaluation_error<RealType>(function,
+ "Can't find non centrality parameter when the probability is 0 or 1, only possible answer is %1%",
RealType(std::numeric_limits<RealType>::quiet_NaN()), Policy());
}
non_centrality_finder<RealType, Policy> f(v, x, p < q ? p : q, p < q ? false : true);
@@ -636,7 +636,7 @@
typedef Policy policy_type;
non_central_chi_squared_distribution(RealType df_, RealType lambda) : df(df_), ncp(lambda)
- {
+ {
const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::non_central_chi_squared_distribution(%1%,%1%)";
RealType r;
detail::check_df(
@@ -662,19 +662,19 @@
const char* function = "non_central_chi_squared<%1%>::find_degrees_of_freedom";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
value_type result = detail::find_degrees_of_freedom(
- static_cast<value_type>(lam),
- static_cast<value_type>(x),
- static_cast<value_type>(p),
- static_cast<value_type>(1-p),
+ static_cast<value_type>(lam),
+ static_cast<value_type>(x),
+ static_cast<value_type>(p),
+ static_cast<value_type>(1-p),
forwarding_policy());
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
template <class A, class B, class C>
@@ -683,19 +683,19 @@
const char* function = "non_central_chi_squared<%1%>::find_degrees_of_freedom";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
value_type result = detail::find_degrees_of_freedom(
- static_cast<value_type>(c.dist),
- static_cast<value_type>(c.param1),
- static_cast<value_type>(1-c.param2),
- static_cast<value_type>(c.param2),
+ static_cast<value_type>(c.dist),
+ static_cast<value_type>(c.param1),
+ static_cast<value_type>(1-c.param2),
+ static_cast<value_type>(c.param2),
forwarding_policy());
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
static RealType find_non_centrality(RealType v, RealType x, RealType p)
@@ -703,19 +703,19 @@
const char* function = "non_central_chi_squared<%1%>::find_non_centrality";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
value_type result = detail::find_non_centrality(
- static_cast<value_type>(v),
- static_cast<value_type>(x),
- static_cast<value_type>(p),
- static_cast<value_type>(1-p),
+ static_cast<value_type>(v),
+ static_cast<value_type>(x),
+ static_cast<value_type>(p),
+ static_cast<value_type>(1-p),
forwarding_policy());
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
template <class A, class B, class C>
@@ -724,19 +724,19 @@
const char* function = "non_central_chi_squared<%1%>::find_non_centrality";
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
value_type result = detail::find_non_centrality(
- static_cast<value_type>(c.dist),
- static_cast<value_type>(c.param1),
- static_cast<value_type>(1-c.param2),
- static_cast<value_type>(c.param2),
+ static_cast<value_type>(c.dist),
+ static_cast<value_type>(c.param1),
+ static_cast<value_type>(1-c.param2),
+ static_cast<value_type>(c.param2),
forwarding_policy());
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
- result,
+ result,
function);
}
private:
@@ -753,7 +753,7 @@
inline const std::pair<RealType, RealType> range(const non_central_chi_squared_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // Max integer?
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // Max integer?
}
template <class RealType, class Policy>
@@ -761,7 +761,7 @@
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -851,7 +851,7 @@
template <class RealType, class Policy>
inline RealType kurtosis_excess(const non_central_chi_squared_distribution<RealType, Policy>& dist)
- {
+ {
const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::kurtosis_excess()";
RealType k = dist.degrees_of_freedom();
RealType l = dist.non_centrality();
@@ -883,7 +883,7 @@
template <class RealType, class Policy>
RealType cdf(const non_central_chi_squared_distribution<RealType, Policy>& dist, const RealType& x)
- {
+ {
const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::cdf(%1%)";
RealType k = dist.degrees_of_freedom();
RealType l = dist.non_centrality();
Modified: trunk/boost/math/distributions/non_central_f.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_f.hpp (original)
+++ trunk/boost/math/distributions/non_central_f.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -26,7 +26,7 @@
typedef Policy policy_type;
non_central_f_distribution(RealType v1_, RealType v2_, RealType lambda) : v1(v1_), v2(v2_), ncp(lambda)
- {
+ {
const char* function = "boost::math::non_central_f_distribution<%1%>::non_central_f_distribution(%1%,%1%)";
RealType r;
detail::check_df(
@@ -69,7 +69,7 @@
inline const std::pair<RealType, RealType> range(const non_central_f_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -77,12 +77,12 @@
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
inline RealType mean(const non_central_f_distribution<RealType, Policy>& dist)
- {
+ {
const char* function = "mean(non_central_f_distribution<%1%> const&)";
RealType v1 = dist.degrees_of_freedom1();
RealType v2 = dist.degrees_of_freedom2();
@@ -104,8 +104,8 @@
return r;
if(v2 <= 2)
return policies::raise_domain_error(
- function,
- "Second degrees of freedom parameter was %1%, but must be > 2 !",
+ function,
+ "Second degrees of freedom parameter was %1%, but must be > 2 !",
v2, Policy());
return v2 * (v1 + l) / (v1 * (v2 - 2));
} // mean
@@ -134,8 +134,8 @@
Policy()))
return r;
return detail::generic_find_mode(
- dist,
- m * (n + l) / (n * (m - 2)),
+ dist,
+ m * (n + l) / (n * (m - 2)),
function);
}
@@ -163,8 +163,8 @@
return r;
if(m <= 4)
return policies::raise_domain_error(
- function,
- "Second degrees of freedom parameter was %1%, but must be > 4 !",
+ function,
+ "Second degrees of freedom parameter was %1%, but must be > 4 !",
m, Policy());
RealType result = 2 * m * m * ((n + l) * (n + l)
+ (m - 2) * (n + 2 * l));
@@ -200,8 +200,8 @@
return r;
if(m <= 6)
return policies::raise_domain_error(
- function,
- "Second degrees of freedom parameter was %1%, but must be > 6 !",
+ function,
+ "Second degrees of freedom parameter was %1%, but must be > 6 !",
m, Policy());
RealType result = 2 * constants::root_two<RealType>();
result *= sqrt(m - 4);
@@ -214,7 +214,7 @@
template <class RealType, class Policy>
inline RealType kurtosis_excess(const non_central_f_distribution<RealType, Policy>& dist)
- {
+ {
const char* function = "kurtosis_excess(non_central_f_distribution<%1%> const&)";
BOOST_MATH_STD_USING
RealType n = dist.degrees_of_freedom1();
@@ -237,18 +237,18 @@
return r;
if(m <= 8)
return policies::raise_domain_error(
- function,
- "Second degrees of freedom parameter was %1%, but must be > 8 !",
+ function,
+ "Second degrees of freedom parameter was %1%, but must be > 8 !",
m, Policy());
RealType l2 = l * l;
RealType l3 = l2 * l;
RealType l4 = l2 * l2;
RealType result = (3 * (m - 4) * (n * (m + n - 2)
- * (4 * (m - 2) * (m - 2)
+ * (4 * (m - 2) * (m - 2)
+ (m - 2) * (m + 10) * n
+ (10 + m) * n * n)
+ 4 * (m + n - 2) * (4 * (m - 2) * (m - 2)
- + (m - 2) * (10 + m) * n
+ + (m - 2) * (10 + m) * n
+ (10 + m) * n * n) * l + 2 * (10 + m)
* (m + n - 2) * (2 * m + 3 * n - 4) * l2
+ 4 * (10 + m) * (-2 + m + n) * l3
@@ -270,9 +270,9 @@
{ // Probability Density/Mass Function.
typedef typename policies::evaluation<RealType, Policy>::type value_type;
typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
+ Policy,
+ policies::promote_float<false>,
+ policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -287,7 +287,7 @@
template <class RealType, class Policy>
RealType cdf(const non_central_f_distribution<RealType, Policy>& dist, const RealType& x)
- {
+ {
const char* function = "cdf(const non_central_f_distribution<%1%>&, %1%)";
RealType r;
if(!detail::check_df(
@@ -304,7 +304,7 @@
&r,
Policy()))
return r;
-
+
if((x < 0) || !(boost::math::isfinite)(x))
{
return policies::raise_domain_error<RealType>(
@@ -321,7 +321,7 @@
// non-central beta cdf routine, this ensures accuracy
// even when we compute x to be ~ 1:
//
- r = detail::non_central_beta_cdf(c, cp, alpha, beta,
+ r = detail::non_central_beta_cdf(c, cp, alpha, beta,
dist.non_centrality(), false, Policy());
return r;
} // cdf
@@ -345,7 +345,7 @@
&r,
Policy()))
return r;
-
+
if((c.param < 0) || !(boost::math::isfinite)(c.param))
{
return policies::raise_domain_error<RealType>(
@@ -362,7 +362,7 @@
// non-central beta cdf routine, this ensures accuracy
// even when we compute x to be ~ 1:
//
- r = detail::non_central_beta_cdf(x, cx, alpha, beta,
+ r = detail::non_central_beta_cdf(x, cx, alpha, beta,
c.dist.non_centrality(), true, Policy());
return r;
} // ccdf
@@ -375,8 +375,8 @@
RealType x = quantile(boost::math::non_central_beta_distribution<RealType, Policy>(alpha, beta, dist.non_centrality()), p);
if(x == 1)
return policies::raise_overflow_error<RealType>(
- "quantile(const non_central_f_distribution<%1%>&, %1%)",
- "Result of non central F quantile is too large to represent.",
+ "quantile(const non_central_f_distribution<%1%>&, %1%)",
+ "Result of non central F quantile is too large to represent.",
Policy());
return (x / (1 - x)) * (dist.degrees_of_freedom2() / dist.degrees_of_freedom1());
} // quantile
@@ -389,8 +389,8 @@
RealType x = quantile(complement(boost::math::non_central_beta_distribution<RealType, Policy>(alpha, beta, c.dist.non_centrality()), c.param));
if(x == 1)
return policies::raise_overflow_error<RealType>(
- "quantile(complement(const non_central_f_distribution<%1%>&, %1%))",
- "Result of non central F quantile is too large to represent.",
+ "quantile(complement(const non_central_f_distribution<%1%>&, %1%))",
+ "Result of non central F quantile is too large to represent.",
Policy());
return (x / (1 - x)) * (c.dist.degrees_of_freedom2() / c.dist.degrees_of_freedom1());
} // quantile complement.
Modified: trunk/boost/math/distributions/pareto.hpp
==============================================================================
--- trunk/boost/math/distributions/pareto.hpp (original)
+++ trunk/boost/math/distributions/pareto.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -164,7 +164,7 @@
inline const std::pair<RealType, RealType> range(const pareto_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // scale zero to + infinity.
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // scale zero to + infinity.
} // range
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/poisson.hpp
==============================================================================
--- trunk/boost/math/distributions/poisson.hpp (original)
+++ trunk/boost/math/distributions/poisson.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -54,7 +54,7 @@
{
namespace detail{
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -64,7 +64,7 @@
const policies::discrete_quantile<policies::integer_round_nearest>&,
boost::uintmax_t& max_iter);
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -74,7 +74,7 @@
const policies::discrete_quantile<policies::integer_round_up>&,
boost::uintmax_t& max_iter);
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -84,7 +84,7 @@
const policies::discrete_quantile<policies::integer_round_down>&,
boost::uintmax_t& max_iter);
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -94,7 +94,7 @@
const policies::discrete_quantile<policies::integer_round_outwards>&,
boost::uintmax_t& max_iter);
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -104,7 +104,7 @@
const policies::discrete_quantile<policies::integer_round_inwards>&,
boost::uintmax_t& max_iter);
template <class Dist>
- inline typename Dist::value_type
+ inline typename Dist::value_type
inverse_discrete_quantile(
const Dist& dist,
const typename Dist::value_type& p,
@@ -235,7 +235,7 @@
inline const std::pair<RealType, RealType> range(const poisson_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable k.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>()); // Max integer?
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // Max integer?
}
template <class RealType, class Policy>
@@ -243,7 +243,7 @@
{ // Range of supported values for random variable k.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
Modified: trunk/boost/math/distributions/rayleigh.hpp
==============================================================================
--- trunk/boost/math/distributions/rayleigh.hpp (original)
+++ trunk/boost/math/distributions/rayleigh.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -89,7 +89,7 @@
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>((0), max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -109,7 +109,7 @@
return result;
}
RealType sigmasqr = sigma * sigma;
- result = x * (exp(-(x * x) / ( 2 * sigmasqr))) / sigmasqr;
+ result = x * (exp(-(x * x) / ( 2 * sigmasqr))) / sigmasqr;
return result;
} // pdf
Modified: trunk/boost/math/distributions/weibull.hpp
==============================================================================
--- trunk/boost/math/distributions/weibull.hpp (original)
+++ trunk/boost/math/distributions/weibull.hpp 2010-08-18 11:23:37 EDT (Wed, 18 Aug 2010)
@@ -103,7 +103,7 @@
inline const std::pair<RealType, RealType> range(const weibull_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(0, max_value<RealType>());
+ return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
@@ -133,7 +133,7 @@
return result;
if(x == 0)
- { // Special case, but x == min, pdf = 1 for shape = 1,
+ { // Special case, but x == min, pdf = 1 for shape = 1,
return 0;
}
result = exp(-pow(x / scale, shape));
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk