10 #ifndef ROL_PARABOLIC_HPP
11 #define ROL_PARABOLIC_HPP
14 #include "ROL_ParameterList.hpp"
26 :
a_(std::min(a,b)),
b_(std::max(a,b)) {}
29 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Parabolic").get(
"Lower Bound",0.);
30 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Parabolic").get(
"Upper Bound",1.);
33 b_ = std::max(
b_,tmp);
37 Real scale = 6.0/std::pow(
b_-
a_,3.0);
38 return ((input >=
a_ && input <=
b_) ? scale*(input-
a_)*(
b_-input) : 0.);
42 Real d1 =
b_-
a_, d2 = d1*d1, d3 = d2*d1;
43 Real v1 = input-
a_, v2 = v1*v1, v3 = v1*v2;
44 return ((input < a_) ? 0. : ((input >
b_) ? 1. :
45 3.0*v2/d2 - 2.0*v3/d3));
49 Real d0 =
b_+
a_, d1 =
b_-
a_, d2 = d1*d1, d3 = d2*d1;
50 Real v1 = input-
a_, v2 = v1*v1, v3 = v1*v2, v4 = v1*v3;
51 return ((input < a_) ? 0. :
52 ((input >
b_) ? input - 0.5*d0 :
60 Real sa = ((fa < 0.) ? -1. : ((fa > 0.) ? 1. : 0.));
62 for (
size_t i = 0; i < 100; i++) {
65 sc = ((fc < 0.) ? -1. : ((fc > 0.) ? 1. : 0.));
66 if ( fc == 0. || (b-a)*0.5 < ROL_EPSILON<Real>() ) {
69 if ( sc == sa ) { a = c; fa = fc; sa = sc; }
77 Real a1 = std::pow(
a_,p+1), b1 = std::pow(
b_,p+1);
78 Real a2 = a1*
a_, b2 = b1*
b_;
79 Real a3 = a2*
a_, b3 = b2*
b_;
80 return 6./std::pow(b_-a_,3)
81 * (-(b3-a3)/(p+3) + (a_+
b_)*(b2-a2)/(p+2) - a_*b_*(b1-a1)/(p+1));
92 void test(std::ostream &outStream = std::cout )
const {
94 std::vector<Real> X(size,0.);
95 std::vector<int> T(size,0);
96 X[0] =
a_-4.0*(Real)rand()/(Real)RAND_MAX;
100 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
104 X[4] =
b_+4.0*(Real)rand()/(Real)RAND_MAX;
Parabolic(const Real a=0., const Real b=1.)
Real moment(const size_t m) const
Real lowerBound(void) const
Real integrateCDF(const Real input) const
Real evaluatePDF(const Real input) const
virtual void test(std::ostream &outStream=std::cout) const
Real invertCDF(const Real input) const
Real evaluateCDF(const Real input) const
void test(std::ostream &outStream=std::cout) const
Parabolic(ROL::ParameterList &parlist)
Real upperBound(void) const