45 #ifndef ROL_SECANTFACTORY_H
49 #ifndef ROL_BARZILAIBORWEIN_H
50 #define ROL_BARZILAIBORWEIN_H
61 class BarzilaiBorwein :
public Secant<Real> {
67 BarzilaiBorwein(
int type = 1) : Secant<Real>(1), type_(type) {}
70 void applyH( Vector<Real> &Hv,
const Vector<Real> &v )
const {
75 if ( state->iter != 0 && state->current != -1 ) {
77 Real yy = state->gradDiff[state->current]->dot(*(state->gradDiff[state->current]));
78 Hv.scale(state->product[state->current]/yy);
80 else if ( type_ == 2 ) {
81 Real ss = state->iterDiff[state->current]->dot(*(state->iterDiff[state->current]));
82 Hv.scale(ss/state->product[state->current]);
88 void applyB( Vector<Real> &Bv,
const Vector<Real> &v )
const {
93 if ( state->iter != 0 && state->current != -1 ) {
95 Real yy = state->gradDiff[state->current]->dot(*(state->gradDiff[state->current]));
96 Bv.scale(yy/state->product[state->current]);
98 else if ( type_ == 2 ) {
99 Real ss = state->iterDiff[state->current]->dot(*(state->iterDiff[state->current]));
100 Bv.scale(state->product[state->current]/ss);
Ptr< SecantState< Real > > & get_state()