44 #ifndef ROL_KUMARASWAMY_HPP
45 #define ROL_KUMARASWAMY_HPP
48 #include "ROL_ParameterList.hpp"
63 size_t nchoosek(
const size_t n,
const size_t k)
const {
64 return ((k==0) ? 1 : (n*
nchoosek(n-1,k-1))/k);
69 const Real exp1 = 0.5,
const Real exp2 = 0.5)
70 :
a_(std::min(a,b)),
b_(std::max(a,b)),
71 exp1_((exp1>0.) ? exp1 : 0.5),
exp2_((exp2>0.) ? exp2 : 0.5) {
76 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Lower Bound",0.);
77 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Upper Bound",1.);
80 b_ = std::max(
b_,tmp);
82 exp1_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Exponent 1",0.5);
83 exp2_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Exponent 2",0.5);
91 Real x = (input -
a_)/(
b_-
a_);
92 return ((x <= 0.) ? 0. : ((x >= 1.) ? 0. :
97 Real x = (input -
a_)/(
b_-
a_);
98 return ((x <= 0.) ? 0. : ((x >= 1.) ? 1. : 1.-std::pow(1.-std::pow(x,
exp1_),
exp2_)));
102 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
103 ">>> ERROR (ROL::Kumaraswamy): Kumaraswamy integrateCDF not implemented!");
104 return ((input < 0.5*(
a_+
b_)) ? 0.0 : input - 0.5*(
a_+
b_));
108 Real x = std::pow(1.-std::pow(1.-input,1./
exp2_),1./
exp1_);
113 Real val = 0., binom = 0.,
moment = 0.;
114 for (
size_t i = 0; i < m+1; i++) {
117 val += binom*std::pow(
a_,m-i)*std::pow(
b_-
a_,i+1)*
moment;
130 void test(std::ostream &outStream = std::cout )
const {
132 std::vector<Real> X(size,0.);
133 std::vector<int> T(size,0);
134 X[0] =
a_-4.*(Real)rand()/(Real)RAND_MAX;
138 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
142 X[4] =
b_+4.0*(Real)rand()/(Real)RAND_MAX;
Kumaraswamy(ROL::ParameterList &parlist)
Kumaraswamy(const Real a=0., const Real b=1., const Real exp1=0.5, const Real exp2=0.5)
Real invertCDF(const Real input) const
Real integrateCDF(const Real input) const
Real moment(const size_t m) const
size_t nchoosek(const size_t n, const size_t k) const
Real lowerBound(void) const
virtual void test(std::ostream &outStream=std::cout) const
Real upperBound(void) const
Real evaluatePDF(const Real input) const
void test(std::ostream &outStream=std::cout) const
Real evaluateCDF(const Real input) const