11 #ifndef ROL_ELEMENTWISE_VECTOR_H
12 #define ROL_ELEMENTWISE_VECTOR_H
40 void scale(
const Real alpha ) {
41 this->
applyUnary(Elementwise::Scale<Real>(alpha));
45 ROL::Ptr<Vector<Real> > y = this->
clone();
47 y->applyBinary(Elementwise::Multiply<Real>(),x);
48 return y->reduce(Elementwise::ReductionSum<Real>());
51 virtual Real
norm()
const {
52 return std::sqrt(this->
dot(*
this));
56 this->
applyBinary(Elementwise::Axpy<Real>(alpha),x);
60 this->
applyUnary(Elementwise::Fill<Real>(Real(0)));
68 virtual void applyUnary(
const Elementwise::UnaryFunction<Real> &uf ) = 0;
70 virtual void applyBinary(
const Elementwise::BinaryFunction<Real> &bf,
73 virtual Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const = 0;
83 #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.