A class used to generate a truncated normal distribution.
More...
#include <TruncatedNormalDistribution.h>
|
| TruncatedNormalDistribution (const InputParameters ¶meters) |
|
virtual Real | pdf (const Real &x) const override |
|
virtual Real | cdf (const Real &x) const override |
|
virtual Real | quantile (const Real &p) const override |
|
|
static InputParameters | validParams () |
|
static Real | pdf (const Real &x, const Real &mean, const Real &std_dev, const Real &lower_bound, const Real &upper_bound) |
|
static Real | cdf (const Real &x, const Real &mean, const Real &std_dev, const Real &lower_bound, const Real &upper_bound) |
|
static Real | quantile (const Real &p, const Real &mean, const Real &std_dev, const Real &lower_bound, const Real &upper_bound) |
|
static Real | pdf (const Real &x, const Real &mean, const Real &std_dev) |
|
static Real | cdf (const Real &x, const Real &mean, const Real &std_dev) |
|
static Real | quantile (const Real &p, const Real &mean, const Real &std_dev) |
|
|
|
static const std::array< Real, 6 > | _a |
|
static const std::array< Real, 6 > | _b |
|
A class used to generate a truncated normal distribution.
Definition at line 22 of file TruncatedNormalDistribution.h.
◆ TruncatedNormalDistribution()
TruncatedNormalDistribution::TruncatedNormalDistribution |
( |
const InputParameters & |
parameters | ) |
|
◆ cdf() [1/3]
Real TruncatedNormalDistribution::cdf |
( |
const Real & |
x | ) |
const |
|
overridevirtual |
◆ cdf() [2/3]
Real NormalDistribution::cdf |
( |
const Real & |
x, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev |
|
) |
| |
|
staticinherited |
Definition at line 50 of file NormalDistribution.C.
52 return 0.5 * (1.0 + std::erf((x - mean) / (std_dev * std::sqrt(2.0))));
◆ cdf() [3/3]
Real TruncatedNormalDistribution::cdf |
( |
const Real & |
x, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev, |
|
|
const Real & |
lower_bound, |
|
|
const Real & |
upper_bound |
|
) |
| |
|
static |
◆ pdf() [1/3]
Real TruncatedNormalDistribution::pdf |
( |
const Real & |
x | ) |
const |
|
overridevirtual |
◆ pdf() [2/3]
Real NormalDistribution::pdf |
( |
const Real & |
x, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev |
|
) |
| |
|
staticinherited |
Definition at line 43 of file NormalDistribution.C.
45 return 1.0 / (std_dev * std::sqrt(2.0 * M_PI)) *
46 std::exp(-0.5 * Utility::pow<2>((x - mean) / std_dev));
◆ pdf() [3/3]
Real TruncatedNormalDistribution::pdf |
( |
const Real & |
x, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev, |
|
|
const Real & |
lower_bound, |
|
|
const Real & |
upper_bound |
|
) |
| |
|
static |
◆ quantile() [1/3]
Real TruncatedNormalDistribution::quantile |
( |
const Real & |
p | ) |
const |
|
overridevirtual |
◆ quantile() [2/3]
Real NormalDistribution::quantile |
( |
const Real & |
p, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev |
|
) |
| |
|
staticinherited |
Definition at line 56 of file NormalDistribution.C.
58 Real x = (p < 0.5 ? p : 1.0 - p);
59 Real y = std::sqrt(-2.0 * std::log(x));
60 Real sgn = (p - 0.5 < 0.0 ? -1.0 : 1.0);
61 Real Zp = sgn * (y + (
_a[0] +
_a[1] * y +
_a[2] * Utility::pow<2>(y) +
62 _a[3] * Utility::pow<3>(y) +
_a[4] * Utility::pow<4>(y)) /
63 (
_b[0] +
_b[1] * y +
_b[2] * Utility::pow<2>(y) +
64 _b[3] * Utility::pow<3>(y) +
_b[4] * Utility::pow<4>(y)));
65 return Zp * std_dev + mean;
◆ quantile() [3/3]
Real TruncatedNormalDistribution::quantile |
( |
const Real & |
p, |
|
|
const Real & |
mean, |
|
|
const Real & |
std_dev, |
|
|
const Real & |
lower_bound, |
|
|
const Real & |
upper_bound |
|
) |
| |
|
static |
◆ validParams()
InputParameters TruncatedNormalDistribution::validParams |
( |
| ) |
|
|
static |
Definition at line 17 of file TruncatedNormalDistribution.C.
20 params.addClassDescription(
"Truncated normal distribution");
21 params.addParam<Real>(
22 "lower_bound", -std::numeric_limits<Real>::max(),
"Lower bound of the distribution ");
23 params.addParam<Real>(
24 "upper_bound", std::numeric_limits<Real>::max(),
"Upper bound of the distribution ");
◆ _a
const std::array< Real, 6 > NormalDistribution::_a |
|
staticprotectedinherited |
Initial value:= {
{-0.322232431088, -1.0, -0.342242088547, -0.0204231210245, -0.0000453642210148}}
Coefficients for the rational function used to approximate the quantile
Definition at line 40 of file NormalDistribution.h.
Referenced by NormalDistribution::quantile().
◆ _b
const std::array< Real, 6 > NormalDistribution::_b |
|
staticprotectedinherited |
◆ _lower_bound
const Real& TruncatedNormalDistribution::_lower_bound |
|
protected |
◆ _mean
const Real& NormalDistribution::_mean |
|
protectedinherited |
◆ _standard_deviation
const Real& NormalDistribution::_standard_deviation |
|
protectedinherited |
◆ _upper_bound
const Real& TruncatedNormalDistribution::_upper_bound |
|
protected |
The documentation for this class was generated from the following files: