51 #include "Teuchos_ParameterList.hpp" 58 std::vector<Teuchos::RCP<Vector<Real> > >
iterDiff;
59 std::vector<Teuchos::RCP<Vector<Real> > >
gradDiff;
71 Teuchos::RCP<SecantState<Real> >
state_;
85 Teuchos::RCP<SecantState<Real> >&
get_state() {
return state_; }
89 const Real snorm,
const int iter ) {
93 gradDiff->axpy(-1.0,gp);
95 Real sy = s.
dot(gradDiff->dual());
97 if (state_->current < state_->storage-1) {
101 state_->iterDiff.erase(state_->iterDiff.begin());
102 state_->gradDiff.erase(state_->gradDiff.begin());
103 state_->product.erase(state_->product.begin());
105 state_->iterDiff.push_back(s.
clone());
106 state_->iterDiff[state_->current]->set(s);
107 state_->gradDiff.push_back(grad.
clone());
108 state_->gradDiff[state_->current]->set(*gradDiff);
109 state_->product.push_back(sy);
119 if (state_->iter != 0 && state_->current != -1) {
120 Real yy = state_->gradDiff[state_->current]->dot(*(state_->gradDiff[state_->current]));
121 Hv.
scale(state_->product[state_->current]/yy);
131 if (state_->iter != 0 && state_->current != -1) {
132 Real yy = state_->gradDiff[state_->current]->dot(*(state_->gradDiff[state_->current]));
133 Bv.
scale(yy/state_->product[state_->current]);
139 Teuchos::RCP<Vector<Real> > vec = x.
clone();
140 Teuchos::RCP<Vector<Real> > Hvec = x.
clone();
141 Teuchos::RCP<Vector<Real> > Bvec = x.
clone();
145 applyH(*Hvec,*vec,x);
146 applyB(*Bvec,*Hvec,x);
147 vec->axpy(-1.0,*Bvec);
148 std::cout <<
" ||BHv-v|| = " << vec->norm() <<
"\n";
152 applyB(*Bvec,*vec,x);
153 applyH(*Hvec,*Bvec,x);
154 vec->axpy(-1.0,*Hvec);
155 std::cout <<
" ||HBv-v|| = " << vec->norm() <<
"\n";
virtual void update(const Vector< Real > &grad, const Vector< Real > &gp, const Vector< Real > &s, const Real snorm, const int iter)
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
std::vector< Teuchos::RCP< Vector< Real > > > iterDiff
virtual void scale(const Real alpha)=0
Compute where .
virtual void applyB0(Vector< Real > &Bv, const Vector< Real > &v, const Vector< Real > &x)
virtual void applyH0(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &x)
std::vector< Teuchos::RCP< Vector< Real > > > gradDiff
void test(const Vector< Real > &x, const Vector< Real > &s)
Contains definitions of custom data types in ROL.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
Provides interface for and implements limited-memory secant operators.
std::vector< Real > product2
Teuchos::RCP< SecantState< Real > > & get_state()
Teuchos::RCP< SecantState< Real > > state_
virtual void set(const Vector &x)
Set where .
std::vector< Real > product
static const double ROL_EPSILON
Platform-dependent machine epsilon.