11 #ifndef ROL_SINGLETONVECTOR_H
12 #define ROL_SINGLETONVECTOR_H
52 void axpy(
const Real alpha,
const V& x ) {
56 void scale(
const Real alpha ) {
60 Real
dot(
const V& x )
const {
71 return ROL::makePtr<SingletonVector>(0);
74 ROL::Ptr<V>
basis(
const int i)
const {
75 ROL_TEST_FOR_EXCEPTION( i >= 1 || i < 0,
76 std::invalid_argument,
77 "Error: Basis index must be between 0 and vector dimension." );
78 return ROL::makePtr<SingletonVector>(1);
83 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
87 void applyBinary(
const Elementwise::BinaryFunction<Real> &f,
const V& x ) {
91 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
99 void randomize(
const Real l=0.0,
const Real u=1.0 ) {
102 Real x =
static_cast<Real
>(rand())/static_cast<Real>(RAND_MAX);
106 void print( std::ostream& os )
const {
107 os <<
value_ << std::endl;
118 #endif // ROL_SINGLETONVECTOR_H
void applyBinary(const Elementwise::BinaryFunction< Real > &f, const V &x)
ROL::Ptr< V > clone() const
Clone to make a new (uninitialized) vector.
ROL::Objective_SimOpt value
Real reduce(const Elementwise::ReductionOp< Real > &r) const
Defines the linear algebra or vector space interface.
void print(std::ostream &os) const
Real dot(const V &x) const
Compute where .
void randomize(const Real l=0.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
void applyUnary(const Elementwise::UnaryFunction< Real > &f)
ROL::Ptr< V > basis(const int i) const
Return i-th basis vector.
int dimension() const
Return dimension of the vector space.
void scale(const Real alpha)
Compute where .
void set(const V &x)
Set where .
Real norm() const
Returns where .
void plus(const V &x)
Compute , where .
void axpy(const Real alpha, const V &x)
Compute where .
Real getValueX(const V &x) const
void setScalar(const Real C)
Set where .
SingletonVector(Real value=Real(0))