45 #ifndef ROL_RIESZVECTOR_H 46 #define ROL_RIESZVECTOR_H 86 mutable ROL::Ptr<DualVector>
dual_;
87 const ROL::Ptr<OP>
op_;
94 dual_ = ROL::makePtr<DualVector>(v_->clone(),
op_,
tol_);
95 op_->apply(*(dual_->getVector()),*v_,tol_);
96 isDualInitialized_ =
true;
102 const ROL::Ptr<OP> &op,
103 Real tol=std::sqrt(ROL_EPSILON<Real>()) ) :
104 v_(v), op_(op), tol_(tol), isDualInitialized_(false) {
109 virtual Real
dot(
const V &x )
const {
110 if( !isDualInitialized_ ) {
119 return ROL::makePtr<RieszPrimalVector>( v_->clone(),
op_,
tol_ );
123 if( !isDualInitialized_ ) {
129 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
133 void applyBinary(
const Elementwise::BinaryFunction<Real> &f,
const V &x ) {
138 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
139 return v_->reduce(r);
171 const ROL::Ptr<V>
v_;
180 primal_ = ROL::makePtr<PrimalVector>(v_->clone(),
op_,
tol_);
181 op_->applyInverse(*(primal_->getVector()),*v_,tol_);
182 isPrimalInitialized_ =
true;
188 const ROL::Ptr<OP> &op,
189 Real tol=std::sqrt(ROL_EPSILON<Real>()) ) :
190 v_(v), op_(op), tol_(tol), isPrimalInitialized_(false) {
195 virtual Real
dot(
const V &x )
const {
196 if( !isPrimalInitialized_ ) {
205 return ROL::makePtr<RieszDualVector>( v_->clone(),
op_,
tol_ );
209 if( !isPrimalInitialized_ ) {
215 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
219 void applyBinary(
const Elementwise::BinaryFunction<Real> &f,
const V &x ) {
224 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
225 return v_->reduce(r);
250 #endif // ROL_RIESZVECTOR_H
void initialize_primal(void) const
RieszPrimalVector(const ROL::Ptr< V > &v, const ROL::Ptr< OP > &op, Real tol=std::sqrt(ROL_EPSILON< Real >()))
void applyUnary(const Elementwise::UnaryFunction< Real > &f)
ROL::Ptr< PrimalVector > primal_
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.
Real reduce(const Elementwise::ReductionOp< Real > &r) const
ROL::Ptr< DualVector > dual_
ROL::Ptr< V > getVector(void)
virtual ~RieszPrimalVector()
Defines the linear algebra or vector space interface.
void randomize(const Real l=0.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
ROL::Ptr< const V > getVector(void) const
virtual const V & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void setScalar(const Real C)
Set where .
ROL::Ptr< V > getVector(void)
virtual ROL::Ptr< V > clone() const
Clone to make a new (uninitialized) vector.
void randomize(const Real l=0.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
virtual ~RieszDualVector()
void applyUnary(const Elementwise::UnaryFunction< Real > &f)
Provides the interface to apply a linear operator.
void applyBinary(const Elementwise::BinaryFunction< Real > &f, const V &x)
RieszDualVector(const ROL::Ptr< V > &v, const ROL::Ptr< OP > &op, Real tol=std::sqrt(ROL_EPSILON< Real >()))
Real reduce(const Elementwise::ReductionOp< Real > &r) const
void initialize_dual(void) const
void setScalar(const Real C)
Set where .
virtual Real dot(const V &x) const
Compute where .
bool isPrimalInitialized_
ROL::Ptr< const V > getVector(void) const
virtual ROL::Ptr< V > clone() const
Clone to make a new (uninitialized) vector.
virtual Real dot(const V &x) const
Compute where .
void applyBinary(const Elementwise::BinaryFunction< Real > &f, const V &x)
virtual const V & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...