ROL
ROL_Gradient_U.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef ROL_GRADIENT_U_H
11 #define ROL_GRADIENT_U_H
12 
14 #include "ROL_Types.hpp"
15 #include "ROL_Step.hpp"
16 
23 namespace ROL {
24 
25 template<typename Real>
26 class Gradient_U : public DescentDirection_U<Real> {
27 public:
29 
30  void compute( Vector<Real> &s, Real &snorm, Real &sdotg, int &iter, int &flag,
31  const Vector<Real> &x, const Vector<Real> &g, Objective<Real> &obj) override {
32  s.set(g.dual());
33  s.scale(static_cast<Real>(-1));
34  snorm = s.norm();
35  //sdotg = s.dot(g.dual());
36  sdotg = s.apply(g);
37  iter = 0;
38  flag = 0;
39  }
40 
41  std::string printName(void) const override {
42  std::string name = "Gradient Descent";
43  return name;
44  }
45 }; // class ROL::Gradient_U
46 
47 } // namespace ROL
48 #endif
Provides the interface to evaluate objective functions.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Definition: ROL_Vector.hpp:192
virtual void scale(const Real alpha)=0
Compute where .
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
Definition: ROL_Vector.hpp:204
Contains definitions of custom data types in ROL.
void compute(Vector< Real > &s, Real &snorm, Real &sdotg, int &iter, int &flag, const Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj) override
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
std::string printName(void) const override
Provides the interface to compute optimization steps with the gradient descent method globalized usin...
virtual void set(const Vector &x)
Set where .
Definition: ROL_Vector.hpp:175
virtual Real norm() const =0
Returns where .
Provides the interface to compute unconstrained optimization steps for line search.