68 const Real snorm,
const int iter ) {
73 Teuchos::RCP<Vector<Real> > gradDiff = grad.
clone();
75 gradDiff->axpy(-1.0,gp);
77 Real sy = s.
dot(gradDiff->dual());
79 if (state->current < state->storage-1) {
83 state->iterDiff.erase(state->iterDiff.begin());
84 state->gradDiff.erase(state->gradDiff.begin());
85 state->product.erase(state->product.begin());
87 state->iterDiff.push_back(s.
clone());
88 state->iterDiff[state->current]->set(s);
89 state->gradDiff.push_back(grad.
clone());
90 state->gradDiff[state->current]->set(*gradDiff);
91 state->product.push_back(sy);
110 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
111 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
112 Real byi = 0.0, byj = 0.0, bv = 0.0, normbi = 0.0, normyi = 0.0;
113 for (
int i = 0; i <= state->current; i++) {
116 applyH0(*(a[i]),*(state->gradDiff[i]),x);
117 for (
int j = 0; j < i; j++) {
118 byj = b[j]->dot((state->gradDiff[j])->dual());
119 byi = b[j]->dot((state->gradDiff[i])->dual());
120 a[i]->axpy(byi/byj,*(b[j]));
124 b[i]->set(*(state->iterDiff[i]));
125 b[i]->axpy(-1.0,*(a[i]));
128 byi = b[i]->dot((state->gradDiff[i])->dual());
129 normbi = b[i]->norm();
130 normyi = (state->gradDiff[i])->norm();
131 if ( i == state->current && std::abs(byi) < sqrt(
ROL_EPSILON)*normbi*normyi ) {
136 bv = b[i]->dot(v.
dual());
137 Hv.
axpy(bv/byi,*(b[i]));
156 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
157 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
158 Real bsi = 0.0, bsj = 0.0, bv = 0.0, normbi = 0.0, normsi = 0.0;
159 for (
int i = 0; i <= state->current; i++) {
162 applyB0(*(a[i]),*(state->iterDiff[i]),x);
163 for (
int j = 0; j < i; j++) {
164 bsj = (state->iterDiff[j])->dot(b[j]->dual());
165 bsi = (state->iterDiff[i])->dot(b[j]->dual());
166 a[i]->axpy(bsi/bsj,*(b[j]));
170 b[i]->set(*(state->gradDiff[i]));
171 b[i]->axpy(-1.0,*(a[i]));
174 bsi = (state->iterDiff[i])->dot(b[i]->dual());
175 normbi = b[i]->norm();
176 normsi = (state->iterDiff[i])->norm();
177 if ( i == state->current && std::abs(bsi) < sqrt(
ROL_EPSILON)*normbi*normsi ) {
182 bv = b[i]->dot(v.
dual());
183 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.