45 #ifndef ROL_ELEMENTWISE_VECTOR_H 46 #define ROL_ELEMENTWISE_VECTOR_H 74 void scale(
const Real alpha ) {
75 this->
applyUnary(Elementwise::Scale<Real>(alpha));
79 Teuchos::RCP<Vector<Real> > y = this->
clone();
81 y->applyBinary(Elementwise::Multiply<Real>(),x);
82 return y->reduce(Elementwise::ReductionSum<Real>());
85 virtual Real
norm()
const {
86 Teuchos::RCP<Vector<Real> > y = this->
clone();
88 y->applyBinary(Elementwise::Multiply<Real>(), *y);
89 return std::sqrt( y->reduce(Elementwise::ReductionSum<Real>()) );
93 this->
applyBinary(Elementwise::Axpy<Real>(alpha),x);
97 this->
applyUnary(Elementwise::Fill<Real>(Real(0)));
112 #endif // ROL_ELEMENTWISE_VECTOR_H void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
Intermediate abstract class which does not require users implements plus, set, scale, axpy, norm, dot, or zero if they implement the three elementwise functions: applyUnary, applyBinary, and reduce.
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
void scale(const Real alpha)
Compute where .
virtual Real norm() const
Returns where .
virtual void applyUnary(const Elementwise::UnaryFunction< Real > &f)
virtual Real dot(const Vector< Real > &x) const
Compute where .
void plus(const Vector< Real > &x)
Compute , where .
virtual ~ElementwiseVector()
void zero()
Set to zero vector.