44 #ifndef ROL_TRUNCATEDGAUSSIAN_HPP
45 #define ROL_TRUNCATEDGAUSSIAN_HPP
49 #include "ROL_Ptr.hpp"
50 #include "ROL_ParameterList.hpp"
72 const Real mean = 0.,
const Real sdev = 1.)
73 :
a_((lo < up) ? lo : up),
b_((up > lo) ? up : lo),
76 gauss_ = ROL::makePtr<Gaussian<Real>>();
84 const Real
zero(0), one(1);
85 ROL::ParameterList TGlist
86 = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Truncated Gaussian");
87 a_ = TGlist.get(
"Lower Bound",-one);
88 b_ = TGlist.get(
"Upper Bound", one);
91 b_ = std::max(
b_,tmp);
94 sdev_ = TGlist.get(
"Standard Deviation",one);
98 gauss_ = ROL::makePtr<Gaussian<Real>>();
113 return ((input <=
a_) ?
zero : ((input >=
b_) ? one :
118 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
119 ">>> ERROR (ROL::TruncatedGaussian): Truncated Gaussian integrateCDF not implemented!");
136 case 1: val = mean;
break;
137 case 2: val = var*(one+(
alpha_*phiA-
beta_*phiB)/
Z_-std::pow((phiA-phiB)/
Z_,2))+mean*mean;
break;
139 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
140 ">>> ERROR (ROL::TruncatedGaussian): Truncated Gaussian moment not implemented for m > 2!");
153 void test(std::ostream &outStream = std::cout )
const {
155 std::vector<Real> X(size,0);
156 std::vector<int> T(size,0);
158 X[0] =
a_-four*(Real)rand()/(Real)RAND_MAX;
162 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
166 X[4] =
b_+four*(Real)rand()/(Real)RAND_MAX;
void test(std::ostream &outStream=std::cout) const
Real lowerBound(void) const
Real upperBound(void) const
Real integrateCDF(const Real input) const
Real invertCDF(const Real input) const
Real evaluateCDF(const Real input) const
TruncatedGaussian(ROL::ParameterList &parlist)
Real moment(const size_t m) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Real evaluatePDF(const Real input) const
ROL::Ptr< Gaussian< Real > > gauss_
virtual void test(std::ostream &outStream=std::cout) const
TruncatedGaussian(const Real lo=-1., const Real up=1., const Real mean=0., const Real sdev=1.)