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 ROL::Ptr<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 return std::sqrt(this->
dot(*
this));
90 this->
applyBinary(Elementwise::Axpy<Real>(alpha),x);
94 this->
applyUnary(Elementwise::Fill<Real>(Real(0)));
102 virtual void applyUnary(
const Elementwise::UnaryFunction<Real> &uf ) = 0;
104 virtual void applyBinary(
const Elementwise::BinaryFunction<Real> &bf,
107 virtual Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const = 0;
117 #endif // ROL_ELEMENTWISE_VECTOR_H
virtual Real reduce(const Elementwise::ReductionOp< Real > &r) const =0
virtual Real norm() const
Returns where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
virtual Real dot(const Vector< Real > &x) const
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 > &bf, const Vector< Real > &x)=0
virtual void applyUnary(const Elementwise::UnaryFunction< Real > &uf)=0
Defines the linear algebra or vector space interface.
void scale(const Real alpha)
Compute where .
void set(const Vector< Real > &x)
Set where .
void plus(const Vector< Real > &x)
Compute , where .
virtual ~ElementwiseVector()
void zero()
Set to zero vector.