61 lBFGS(
int M,
bool useDefaultScaling =
true, Real Bscaling = Real(1))
62 :
Secant<Real>(M,useDefaultScaling,Bscaling) {}
69 std::vector<Real> alpha(
state_->current+1,
zero);
70 for (
int i =
state_->current; i>=0; i--) {
71 alpha[i] =
state_->iterDiff[i]->dot(Hv);
72 alpha[i] /=
state_->product[i];
73 Hv.
axpy(-alpha[i],(
state_->gradDiff[i])->dual());
77 Ptr<Vector<Real>> tmp = Hv.
clone();
82 for (
int i = 0; i <=
state_->current; i++) {
85 beta /=
state_->product[i];
86 Hv.
axpy((alpha[i]-beta),*(
state_->iterDiff[i]));
97 std::vector<Ptr<Vector<Real>>> a(
state_->current+1);
98 std::vector<Ptr<Vector<Real>>> b(
state_->current+1);
99 Real bv(0), av(0), bs(0), as(0);
100 for (
int i = 0; i <=
state_->current; i++) {
102 b[i]->set(*(
state_->gradDiff[i]));
103 b[i]->scale(one/sqrt(
state_->product[i]));
111 for (
int j = 0; j < i; j++) {
114 a[i]->axpy(bs,*b[j]);
117 a[i]->axpy(-as,*a[j]);
121 a[i]->scale(one/sqrt(as));
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Provides interface for and implements limited-memory secant operators.
virtual void applyB0(Vector< Real > &Bv, const Vector< Real > &v) const
virtual void applyH0(Vector< Real > &Hv, const Vector< Real > &v) const
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
const Ptr< SecantState< Real > > state_
Defines the linear algebra or vector space interface.
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
virtual void set(const Vector &x)
Set where .
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 axpy(const Real alpha, const Vector &x)
Compute where .
Provides definitions for limited-memory BFGS operators.
void applyB(Vector< Real > &Bv, const Vector< Real > &v) const
void applyH(Vector< Real > &Hv, const Vector< Real > &v) const
lBFGS(int M, bool useDefaultScaling=true, Real Bscaling=Real(1))