44 #ifndef ROL_STDVECTOR_H
45 #define ROL_STDVECTOR_H
59 template <
class Real,
class Element=Real>
72 const std::vector<Element>& xval = *ex.
getVector();
73 std::copy(xval.begin(),xval.end(),
std_vec_->begin());
78 const std::vector<Element>& xval = *ex.
getVector();
81 (*std_vec_)[i] += xval[i];
85 void scale(
const Real alpha ) {
88 (*std_vec_)[i] *= alpha;
94 const std::vector<Element>& xval = *ex.
getVector();
98 val += (*std_vec_)[i]*xval[i];
105 val = std::sqrt(
dot(*
this) );
109 Teuchos::RCP<Vector<Real> >
clone()
const {
110 return Teuchos::rcp(
new StdVector( Teuchos::rcp(
new std::vector<Element>(
std_vec_->size())) ));
113 Teuchos::RCP<const std::vector<Element> >
getVector()
const {
121 Teuchos::RCP<Vector<Real> >
basis(
const int i )
const {
122 Teuchos::RCP<StdVector> e = Teuchos::rcp(
new StdVector( Teuchos::rcp(
new std::vector<Element>(
std_vec_->size(), 0.0)) ));
123 (*e->getVector())[i] = 1.0;
133 namespace StdVector_Helper {
void scale(const Real alpha)
Compute where .
Teuchos::RCP< const std::vector< Element > > getVector() const
Real dot(const Vector< Real > &x) const
Compute where .
StdVector(const Teuchos::RCP< std::vector< Element > > &std_vec)
Teuchos::RCP< Vector< Real > > basis(const int i) const
Return i-th basis vector.
Defines the linear algebra or vector space interface.
Teuchos::RCP< std::vector< Element > > getVector()
Teuchos::RCP< Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
Real norm() const
Returns where .
Provides the std::vector implementation of the ROL::Vector interface.
void plus(const Vector< Real > &x)
Compute , where .
Teuchos::RCP< std::vector< Real > > downCast(Vector< Real > &x)
Teuchos::RCP< std::vector< Element > > std_vec_
int dimension() const
Return dimension of the vector space.
void set(const Vector< Real > &x)
Set where .
Teuchos::RCP< const std::vector< Real > > constDownCast(const Vector< Real > &x)