10 #ifndef ROL_UNIFORM_HPP
11 #define ROL_UNIFORM_HPP
14 #include "ROL_ParameterList.hpp"
25 Uniform(
const Real lo = 0.,
const Real up = 1.)
26 :
a_((lo < up) ? lo : up),
b_((up > lo) ? up : lo) {}
29 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Uniform").get(
"Lower Bound",0.);
30 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Uniform").get(
"Upper Bound",1.);
33 b_ = std::max(
b_,tmp);
37 return ((input >=
a_ && input <=
b_) ? 1.0/(
b_-
a_) : 0.0);
41 return ((input <
a_) ? 0.0 : ((input >
b_) ? 1.0 : (input-
a_)/(
b_-
a_)));
45 return ((input <
a_) ? 0.0 : ((input >
b_) ? input - 0.5*(
a_+
b_) :
46 0.5*std::pow(input-
a_,2.0)/(
b_-
a_)));
54 return (std::pow(
b_,m+1)-std::pow(
a_,m+1))/((Real)(m+1)*(
b_-
a_));
65 void test(std::ostream &outStream = std::cout )
const {
67 std::vector<Real> X(size,0.);
68 std::vector<int> T(size,0);
69 X[0] =
a_-4.*(Real)rand()/(Real)RAND_MAX;
73 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
77 X[4] =
b_+4.*(Real)rand()/(Real)RAND_MAX;
virtual void test(std::ostream &outStream=std::cout) const