本文整理汇总了C++中Objective::invHessVec方法的典型用法代码示例。如果您正苦于以下问题:C++ Objective::invHessVec方法的具体用法?C++ Objective::invHessVec怎么用?C++ Objective::invHessVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objective
的用法示例。
在下文中一共展示了Objective::invHessVec方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute
void compute( Vector<Real> &s, const Vector<Real> &x,
Objective<Real> &obj, BoundConstraint<Real> &bnd,
AlgorithmState<Real> &algo_state ) {
Teuchos::RCP<StepState<Real> > step_state = Step<Real>::getState();
Real tol = std::sqrt(ROL_EPSILON<Real>()), one(1);
// Compute unconstrained step
obj.invHessVec(s,*(step_state->gradientVec),x,tol);
s.scale(-one);
}
示例2: compute
void compute( Vector<Real> &s, const Vector<Real> &x,
Objective<Real> &obj, BoundConstraint<Real> &bnd,
AlgorithmState<Real> &algo_state ) {
Real tol = std::sqrt(ROL_EPSILON<Real>());
Teuchos::RCP<StepState<Real> > step_state = Step<Real>::getState();
// Compute projected Newton step
// ---> Apply inactive-inactive block of inverse hessian to gradient
gp_->set(*(step_state->gradientVec));
bnd.pruneActive(*gp_,*(step_state->gradientVec),x,algo_state.gnorm);
obj.invHessVec(s,*gp_,x,tol);
bnd.pruneActive(s,*(step_state->gradientVec),x,algo_state.gnorm);
// ---> Add in active gradient components
gp_->set(*(step_state->gradientVec));
bnd.pruneInactive(*d_,*(step_state->gradientVec),x,algo_state.gnorm);
s.plus(gp_->dual());
s.scale(-1.0);
}