64 updateIterate_ =
true;
69 const Real snorm,
const int iter ) {
74 Teuchos::RCP<Vector<Real> > gradDiff = grad.
clone();
76 gradDiff->axpy(-1.0,gp);
78 Real sy = s.
dot(gradDiff->dual());
79 if (updateIterate_ || state->current == -1) {
80 if (state->current < state->storage-1) {
84 state->iterDiff.erase(state->iterDiff.begin());
85 state->gradDiff.erase(state->gradDiff.begin());
86 state->product.erase(state->product.begin());
88 state->iterDiff.push_back(s.
clone());
89 state->iterDiff[state->current]->set(s);
90 state->gradDiff.push_back(grad.
clone());
91 state->gradDiff[state->current]->set(*gradDiff);
92 state->product.push_back(sy);
94 updateIterate_ =
true;
111 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
112 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
113 Real byi = 0.0, byj = 0.0, bv = 0.0, normbi = 0.0, normyi = 0.0;
114 for (
int i = 0; i <= state->current; i++) {
117 applyH0(*(a[i]),*(state->gradDiff[i]),x);
118 for (
int j = 0; j < i; j++) {
119 byj = b[j]->dot((state->gradDiff[j])->dual());
120 byi = b[j]->dot((state->gradDiff[i])->dual());
121 a[i]->axpy(byi/byj,*(b[j]));
125 b[i]->set(*(state->iterDiff[i]));
126 b[i]->axpy(-1.0,*(a[i]));
129 byi = b[i]->dot((state->gradDiff[i])->dual());
130 normbi = b[i]->norm();
131 normyi = (state->gradDiff[i])->norm();
132 if ( i == state->current && std::abs(byi) < sqrt(
ROL_EPSILON)*normbi*normyi ) {
133 updateIterate_ =
false;
136 updateIterate_ =
true;
137 bv = b[i]->dot(v.
dual());
138 Hv.
axpy(bv/byi,*(b[i]));
157 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
158 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
159 Real bsi = 0.0, bsj = 0.0, bv = 0.0, normbi = 0.0, normsi = 0.0;
160 for (
int i = 0; i <= state->current; i++) {
163 applyB0(*(a[i]),*(state->iterDiff[i]),x);
164 for (
int j = 0; j < i; j++) {
165 bsj = (state->iterDiff[j])->dot(b[j]->dual());
166 bsi = (state->iterDiff[i])->dot(b[j]->dual());
167 a[i]->axpy(bsi/bsj,*(b[j]));
171 b[i]->set(*(state->gradDiff[i]));
172 b[i]->axpy(-1.0,*(a[i]));
175 bsi = (state->iterDiff[i])->dot(b[i]->dual());
176 normbi = b[i]->norm();
177 normsi = (state->iterDiff[i])->norm();
178 if ( i == state->current && std::abs(bsi) < sqrt(
ROL_EPSILON)*normbi*normsi ) {
179 updateIterate_ =
false;
182 updateIterate_ =
true;
183 bv = b[i]->dot(v.
dual());
184 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 void applyH0(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &x)
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Contains definitions of custom data types in ROL.
Provides definitions for limited-memory SR1 operators.
void update(const Vector< Real > &grad, const Vector< Real > &gp, const Vector< Real > &s, const Real snorm, const int iter)
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
void applyB(Vector< Real > &Bv, const Vector< Real > &v, const Vector< Real > &x)
virtual Real dot(const Vector &x) const =0
Compute where .
Provides interface for and implements limited-memory secant operators.
Teuchos::RCP< SecantState< Real > > & get_state()
virtual void set(const Vector &x)
Set where .
virtual void applyB0(Vector< Real > &Bv, const Vector< Real > &v, const Vector< Real > &x)
void applyH(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &x)
static const double ROL_EPSILON
Platform-dependent machine epsilon.