14 #include "ROL_ParameterList.hpp"
28 Real
igamma(
const Real s,
const Real x)
const {
29 Real sum = 0., term = 1./s;
31 while ( term != 0. ) {
33 term *= x/(s+(Real)n);
36 return std::pow(x,s)*std::exp(-x)*sum;
40 Gamma(
const Real shape = 1.,
const Real scale = 1.)
41 :
shape_((shape > 0.) ? shape : 1.),
scale_((scale > 0.) ? scale : 1.) {
46 Gamma(ROL::ParameterList &parlist) {
47 shape_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Gamma").get(
"Shape",1.);
48 scale_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Gamma").get(
"Scale",1.);
56 return ((input <= 0.) ? 0. :
coeff_*std::pow(input,
shape_-1.)*std::exp(-input/
scale_));
74 Real s = 0., xs = 0., a = 1., tmp = 0.;
75 for (
size_t i = 0; i < 100; i++) {
76 if ( std::abs(fx) < ROL_EPSILON<Real>() ) {
break; }
82 while ( std::abs(fx) > (1.0 - 1.e-4*a)*std::abs(tmp) ) {
107 return ROL_INF<Real>();
110 void test(std::ostream &outStream = std::cout )
const {
112 std::vector<Real> X(size,0.);
113 std::vector<int> T(size,0);
114 X[0] = -4.0*(Real)rand()/(Real)RAND_MAX;
118 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