14 #include "ROL_ParameterList.hpp"
32 wts_[0] = 0.1527533871307258;
pts_[0] = -0.0765265211334973;
33 wts_[1] = 0.1527533871307258;
pts_[1] = 0.0765265211334973;
34 wts_[2] = 0.1491729864726037;
pts_[2] = -0.2277858511416451;
35 wts_[3] = 0.1491729864726037;
pts_[3] = 0.2277858511416451;
36 wts_[4] = 0.1420961093183820;
pts_[4] = -0.3737060887154195;
37 wts_[5] = 0.1420961093183820;
pts_[5] = 0.3737060887154195;
38 wts_[6] = 0.1316886384491766;
pts_[6] = -0.5108670019508271;
39 wts_[7] = 0.1316886384491766;
pts_[7] = 0.5108670019508271;
40 wts_[8] = 0.1181945319615184;
pts_[8] = -0.6360536807265150;
41 wts_[9] = 0.1181945319615184;
pts_[9] = 0.6360536807265150;
42 wts_[10] = 0.1019301198172404;
pts_[10] = -0.7463319064601508;
43 wts_[11] = 0.1019301198172404;
pts_[11] = 0.7463319064601508;
44 wts_[12] = 0.0832767415767048;
pts_[12] = -0.8391169718222188;
45 wts_[13] = 0.0832767415767048;
pts_[13] = 0.8391169718222188;
46 wts_[14] = 0.0626720483341091;
pts_[14] = -0.9122344282513259;
47 wts_[15] = 0.0626720483341091;
pts_[15] = 0.9122344282513259;
48 wts_[16] = 0.0406014298003869;
pts_[16] = -0.9639719272779138;
49 wts_[17] = 0.0406014298003869;
pts_[17] = 0.9639719272779138;
50 wts_[18] = 0.0176140071391521;
pts_[18] = -0.9931285991850949;
51 wts_[19] = 0.0176140071391521;
pts_[19] = 0.9931285991850949;
52 for (
size_t i = 0; i < 20; i++) {
58 Real
ibeta(
const Real x)
const {
59 Real pt = 0., wt = 0., sum = 0.;
60 for (
size_t i = 0; i <
pts_.size(); i++) {
69 Beta(
const Real shape1 = 2.,
const Real shape2 = 2.)
70 :
shape1_((shape1 > 0.) ? shape1 : 2.),
shape2_((shape2 > 0.) ? shape2 : 2.) {
75 Beta(ROL::ParameterList &parlist) {
76 shape1_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Beta").get(
"Shape 1",2.);
77 shape2_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Beta").get(
"Shape 2",2.);
85 return ((input > 0.) ? ((input < 1.) ?
90 return ((input > 0.) ? ((input < 1.) ?
coeff_*
ibeta(input) : 1.) : 0.);
94 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
95 ">>> ERROR (ROL::Beta): Beta integrateCDF not implemented!");
99 if ( input <= ROL_EPSILON<Real>() ) {
102 if ( input >= 1.-ROL_EPSILON<Real>() ) {
105 Real a = ROL_EPSILON<Real>(), b = 1.-ROL_EPSILON<Real>(), c = 0.;
108 Real sa = ((fa < 0.) ? -1. : ((fa > 0.) ? 1. : 0.));
110 for (
size_t i = 0; i < 100; i++) {
113 sc = ((fc < 0.) ? -1. : ((fc > 0.) ? 1. : 0.));
114 if ( fc == 0. || (b-a)*0.5 < ROL_EPSILON<Real>() ) {
117 if ( sc == sa ) { a = c; fa = fc; sa = sc; }
131 for (
size_t i = 0; i < m; i++) {
145 void test(std::ostream &outStream = std::cout )
const {
147 std::vector<Real> X(size,0.);
148 std::vector<int> T(size,0);
149 X[0] = -4.*(Real)rand()/(Real)RAND_MAX;
153 X[2] = 0.5*(Real)rand()/(Real)RAND_MAX;
157 X[4] = 1.+4.*(Real)rand()/(Real)RAND_MAX;
Real evaluatePDF(const Real input) const
Beta(const Real shape1=2., const Real shape2=2.)
Real integrateCDF(const Real input) const
Real ibeta(const Real x) const
void initializeQuadrature(void)
Real lowerBound(void) const
void test(std::ostream &outStream=std::cout) const
Real upperBound(void) const
virtual void test(std::ostream &outStream=std::cout) const
Real evaluateCDF(const Real input) const
Beta(ROL::ParameterList &parlist)
Real moment(const size_t m) const
Real invertCDF(const Real input) const