44 #ifndef ROL_UNIFORM_HPP
45 #define ROL_UNIFORM_HPP
48 #include "ROL_ParameterList.hpp"
59 Uniform(
const Real lo = 0.,
const Real up = 1.)
60 :
a_((lo < up) ? lo : up),
b_((up > lo) ? up : lo) {}
63 a_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Uniform").get(
"Lower Bound",0.);
64 b_ = parlist.sublist(
"SOL").sublist(
"Distribution").sublist(
"Uniform").get(
"Upper Bound",1.);
67 b_ = std::max(
b_,tmp);
71 return ((input >=
a_ && input <=
b_) ? 1.0/(
b_-
a_) : 0.0);
75 return ((input <
a_) ? 0.0 : ((input >
b_) ? 1.0 : (input-
a_)/(
b_-
a_)));
79 return ((input <
a_) ? 0.0 : ((input >
b_) ? input - 0.5*(
a_+
b_) :
80 0.5*std::pow(input-
a_,2.0)/(
b_-
a_)));
88 return (std::pow(
b_,m+1)-std::pow(
a_,m+1))/((Real)(m+1)*(
b_-
a_));
99 void test(std::ostream &outStream = std::cout )
const {
101 std::vector<Real> X(size,0.);
102 std::vector<int> T(size,0);
103 X[0] =
a_-4.*(Real)rand()/(Real)RAND_MAX;
107 X[2] = (
b_-
a_)*(Real)rand()/(Real)RAND_MAX +
a_;
111 X[4] =
b_+4.*(Real)rand()/(Real)RAND_MAX;
virtual void test(std::ostream &outStream=std::cout) const