45 #ifndef ROL_SINGLETONVECTOR_H
46 #define ROL_SINGLETONVECTOR_H
86 void axpy(
const Real alpha,
const V& x ) {
90 void scale(
const Real alpha ) {
94 Real
dot(
const V& x )
const {
105 return ROL::makePtr<SingletonVector>(0);
108 ROL::Ptr<V>
basis(
const int i)
const {
109 ROL_TEST_FOR_EXCEPTION( i >= 1 || i < 0,
110 std::invalid_argument,
111 "Error: Basis index must be between 0 and vector dimension." );
112 return ROL::makePtr<SingletonVector>(1);
117 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
121 void applyBinary(
const Elementwise::BinaryFunction<Real> &f,
const V& x ) {
125 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
136 Real x =
static_cast<Real
>(rand())/static_cast<Real>(RAND_MAX);
140 void print( std::ostream& os )
const {
141 os <<
value_ << std::endl;
152 #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
SingletonVector(const Real &value=0)
void setValue(const Real &v)
void setScalar(const Real C)
Set where .