44 #ifndef ROL_MEANVALUECONSTRAINT_DEF_HPP
45 #define ROL_MEANVALUECONSTRAINT_DEF_HPP
49 template<
typename Real>
54 con_->setParameter(param);
57 template<
typename Real>
59 con_->update(x,flag,iter);
62 template<
typename Real>
64 con_->update(x,type,iter);
67 template<
typename Real>
72 template<
typename Real>
74 con_->applyJacobian(jv,v,x,tol);
77 template<
typename Real>
79 con_->applyAdjointJacobian(ajv,v,x,tol);
82 template<
typename Real>
84 con_->applyAdjointHessian(ahuv,u,v,x,tol);
87 template<
typename Real>
90 int dim = sampler->getMyPoint(0).size(), nsamp = sampler->numMySamples();
91 std::vector<Real> loc(dim), mean(dim), pt(dim);
93 for (
int i = 0; i < nsamp; i++) {
94 pt = sampler->getMyPoint(i);
95 wt = sampler->getMyWeight(i);
96 for (
int j = 0; j <
dim; j++) {
100 sampler->sumAll(&loc[0],&mean[0],dim);
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
MeanValueConstraint(const Ptr< Constraint< Real >> &con, const Ptr< SampleGenerator< Real >> &sampler)
Defines the linear algebra or vector space interface.
std::vector< Real > computeSampleMean(const Ptr< SampleGenerator< Real >> &sampler) const
void update(const Vector< Real > &x, bool flag=true, int iter=-1) override
Update constraint functions. x is the optimization variable, flag = true if optimization variable is ...
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the adjoint of the the constraint Jacobian at , , to vector .
const Ptr< Constraint< Real > > con_
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
Defines the general constraint operator interface.
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .