48 #include "ROL_ParameterList.hpp"
62 Real
igamma(
const Real s,
const Real x)
const {
63 Real sum = 0., term = 1./s;
65 while ( term != 0. ) {
67 term *= x/(s+(Real)n);
70 return std::pow(x,s)*std::exp(-x)*sum;
74 Gamma(
const Real shape = 1.,
const Real scale = 1.)
75 :
shape_((shape > 0.) ? shape : 1.),
scale_((scale > 0.) ? scale : 1.) {
80 Gamma(ROL::ParameterList &parlist) {
81 shape_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Gamma").get(
"Shape",1.);
82 scale_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Gamma").get(
"Scale",1.);
90 return ((input <= 0.) ? 0. :
coeff_*std::pow(input,
shape_-1.)*std::exp(-input/
scale_));
108 Real s = 0., xs = 0., a = 1., tmp = 0.;
109 for (
size_t i = 0; i < 100; i++) {
110 if ( std::abs(fx) < ROL_EPSILON<Real>() ) {
break; }
116 while ( std::abs(fx) > (1.0 - 1.e-4*a)*std::abs(tmp) ) {
141 return ROL_INF<Real>();
144 void test(std::ostream &outStream = std::cout )
const {
146 std::vector<Real> X(size,0.);
147 std::vector<int> T(size,0);
148 X[0] = -4.0*(Real)rand()/(Real)RAND_MAX;
152 X[2] = 4.0*(Real)rand()/(Real)RAND_MAX;
Real invertCDF(const Real input) const
Gamma(const Real shape=1., const Real scale=1.)
Real igamma(const Real s, const Real x) const
Gamma(ROL::ParameterList &parlist)
Real evaluatePDF(const Real input) const
Real evaluateCDF(const Real input) const
void test(std::ostream &outStream=std::cout) const
Real upperBound(void) const
Real lowerBound(void) const
virtual void test(std::ostream &outStream=std::cout) const
Real moment(const size_t m) const
Real integrateCDF(const Real input) const