66 std::vector<Real> alpha(state->current+1,0.0);
67 for (
int i = state->current; i>=0; i--) {
68 alpha[i] = state->iterDiff[i]->dot(Hv);
69 alpha[i] /= state->product[i];
70 Hv.
axpy(-alpha[i],(state->gradDiff[i])->dual());
74 Teuchos::RCP<Vector<Real> > tmp = Hv.
clone();
79 for (
int i = 0; i <= state->current; i++) {
80 beta = Hv.
dot((state->gradDiff[i])->dual());
81 beta /= state->product[i];
82 Hv.
axpy((alpha[i]-beta),*(state->iterDiff[i]));
94 std::vector<Teuchos::RCP<Vector<Real> > > a(state->current+1);
95 std::vector<Teuchos::RCP<Vector<Real> > > b(state->current+1);
96 Real bv = 0.0, av = 0.0, bs = 0.0, as = 0.0;
97 for (
int i = 0; i <= state->current; i++) {
99 b[i]->set(*(state->gradDiff[i]));
100 b[i]->scale(1.0/sqrt(state->product[i]));
101 bv = v.
dot(b[i]->dual());
107 for (
int j = 0; j < i; j++) {
108 bs = (state->iterDiff[i])->dot(b[j]->dual());
109 a[i]->axpy(bs,*b[j]);
110 as = (state->iterDiff[i])->dot(a[j]->dual());
111 a[i]->axpy(-as,*a[j]);
113 as = (state->iterDiff[i])->dot(a[i]->dual());
114 a[i]->scale(1.0/sqrt(as));
115 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 .