10 #ifndef ROL_KUMARASWAMY_HPP
11 #define ROL_KUMARASWAMY_HPP
14 #include "ROL_ParameterList.hpp"
29 size_t nchoosek(
const size_t n,
const size_t k)
const {
30 return ((k==0) ? 1 : (n*
nchoosek(n-1,k-1))/k);
35 const Real exp1 = 0.5,
const Real exp2 = 0.5)
36 :
a_(std::min(a,b)),
b_(std::max(a,b)),
37 exp1_((exp1>0.) ? exp1 : 0.5),
exp2_((exp2>0.) ? exp2 : 0.5) {
42 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Lower Bound",0.);
43 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Upper Bound",1.);
46 b_ = std::max(
b_,tmp);
48 exp1_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Exponent 1",0.5);
49 exp2_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Kumaraswamy").get(
"Exponent 2",0.5);
57 Real x = (input -
a_)/(
b_-
a_);
58 return ((x <= 0.) ? 0. : ((x >= 1.) ? 0. :
63 Real x = (input -
a_)/(
b_-
a_);
64 return ((x <= 0.) ? 0. : ((x >= 1.) ? 1. : 1.-std::pow(1.-std::pow(x,
exp1_),
exp2_)));
68 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
69 ">>> ERROR (ROL::Kumaraswamy): Kumaraswamy integrateCDF not implemented!");
73 Real x = std::pow(1.-std::pow(1.-input,1./
exp2_),1./
exp1_);
78 Real val = 0., binom = 0.,
moment = 0.;
79 for (
size_t i = 0; i < m+1; i++) {
82 val += binom*std::pow(
a_,m-i)*std::pow(
b_-
a_,i+1)*
moment;
95 void test(std::ostream &outStream = std::cout )
const {
97 std::vector<Real> X(size,0.);
98 std::vector<int> T(size,0);
99 X[0] =
a_-4.*(Real)rand()/(Real)RAND_MAX;
103 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
107 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