71 const Real snorm,
const int iter ) {
76 state->iterate = x.
clone();
80 state->iterate->set(x);
82 ROL::Ptr<Vector<Real> > gradDiff = grad.
clone();
84 gradDiff->axpy(-one,gp);
86 Real sy = s.
dot(gradDiff->dual());
88 if (state->current < state->storage-1) {
92 state->iterDiff.erase(state->iterDiff.begin());
93 state->gradDiff.erase(state->gradDiff.begin());
94 state->product.erase(state->product.begin());
96 state->iterDiff.push_back(s.
clone());
97 state->iterDiff[state->current]->set(s);
98 state->gradDiff.push_back(grad.
clone());
99 state->gradDiff[state->current]->set(*gradDiff);
100 state->product.push_back(sy);
118 std::vector<ROL::Ptr<Vector<Real> > > a(state->current+1);
119 std::vector<ROL::Ptr<Vector<Real> > > b(state->current+1);
120 Real byi(0), byj(0), bv(0), normbi(0), normyi(0), one(1);
121 for (
int i = 0; i <= state->current; i++) {
124 applyH0(*(a[i]),*(state->gradDiff[i]));
125 for (
int j = 0; j < i; j++) {
126 byj = b[j]->dot((state->gradDiff[j])->dual());
127 byi = b[j]->dot((state->gradDiff[i])->dual());
128 a[i]->axpy(byi/byj,*(b[j]));
132 b[i]->set(*(state->iterDiff[i]));
133 b[i]->axpy(-one,*(a[i]));
136 byi = b[i]->dot((state->gradDiff[i])->dual());
137 normbi = b[i]->norm();
138 normyi = (state->gradDiff[i])->norm();
139 if ( i == state->current && std::abs(byi) < sqrt(ROL_EPSILON<Real>())*normbi*normyi ) {
144 bv = b[i]->dot(v.
dual());
145 Hv.
axpy(bv/byi,*(b[i]));
163 std::vector<ROL::Ptr<Vector<Real> > > a(state->current+1);
164 std::vector<ROL::Ptr<Vector<Real> > > b(state->current+1);
165 Real bsi(0), bsj(0), bv(0), normbi(0), normsi(0), one(1);
166 for (
int i = 0; i <= state->current; i++) {
169 applyB0(*(a[i]),*(state->iterDiff[i]));
170 for (
int j = 0; j < i; j++) {
171 bsj = (state->iterDiff[j])->dot(b[j]->dual());
172 bsi = (state->iterDiff[i])->dot(b[j]->dual());
173 a[i]->axpy(bsi/bsj,*(b[j]));
177 b[i]->set(*(state->gradDiff[i]));
178 b[i]->axpy(-one,*(a[i]));
181 bsi = (state->iterDiff[i])->dot(b[i]->dual());
182 normbi = b[i]->norm();
183 normsi = (state->iterDiff[i])->norm();
184 if ( i == state->current && std::abs(bsi) < sqrt(ROL_EPSILON<Real>())*normbi*normsi ) {
189 bv = b[i]->dot(v.
dual());
190 Bv.
axpy(bv/bsi,*(b[i]));
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void applyB0(Vector< Real > &Bv, const Vector< Real > &v) const
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
void applyB(Vector< Real > &Bv, const Vector< Real > &v) const
void applyH(Vector< Real > &Hv, const Vector< Real > &v) const
Contains definitions of custom data types in ROL.
Provides definitions for limited-memory SR1 operators.
virtual void applyH0(Vector< Real > &Hv, const Vector< Real > &v) const
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
ROL::Ptr< SecantState< Real > > & get_state()
Provides interface for and implements limited-memory secant operators.
virtual void set(const Vector &x)
Set where .
void updateStorage(const Vector< Real > &x, const Vector< Real > &grad, const Vector< Real > &gp, const Vector< Real > &s, const Real snorm, const int iter)