53 #ifndef ROL_SUMOFSQUARES_HPP
54 #define ROL_SUMOFSQUARES_HPP
70 Teuchos::RCP<const std::vector<Real> > xp = ex.
getVector();
74 for (
int i=0; i<n; i++) {
75 val += pow((*xp)[i], 2);
82 Teuchos::RCP<const std::vector<Real> > xp =
84 Teuchos::RCP<std::vector<Real> > gp =
85 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(g)).getVector());
88 for(
int i=0; i<n; i++ ) {
89 (*gp)[i] = 2.0*(*xp)[i];
94 Teuchos::RCP<const std::vector<Real> > xp =
96 Teuchos::RCP<const std::vector<Real> > vp =
98 Teuchos::RCP<std::vector<Real> > hvp =
99 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(hv)).getVector());
102 for(
int i=0; i<n; i++ ) {
103 (*hvp)[i] = 2.0*(*vp)[i];
108 Teuchos::RCP<const std::vector<Real> > xp =
110 Teuchos::RCP<const std::vector<Real> > vp =
112 Teuchos::RCP<std::vector<Real> > hvp =
113 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(hv)).getVector());
116 for(
int i=0; i<n; i++ ) {
117 (*hvp)[i] = 0.5*(*vp)[i];
125 Teuchos::RCP<std::vector<Real> > x0p =
126 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(x0)).getVector());
127 Teuchos::RCP<std::vector<Real> > xp =
128 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(x)).getVector());
137 for (
int i=0; i<n; i++) {
141 for(
int i=0; i<n; i++ ) {
Provides the interface to evaluate objective functions.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Teuchos::RCP< const std::vector< Element > > getVector() const
void getSumOfSquares(Teuchos::RCP< Objective< Real > > &obj, Vector< Real > &x0, Vector< Real > &x)
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Defines the linear algebra or vector space interface.
Provides the std::vector implementation of the ROL::Vector interface.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.