44 #ifndef ROL_SROMVECTOR_H 45 #define ROL_SROMVECTOR_H 59 template <
class Real,
class Element=Real>
73 SROMVector(
const Teuchos::RCP<std::vector<Element> > &pts_vec,
74 const Teuchos::RCP<std::vector<Element> > &wts_vec,
75 const Real const_pt = 1.0,
const Real const_wt = 1.0)
76 : pts_vec_(pts_vec), wts_vec_(wts_vec),
77 const_pt_(const_pt), const_wt_(const_wt) {
78 numSamples_ = wts_vec_->size();
86 (*pts_vec_)[i*dimension_ + j] = (*ex.
getPoint(i))[j];
96 (*pts_vec_)[i*dimension_ + j] += (*ex.
getPoint(i))[j];
105 (*pts_vec_)[i*dimension_ + j] *= alpha;
107 (*wts_vec_)[i] *= alpha;
113 Real pt_val = 0, wt_val = 0;
116 pt_val += (*pts_vec_)[i*dimension_ + j] * (*ex.
getPoint(i))[j];
118 wt_val += (*wts_vec_)[i] * (ex.
getWeight(i));
120 return const_pt_*pt_val + const_wt_*wt_val;
125 val = std::sqrt(
dot(*
this) );
129 Teuchos::RCP<Vector<Real> >
clone()
const {
130 return Teuchos::rcp(
new SROMVector( Teuchos::rcp(
new std::vector<Element>(pts_vec_->size())),
131 Teuchos::rcp(
new std::vector<Element>(wts_vec_->size())),
135 Teuchos::RCP<const std::vector<Element> >
getPoint(
const size_t i)
const {
136 std::vector<Element> pt(dimension_,0.);
138 pt[j] = (*pts_vec_)[i*dimension_ + j];
140 return Teuchos::rcp(
new std::vector<Element>(pt));
143 void setPoint(
const size_t i,
const std::vector<Element> &pt) {
145 (*pts_vec_)[i*dimension_ + j] = pt[j];
150 return (*wts_vec_)[i];
Teuchos::RCP< Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
Teuchos::RCP< const std::vector< Element > > getPoint(const size_t i) const
const size_t getDimension(void) const
const Element getWeight(const size_t i) const
void setWeight(const size_t i, const Element wt)
Defines the linear algebra or vector space interface.
const size_t getNumSamples(void) const
Teuchos::RCP< std::vector< Element > > pts_vec_
Provides the std::vector implementation of the ROL::Vector interface.
Real dot(const Vector< Real > &x) const
Compute where .
SROMVector(const Teuchos::RCP< std::vector< Element > > &pts_vec, const Teuchos::RCP< std::vector< Element > > &wts_vec, const Real const_pt=1.0, const Real const_wt=1.0)
Teuchos::RCP< std::vector< Element > > wts_vec_
void scale(const Real alpha)
Compute where .
void plus(const Vector< Real > &x)
Compute , where .
void setPoint(const size_t i, const std::vector< Element > &pt)
Real norm() const
Returns where .