10 #ifndef ROL_TRUNCATEDGAUSSIAN_HPP
11 #define ROL_TRUNCATEDGAUSSIAN_HPP
15 #include "ROL_Ptr.hpp"
16 #include "ROL_ParameterList.hpp"
38 const Real mean = 0.,
const Real sdev = 1.)
39 :
a_((lo < up) ? lo : up),
b_((up > lo) ? up : lo),
42 gauss_ = ROL::makePtr<Gaussian<Real>>();
50 const Real
zero(0), one(1);
51 ROL::ParameterList TGlist
52 = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Truncated Gaussian");
53 a_ = TGlist.get(
"Lower Bound",-one);
54 b_ = TGlist.get(
"Upper Bound", one);
57 b_ = std::max(
b_,tmp);
60 sdev_ = TGlist.get(
"Standard Deviation",one);
64 gauss_ = ROL::makePtr<Gaussian<Real>>();
79 return ((input <=
a_) ?
zero : ((input >=
b_) ? one :
84 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
85 ">>> ERROR (ROL::TruncatedGaussian): Truncated Gaussian integrateCDF not implemented!");
102 case 1: val = mean;
break;
103 case 2: val = var*(one+(
alpha_*phiA-
beta_*phiB)/
Z_-std::pow((phiA-phiB)/
Z_,2))+mean*mean;
break;
105 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
106 ">>> ERROR (ROL::TruncatedGaussian): Truncated Gaussian moment not implemented for m > 2!");
119 void test(std::ostream &outStream = std::cout )
const {
121 std::vector<Real> X(size,0);
122 std::vector<int> T(size,0);
124 X[0] =
a_-four*(Real)rand()/(Real)RAND_MAX;
128 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
132 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.)