10#ifndef ROL_MEANVALUEOBJECTIVE_DEF_HPP
11#define ROL_MEANVALUEOBJECTIVE_DEF_HPP
15template<
typename Real>
19 obj_->setParameter(param);
22template<
typename Real>
24 obj_->update(x,type,iter);
27template<
typename Real>
29 obj_->update(x,flag,iter);
32template<
typename Real>
34 return obj_->value(x,tol);
37template<
typename Real>
39 obj_->gradient(g,x,tol);
42template<
typename Real>
45 obj_->hessVec(hv,v,x,tol);
48template<
typename Real>
51 obj_->precond(Pv,v,x,tol);
54template<
typename Real>
57 int dim = sampler->getMyPoint(0).size(), nsamp = sampler->numMySamples();
58 std::vector<Real> loc(
dim), mean(
dim), pt(
dim);
60 for (
int i = 0; i < nsamp; i++) {
61 pt = sampler->getMyPoint(i);
62 wt = sampler->getMyWeight(i);
63 for (
int j = 0; j <
dim; j++) {
67 sampler->sumAll(&loc[0],&mean[0],
dim);
std::vector< Real > computeSampleMean(const Ptr< SampleGenerator< Real > > &sampler) const
MeanValueObjective(const Ptr< Objective< Real > > &obj, const Ptr< SampleGenerator< Real > > &sampler)
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply preconditioner to vector.
const Ptr< Objective< Real > > obj_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
Provides the interface to evaluate objective functions.
Defines the linear algebra or vector space interface.