44 #ifndef ROL_PARABOLIC_HPP
45 #define ROL_PARABOLIC_HPP
48 #include "ROL_ParameterList.hpp"
60 :
a_(std::min(a,b)),
b_(std::max(a,b)) {}
63 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Parabolic").get(
"Lower Bound",0.);
64 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Parabolic").get(
"Upper Bound",1.);
67 b_ = std::max(
b_,tmp);
71 Real scale = 6.0/std::pow(
b_-
a_,3.0);
72 return ((input >=
a_ && input <=
b_) ? scale*(input-
a_)*(
b_-input) : 0.);
76 Real d1 =
b_-
a_, d2 = d1*d1, d3 = d2*d1;
77 Real v1 = input-
a_, v2 = v1*v1, v3 = v1*v2;
78 return ((input < a_) ? 0. : ((input >
b_) ? 1. :
79 3.0*v2/d2 - 2.0*v3/d3));
83 Real d0 =
b_+
a_, d1 =
b_-
a_, d2 = d1*d1, d3 = d2*d1;
84 Real v1 = input-
a_, v2 = v1*v1, v3 = v1*v2, v4 = v1*v3;
85 return ((input < a_) ? 0. :
86 ((input >
b_) ? input - 0.5*d0 :
94 Real sa = ((fa < 0.) ? -1. : ((fa > 0.) ? 1. : 0.));
96 for (
size_t i = 0; i < 100; i++) {
99 sc = ((fc < 0.) ? -1. : ((fc > 0.) ? 1. : 0.));
100 if ( fc == 0. || (b-a)*0.5 < ROL_EPSILON<Real>() ) {
103 if ( sc == sa ) { a = c; fa = fc; sa = sc; }
111 Real a1 = std::pow(
a_,p+1), b1 = std::pow(
b_,p+1);
112 Real a2 = a1*
a_, b2 = b1*
b_;
113 Real a3 = a2*
a_, b3 = b2*
b_;
114 return 6./std::pow(b_-a_,3)
115 * (-(b3-a3)/(p+3) + (a_+
b_)*(b2-a2)/(p+2) - a_*b_*(b1-a1)/(p+1));
126 void test(std::ostream &outStream = std::cout )
const {
128 std::vector<Real> X(size,0.);
129 std::vector<int> T(size,0);
130 X[0] =
a_-4.0*(Real)rand()/(Real)RAND_MAX;
134 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
138 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