48 #include "Teuchos_ParameterList.hpp" 66 wts_[0] = 0.1527533871307258;
pts_[0] = -0.0765265211334973;
67 wts_[1] = 0.1527533871307258;
pts_[1] = 0.0765265211334973;
68 wts_[2] = 0.1491729864726037;
pts_[2] = -0.2277858511416451;
69 wts_[3] = 0.1491729864726037;
pts_[3] = 0.2277858511416451;
70 wts_[4] = 0.1420961093183820;
pts_[4] = -0.3737060887154195;
71 wts_[5] = 0.1420961093183820;
pts_[5] = 0.3737060887154195;
72 wts_[6] = 0.1316886384491766;
pts_[6] = -0.5108670019508271;
73 wts_[7] = 0.1316886384491766;
pts_[7] = 0.5108670019508271;
74 wts_[8] = 0.1181945319615184;
pts_[8] = -0.6360536807265150;
75 wts_[9] = 0.1181945319615184;
pts_[9] = 0.6360536807265150;
76 wts_[10] = 0.1019301198172404;
pts_[10] = -0.7463319064601508;
77 wts_[11] = 0.1019301198172404;
pts_[11] = 0.7463319064601508;
78 wts_[12] = 0.0832767415767048;
pts_[12] = -0.8391169718222188;
79 wts_[13] = 0.0832767415767048;
pts_[13] = 0.8391169718222188;
80 wts_[14] = 0.0626720483341091;
pts_[14] = -0.9122344282513259;
81 wts_[15] = 0.0626720483341091;
pts_[15] = 0.9122344282513259;
82 wts_[16] = 0.0406014298003869;
pts_[16] = -0.9639719272779138;
83 wts_[17] = 0.0406014298003869;
pts_[17] = 0.9639719272779138;
84 wts_[18] = 0.0176140071391521;
pts_[18] = -0.9931285991850949;
85 wts_[19] = 0.0176140071391521;
pts_[19] = 0.9931285991850949;
86 for (
size_t i = 0; i < 20; i++) {
92 Real
ibeta(
const Real x)
const {
93 Real pt = 0., wt = 0., sum = 0.;
94 for (
size_t i = 0; i <
pts_.size(); i++) {
103 Beta(
const Real shape1 = 2.,
const Real shape2 = 2.)
104 :
shape1_((shape1 > 0.) ? shape1 : 2.),
shape2_((shape2 > 0.) ? shape2 : 2.) {
109 Beta(Teuchos::ParameterList &parlist) {
110 shape1_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Beta").get(
"Shape 1",2.);
111 shape2_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Beta").get(
"Shape 2",2.);
119 return ((input > 0.) ? ((input < 1.) ?
124 return ((input > 0.) ? ((input < 1.) ?
coeff_*
ibeta(input) : 1.) : 0.);
128 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
129 ">>> ERROR (ROL::Beta): Beta integrateCDF not implemented!");
130 return ((input < 0.) ? 0. : input);
134 if ( input <= ROL_EPSILON<Real>() ) {
137 if ( input >= 1.-ROL_EPSILON<Real>() ) {
140 Real a = ROL_EPSILON<Real>(), b = 1.-ROL_EPSILON<Real>(), c = 0.;
143 Real sa = ((fa < 0.) ? -1. : ((fa > 0.) ? 1. : 0.));
145 for (
size_t i = 0; i < 100; i++) {
148 sc = ((fc < 0.) ? -1. : ((fc > 0.) ? 1. : 0.));
149 if ( fc == 0. || (b-a)*0.5 < ROL_EPSILON<Real>() ) {
152 if ( sc == sa ) { a = c; fa = fc; sa = sc; }
166 for (
size_t i = 0; i < m; i++) {
180 void test(std::ostream &outStream = std::cout )
const {
182 std::vector<Real> X(size,0.);
183 std::vector<int> T(size,0);
184 X[0] = -4.*(Real)rand()/(Real)RAND_MAX;
188 X[2] = 0.5*(Real)rand()/(Real)RAND_MAX;
192 X[4] = 1.+4.*(Real)rand()/(Real)RAND_MAX;
Beta(const Real shape1=2., const Real shape2=2.)
virtual void test(std::ostream &outStream=std::cout) const
Real moment(const size_t m) const
Real evaluatePDF(const Real input) const
Real lowerBound(void) const
Real integrateCDF(const Real input) const
Real upperBound(void) const
void initializeQuadrature(void)
Real ibeta(const Real x) const
Real invertCDF(const Real input) const
Beta(Teuchos::ParameterList &parlist)
Real evaluateCDF(const Real input) const
void test(std::ostream &outStream=std::cout) const