64 std::vector<Real> alpha(state->current+1,0.0);
65 for (
int i = state->current; i>=0; i--) {
66 alpha[i] = state->iterDiff[i]->dot(Hv);
67 alpha[i] /= state->product[i];
68 Hv.
axpy(-alpha[i],(state->gradDiff[i])->dual());
72 Teuchos::RCP<Vector<Real> > tmp = Hv.
clone();
77 for (
int i = 0; i <= state->current; i++) {
78 beta = Hv.
dot((state->gradDiff[i])->dual());
79 beta /= state->product[i];
80 Hv.
axpy((alpha[i]-beta),*(state->iterDiff[i]));
92 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
93 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
94 Real bv = 0.0, av = 0.0, bs = 0.0, as = 0.0;
95 for (
int i = 0; i <= state->current; i++) {
97 b[i]->set(*(state->gradDiff[i]));
98 b[i]->scale(1.0/sqrt(state->product[i]));
99 bv = v.
dot(b[i]->dual());
105 for (
int j = 0; j < i; j++) {
106 bs = (state->iterDiff[i])->dot(b[j]->dual());
107 a[i]->axpy(bs,*b[j]);
108 as = (state->iterDiff[i])->dot(a[j]->dual());
109 a[i]->axpy(-as,*a[j]);
111 as = (state->iterDiff[i])->dot(a[i]->dual());
112 a[i]->scale(1.0/sqrt(as));
113 av = v.
dot(a[i]->dual());
void applyH(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &x)
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
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)
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Provides definitions for limited-memory BFGS operators.
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 .