44 #ifndef ROL_FDIVERGENCE_HPP 45 #define ROL_FDIVERGENCE_HPP 109 TEUCHOS_TEST_FOR_EXCEPTION((
thresh_ <= zero), std::invalid_argument,
110 ">>> ERROR (ROL::FDivergence): Threshold must be positive!");
135 Teuchos::ParameterList &list
136 = parlist.sublist(
"SOL").sublist(
"Risk Measure").sublist(
"F-Divergence");
137 thresh_ = list.get<Real>(
"Threshold");
148 virtual Real
Fprimal(Real x,
int deriv = 0) = 0;
162 virtual Real
Fdual(Real x,
int deriv = 0) = 0;
186 void update(
const Real val,
const Real weight) {
193 sampler.
sumAll(&val,&gval,1);
212 std::vector<Real> mygval(3), gval(3);
216 sampler.
sumAll(&mygval[0],&gval[0],3);
218 std::vector<Real> stat(2);
219 stat[0] =
thresh_ + gval[0] + gval[1];
220 stat[1] = (Real)1 + gval[2];
232 valLam_ += weight * r2 * x * x;
243 std::vector<Real> myhval(5), hval(5);
249 sampler.
sumAll(&myhval[0],&hval[0],5);
251 std::vector<Real> stat(2);
void checkInputs(void) const
Contains definitions of custom data types in ROL.
void sumAll(Real *input, Real *output, int dim) const
void update(const Real val, const Vector< Real > &g, const Real weight)
Update internal risk measure storage for gradient computation.
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
Reset internal risk measure storage. Called for value and gradient computation.
Defines the linear algebra or vector space interface.
void getHessVec(Vector< Real > &hv, SampleGenerator< Real > &sampler)
Return risk measure Hessian-times-a-vector.
void update(const Real val, const Real weight)
Update internal risk measure storage for value computation.
void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x, Teuchos::RCP< Vector< Real > > &v0, const Vector< Real > &v)
Reset internal risk measure storage. Called for Hessian-times-a-vector computation.
void setVector(const Vector< Real > &vec)
void update(const Real val, const Vector< Real > &g, const Real gv, const Vector< Real > &hv, const Real weight)
Update internal risk measure storage for Hessian-time-a-vector computation.
Teuchos::RCP< Vector< Real > > dualVector_
void setStatistic(const Real stat)
FDivergence(Teuchos::ParameterList &parlist)
Constructor.
virtual Real Fdual(Real x, int deriv=0)=0
Implementation of the scalar dual F function.
FDivergence(const Real thresh)
Constructor.
virtual Real Fprimal(Real x, int deriv=0)=0
Implementation of the scalar primal F function.
Real getValue(SampleGenerator< Real > &sampler)
Return risk measure value.
Provides a general interface for the F-divergence distributionally robust expectation.
virtual void reset(Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
Reset internal risk measure storage. Called for value and gradient computation.
void getGradient(Vector< Real > &g, SampleGenerator< Real > &sampler)
Return risk measure (sub)gradient.
Provides the interface to implement risk measures.