本文整理汇总了C++中chi_squared_distribution类的典型用法代码示例。如果您正苦于以下问题:C++ chi_squared_distribution类的具体用法?C++ chi_squared_distribution怎么用?C++ chi_squared_distribution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了chi_squared_distribution类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: quantile
inline RealType quantile(const chi_squared_distribution<RealType, Policy>& dist, const RealType& p)
{
RealType degrees_of_freedom = dist.degrees_of_freedom();
static const char* function = "boost::math::quantile(const chi_squared_distribution<%1%>&, %1%)";
// Error check:
RealType error_result;
if(false == detail::check_df(
function, degrees_of_freedom, &error_result, Policy())
&& detail::check_probability(
function, p, &error_result, Policy()))
return error_result;
return 2 * boost::math::gamma_p_inv(degrees_of_freedom / 2, p, Policy());
} // quantile
开发者ID:Alexander--,项目名称:Wesnoth-1.8-for-Android,代码行数:14,代码来源:chi_squared.hpp
示例2: cdf
inline RealType cdf(const chi_squared_distribution<RealType, Policy>& dist, const RealType& chi_square)
{
RealType degrees_of_freedom = dist.degrees_of_freedom();
// Error check:
RealType error_result;
static const char* function = "lslboost::math::cdf(const chi_squared_distribution<%1%>&, %1%)";
if(false == detail::check_df(
function, degrees_of_freedom, &error_result, Policy()))
return error_result;
if((chi_square < 0) || !(lslboost::math::isfinite)(chi_square))
{
return policies::raise_domain_error<RealType>(
function, "Chi Square parameter was %1%, but must be > 0 !", chi_square, Policy());
}
return lslboost::math::gamma_p(degrees_of_freedom / 2, chi_square / 2, Policy());
} // cdf
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:19,代码来源:chi_squared.hpp
示例3: pdf
RealType pdf(const chi_squared_distribution<RealType, Policy>& dist, const RealType& chi_square)
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType degrees_of_freedom = dist.degrees_of_freedom();
// Error check:
RealType error_result;
static const char* function = "lslboost::math::pdf(const chi_squared_distribution<%1%>&, %1%)";
if(false == detail::check_df(
function, degrees_of_freedom, &error_result, Policy()))
return error_result;
if((chi_square < 0) || !(lslboost::math::isfinite)(chi_square))
{
return policies::raise_domain_error<RealType>(
function, "Chi Square parameter was %1%, but must be > 0 !", chi_square, Policy());
}
if(chi_square == 0)
{
// Handle special cases:
if(degrees_of_freedom < 2)
{
return policies::raise_overflow_error<RealType>(
function, 0, Policy());
}
else if(degrees_of_freedom == 2)
{
return 0.5f;
}
else
{
return 0;
}
}
return gamma_p_derivative(degrees_of_freedom / 2, chi_square / 2, Policy()) / 2;
} // pdf
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:39,代码来源:chi_squared.hpp
示例4: mode
inline RealType mode(const chi_squared_distribution<RealType, Policy>& dist)
{
RealType df = dist.degrees_of_freedom();
static const char* function = "lslboost::math::mode(const chi_squared_distribution<%1%>&)";
// Most sources only define mode for df >= 2,
// but for 0 <= df <= 2, the pdf maximum actually occurs at random variate = 0;
// So one could extend the definition of mode thus:
//if(df < 0)
//{
// return policies::raise_domain_error<RealType>(
// function,
// "Chi-Squared distribution only has a mode for degrees of freedom >= 0, but got degrees of freedom = %1%.",
// df, Policy());
//}
//return (df <= 2) ? 0 : df - 2;
if(df < 2)
return policies::raise_domain_error<RealType>(
function,
"Chi-Squared distribution only has a mode for degrees of freedom >= 2, but got degrees of freedom = %1%.",
df, Policy());
return df - 2;
}
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:23,代码来源:chi_squared.hpp
示例5: kurtosis_excess
inline RealType kurtosis_excess(const chi_squared_distribution<RealType, Policy>& dist)
{
RealType df = dist.degrees_of_freedom();
return 12 / df;
}
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:5,代码来源:chi_squared.hpp
示例6: skewness
inline RealType skewness(const chi_squared_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING // For ADL
RealType df = dist.degrees_of_freedom();
return sqrt (8 / df); // == 2 * sqrt(2 / df);
}
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:6,代码来源:chi_squared.hpp
示例7: variance
inline RealType variance(const chi_squared_distribution<RealType, Policy>& dist)
{ // Variance of Chi-Squared distribution = 2v.
return 2 * dist.degrees_of_freedom();
} // variance
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:4,代码来源:chi_squared.hpp
示例8: mean
inline RealType mean(const chi_squared_distribution<RealType, Policy>& dist)
{ // Mean of Chi-Squared distribution = v.
return dist.degrees_of_freedom();
} // mean
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:4,代码来源:chi_squared.hpp
注:本文中的chi_squared_distribution类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论