44 #ifndef ROL_BATCHSTDVECTOR_H 45 #define ROL_BATCHSTDVECTOR_H 59 typedef typename std::vector<Real>::size_type
uint;
61 const Teuchos::RCP<BatchManager<Real> >
bman_;
76 uint numMySamples = yval.size();
77 TEUCHOS_TEST_FOR_EXCEPTION( xval.size() != numMySamples, std::invalid_argument,
78 "Error: Vectors must have the same dimension." );
79 Real val(0), sum_val(0);
80 for (
uint i = 0; i < numMySamples; ++i) {
81 val += xval[i] * yval[i];
84 bman_->sumAll(&val,&sum_val,1);
88 virtual Teuchos::RCP<Vector<Real> >
clone(
void)
const {
90 uint numMySamples = yval.size();
92 Teuchos::rcp(
new std::vector<Real>(numMySamples)),
bman_));
98 bman_->sumAll(&dim,&sum,1);
102 Real
reduce(
const Elementwise::ReductionOp<Real> &r)
const {
104 uint numMySamples = yval.size();
105 Real result = r.initialValue();
106 for (
uint i = 0; i < numMySamples; i++) {
107 r.reduce(yval[i],result);
111 bman_->reduceAll(&result,&sum,r);
int dimension(void) const
Return dimension of the vector space.
Provides the std::vector implementation of the ROL::Vector interface.
virtual Real dot(const Vector< Real > &x) const
Compute where .
Defines the linear algebra or vector space interface.
const Teuchos::RCP< BatchManager< Real > > bman_
Provides the std::vector implementation of the ROL::Vector interface.
Teuchos::RCP< const std::vector< Real > > getVector() const
BatchStdVector(const Teuchos::RCP< std::vector< Real > > &vec, const Teuchos::RCP< BatchManager< Real > > &bman)
std::vector< Real >::size_type uint
Real reduce(const Elementwise::ReductionOp< Real > &r) const
const Teuchos::RCP< BatchManager< Real > > getBatchManager(void) const
virtual Teuchos::RCP< Vector< Real > > clone(void) const
Clone to make a new (uninitialized) vector.